Multiple connections Sequence.nextVal - SQL Integrity exception
673660Jun 6 2009 — edited Jun 6 2009hi,
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.