Skip to Main Content

ODP.NET

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!

Insert multiple rows in on table and retreive sequence values

953208Aug 1 2012 — edited Aug 1 2012
Hello,

I'm searching a way to insert several rows in a table that needs a sequence and retreive its.

For one row i use ExecuteScalar method with the following SQL is :
INSERT INTO MY_TABLE(MY_PK)
VALUES(SEQ_MY_TABLE.NEXTVAL) RETURNING MY_PK INTO :MY_PARAMETER

The aim is to insert several rows at one time. Currently I execute this SQL :
INSERT INTO MY_TABLE(MY_PK, MY_VALUE)
SELECT SEQ_MY_TABLE.NEXTVAL, MY_VALUE
FROM (
SELECT 0 MY_VALUE FROM DUAL UNION ALL
SELECT 1 MY_VALUE FROM DUAL
)

This query works well but i'm wondering how to retreive all sequence values generated by this query.

Is it possible and how ?

Thank you.

Sebastien
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2012
Added on Aug 1 2012
2 comments
1,232 views