Sequence numbers (getting duplicate number?)
In a package we use a sequence number as the primary key for insert into a table. We can have several sessions hitting this procedure at the same time. On occasion it will get the same sequence number and we get an error that the primary key has been violated on the table where the sequence number is the primary key value. Any suggestions on how to prevent this from happening?
I came up with the below but it is still occurring on occasions.
SELECT LIMS.SQ_U_ORDER.NEXTVAL INTO v_order FROM DUAL;
SELECT COUNT (1)
INTO v_MaxOrderId