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!

Sequence get the last value (or store the .NEXTVAL anywhere)

522025Jul 12 2006 — edited Aug 23 2006
Hi there,

I created some tables and one table references the other (foreign key).
Now I want to add some test data and insert rows to both tables.

My problem is:
The "insert into command" for table a uses a sequence value to create the primary key. Now I need the assigned primary key in my second insert command to assign the right value to the foreign key.

Is there a way to get the last assigned value from a sequence? Or can I store the key to some sort of variable and use this in both statements?

Thx a lot
Dominik
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2006
Added on Jul 12 2006
19 comments
3,142 views