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!

FOR ALL WITH RETURNING

user10862473Jun 18 2009 — edited Jun 19 2009
Hi All,
My requirement is to return a set of values using forall returning clause.For that I am using

begin
----------
--------
FORALL J IN 1..M_T_TABLE1.COUNT SAVE EXCEPTIONS
INSERT INTO TABLE2 VALUES M_T_TABLE1(J)
RETURNING CUST_CODE BULK COLLECT INTO P_T_CUST_CODE;
exception
-----------
end;
This code is working fine and It is returning CUST_CODE values using P_T_CUST_CODE.

But there is a situation that i've to run this code in loop like..

begin
----------
--------
FOR I IN 1..NO_OF_ITERATIONS LOOP
FORALL J IN 1..M_T_TABLE1.COUNT SAVE EXCEPTIONS
INSERT INTO TABLE2 VALUES M_T_TABLE1(J)
RETURNING CUST_CODE BULK COLLECT INTO P_T_CUST_CODE;
END LOOP;
exception
-----------
end;

NOW IT IS RETURNING THE VALUES INSERTED IN LAST ITERATION ONLY .BUT I WANT THE VALUES INSERTED IN ALL ITERATIONS.

ANY IDEA HOW TO ACHIVE THAT?

THANKS IN ADVANCE.
NM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 17 2009
Added on Jun 18 2009
12 comments
3,594 views