declare
pragma autonomous_transaction;
r sys_refcursor;
begin
-- read access the row that is not locked
open r for select * from DEMO where a=2;
dbms_sql.return_result(r);
-- read access the row that is locked
open r for select * from DEMO where a=1;
dbms_sql.return_result(r);
-- write access on the row that is not locked
delete from DEMO where a=2;
-- write access on the row that is locked
delete from DEMO where a=1;
commit;
end;
/
ORA-00060: deadlock detected while waiting for resource
ORA-06512: at line 14
|