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!

Multiple connections Sequence.nextVal - SQL Integrity exception

673660Jun 6 2009 — edited Jun 6 2009
hi,

I have multiple connections to the db (multiple java threads each with one connection). Each thread invokes a stored procedure that inserts into tableA(id number primary key, someotherfield varchar2)
I dont have any other constraints. tableA.id is inserted as sequence.nextval
I keep seeing SQLIntegrityViolationException for tableA.id.
Looks like a race condition to me.

How does Oracle ensure unique incremental values with sequence.nextval for multiple concurrent connections ?
What can I do in pl/sql to avoid this race condition ?

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2009
Added on Jun 6 2009
5 comments
6,212 views