Skip to Main Content

Insert statement with loop function

user8017032Oct 16 2013 — edited Oct 16 2013

Hello all,

I'm new with the loop function

What need to do is to use a select statement with a condition

This output needs to be inserted in a table

The values of the condition are stored also in a table

It will be something like this:

BEGIN

 

  FOR i IN (select nrs from table1)  LOOP

   

    INSERT INTO table_out_loop

    SELECT * FROM bigtable_vw

    WHERE nr = i

   

  END LOOP ;

   

END ;

I cant use a direct insert_into function in this case so I need the plsql to 'look' for the values 1 by 1 from the table1

Any help would be appreciated

Comments
Post Details
Added on Oct 16 2013
6 comments
395 views