Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

insert multiple rows from cursor to table

714884Jul 30 2009 — edited Jul 30 2009
Hi,

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2009
Added on Jul 30 2009
2 comments
1,392 views