Insert multiple rows in on table and retreive sequence values
953208Aug 1 2012 — edited Aug 1 2012Hello,
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