Is there a way that one can test if a row has been locked for update in Oracle?
As an example, suppose the following query, performed by one user:
select * from SOME_TABLE where THE_ID = 1000 for update;
With another user I want to check if the row with THE_ID = 1000
is locked. If I try an update or something the second user gets blocked and remains waiting (do not want that).
I have also tried running the following query with the second user:
select * from SOME_TABLE where THE_ID = 1000 for update NOWAIT;
Since I can not place two locks on the same row this will fail. And it does. I get an "ORA-00054: resource busy and acquire with NOWAIT specified error". Can I always count on this error to check the presence of the lock, or is there a simpler and cleaner way of determining if a row is locked?
Thank you!