Thursday 27 September 2018

ORA-30006: resource busy; acquire with WAIT timeout expired and ORA-00054: resource busy and NOWAIT specified


ORA-30006 and ORA-00054 errors raised when update operation is performed against a record, that has been locked by the user or some session FOR UPDATE.

To fix this, before performing the update, check whether the record is locked or not. Simple way to check this is,

declare
l_invoice_num varchar2(100);
begin
select invoice_num into l_invoice_num
from apps.ap_invoices_all
where invoice_num = 'TEST123'
for update skip locked;

<do your update process against the invoice in AP_INVOICES_ALL table>;

exception
when no_data_update;
<do not perform update>;
end;

The select script will return NO_DATA_FOUND exception, if invoice number 'TEST123' is locked FOR UPDATE and will exit the update process.

No comments:

Post a Comment