Problem with select for update skip locked
We have an outbound interface like this:
-Step1: cursor Select invoice_id, amout from ap_invoices_all using
FOR UPDATE OF invoice_id skip locked
FOR UPDATE OF invoice_id skip locked
-Step2: validate some informations in cursor's data.
-Step3: Insert those data into customized table.
-Step4: commit.
The problem is:
When two request submit the outbound interface at the same time(HH:MI:SS) then one invoice is duplicated in customized table.
This is a big probem so I want to ask what wrong with this? How we can avoid it?
(Another way we can use constraint