title: oracle plsql procedure dynamic count of the tables in cursor loop
body: <p>I want to update all the tables having ABC column.Need to skip the tables which doesn't have data.I am having problem in checking the count of the table in a cursor loop.
  PLSQL code</p>
  
  <pre><code>create or replace procedure testp is
  
    CURSOR c_testp
  IS
  
      SELECT table_name,
        column_name
      FROM all_tab_columns
      WHERE column_name IN('ABC') 
      ORDER BY table_name;
  
  c int;
  
  BEGIN
  
    FOR table_rec IN c_testp
  
    LOOP
  
      BEGIN
  
        SELECT COUNT(*)
        INTO c
        FROM table_rec.table_name;
        IF(c&gt;0) THEN
          query := 'update '||table_rec.table_name||' set '||table_rec.column_name ||'= xyz';
         EXECUTE IMMEDIATE query;
         COMMIT;
        END IF;
      EXCEPTION
      WHEN no_data_found THEN
        dbms_output.put_line('data not found');
      WHEN OTHERS THEN
        dbms_output.put_line('others');
      END;
    END LOOP;
  
  END;
  </code></pre>