Clarification on sequence use in SQL
588770Jun 16 2010 — edited Jun 18 2010Hello,
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?