title: PL/SQL nested loop (loop within a loop)
body: <p>Below is a PL/SQL I'm working on </p>
  
  <pre><code>declare
  v_sql varchar2(500);
  BEGIN
  for t in (
      SELECT distinct ID 
      FROM TABLEB
      ) loop
      for c in (
          select * from (
              select 'delete from ' as test 
                  from  dual
              union all
              select 'TABLEA'||' where ' as test 
                  from dual
              union all
              select 'ID='||t.ID 
                  from dual
              )
          ) loop
          v_sql := v_sql || c.test;
          end loop;
      dbms_output.put_line(v_sql);
      end loop; 
  END;
  /
  </code></pre>
  
  <p>The result I'm getting is this</p>
  
  <pre><code>delete from TABLEA where ID=1
  delete from TABLEA where ID=1delete from TABLEA where ID=2
  </code></pre>
  
  <p>I want</p>
  
  <pre><code>delete from TABLEA where ID=1
  delete from TABLEA where ID=2
  </code></pre>
  
  <p>Any help on the PLSQL will be appreciated</p>