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!

Clarification on sequence use in SQL

588770Jun 16 2010 — edited Jun 18 2010
Hello,

i'm doing a multi table insert

INSERT ALL

into one parent table and one child table. The primary key for the parent table is generated using sequence.nextval and the child table uses sequence.currval.

As far as I have understood reading some manuals I could really use sequence.nextval two times because Oracle evaluated the expression just once in a SQL query?
Also, this should mean that my code is safe even if this SQL query is executed concurrently? The parent and child table will get the correct related sequence values no matter how many times it's executed in parallel?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 16 2010
Added on Jun 16 2010
15 comments
1,941 views