insert multiple rows from cursor to table
714884Jul 30 2009 — edited Jul 30 2009Hi,
I want to insert multiple rows retrieved from cursor to a table without looping the cursor till the end of cursor.
I have the following structure, plz guide me.
Create procedure procedure_name as
cursor mycursor as
select * from table1; --returns multiple row
t_data table1%rowtype;
begin
fetch mycursor to t_data;
loop
exit when cursor not found;
insert to table2
end loop;
end procedure;
===========================
Now my cursor contains multiple records. I can iterate the records in loop and insert data to another table e.g table2 with same structure.
But I want to insert the total data at a time without looping the cursor for each data.Please suggest how to do this ?
Thanks in advance.