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!

HOW TO USE RETURNING CLAUSE USING MERGE

614443Dec 20 2007 — edited Jan 3 2008
Hello All,
Is there a way to find out the rows that got inserted into a table using the merge statement.

Merge statement is given below. I need to know what rows were inserted when this query got executed.

MERGE INTO PR P USING
(
(SELECT A.ID, A.NAME, A.PENSION FROM MEMBER_PROFILE A, PROFILE B WHERE A.ID=B.ID)RES
ON P.PENSION = RES.PENSION
)

WHEN MATCHED THEN
UPDATE SET P.MOD_DATE= SYSDATE

WHEN NOT MATCHED THEN
INSERT(P.ID, P.NAME, P.PENSION)
VALUES(RES.ID, RES.NAME, RES.PENSION)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2008
Added on Dec 20 2007
8 comments
6,889 views