title: How to use Insert query within for loop in PLSQL using implicit cursor
body: <p>I have an existing table and I want to add some entry in another table for each row of the given first table.
  I am writing my PLSQL command as:</p>
  <pre><code>BEGIN
      FOR record in (select cola_guid, hapc_guid, tar_guid from tabA) LOOP
              
              select count(*) INTO v_record_exists
                      from p where
                      p.cola_guid = record.cola_guid;
  
              IF v_record_exists = 0 THEN
                      execute immediate 'insert into NTABLE (tar_guid, PC_NAE, PCV) values (record.tar_guid, ' || '''abcd''' || ', ' || '''val1''' || ')';
              ELSE
                      execute immediate 'insert into NTABLE (tar_guid, PC_NAE, PCV) values (record.tar_guid, ' || '''abcd''' || ', ' || '''val2''' || ')';
              END IF;
  
              execute immediate 'insert into NTABLE (tar_guid, PC_NAE, PCV) values (record.tar_guid, ' || '''RA_hapc_guid''' || ', record.hapc_guid)';
              execute immediate 'insert into NTABLE (tar_guid, PC_NAE, PCV) select record.tar_guid, PC_NAE, PCV from  p where record.cola_guid = p.cola_guid and PC_NAE = ' || '''propVal''' || ' ';
      END LOOP;
  END;
  </code></pre>
  <p>Now I am getting error:</p>
  <blockquote>
  <p>ORA-00984: column not allowed here</p>
  </blockquote>
  <p>in line:</p>
  <blockquote>
  <p>execute immediate 'insert into NTABLE (tar_guid, PC_NAE, PCV) values (record.tar_guid, ' || '''abcd''' || ', ' || '''val1''' || ')';</p>
  </blockquote>
  <p>I am new to PLSQL world but I really tried triaging and googling but wasn't able to resolve. Please guide and help.</p>