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.

RETURNING clause in INSERT INTO ... SELECT ... possible?

SebaVastaJul 18 2022

I have an SQL like this:
INSERT INTO table1
()
SELECT
FROM dual
WHERE NOT EXISTS (
SELECT 1
FROM
WHERE );
Thing is, I want to get the primary key of the inserted row in table1 .
Looks like a the RETURNING clause cannot be used for INSERT INTO SELECT.
I tried and it gives error.
My DB is 11g Enterprise Edition Release 11.2.0.4.0 .

This post has been answered by Stax on Jul 18 2022
Jump to Answer
Comments
Post Details
Added on Jul 18 2022
34 comments
12,527 views