title: How can I use table name as a variable in nested for loops in oracle pl/sql?
body: <p>I have a query like this:</p>
  
  <pre><code> v_sql:= 'select count(1) from '||v_tbl||' where col1 = ' || month_var || ' and ds =''T''';
   execute immediate v_sql into v_row_cnt;
  
     for j in 1..v_row_cnt
      loop
        for i in (select b.* from
                 (select a.*, rownum as rn
                  from (select * from MY_TABLE where col1 = month_var and DS = 'T') a
                   ) b
                 where rn=j)
        loop
  
            do_something;
        end loop;
       end loop;
  </code></pre>
  
  <p>Now, my problem is, I can't hard code MY_TABLE here. I need to use a variable. I am currently doing it this way because I need to process data row by row.</p>
  
  <p>Any ideas how to do this?</p>
  
  <p>Thanks.
  Ronn</p>