Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

on-lock trigger

LebogangMar 2 2011 — edited Mar 2 2011
Hi All,

I would like to get the username that has a lock on a record and append it to my custom message.
Below is my block I have on the on-lock trigger but for some reason unknown to me it returns zero records.
Now when I simulate a record lock on sqlplus I am able to get this statement to bring results.

Please help

Tx
Lebo.

declare
v_lock_message varchar2(1000);
begin
select s1.username || '@' || s1.machine
into v_lock_message
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid = l1.sid
and s2.sid = l2.sid
and l1.BLOCK = 1
and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2
and s2.username = user;

DISPLAY_MESSAGE('Customer: '||:block.customer_no||' is locked for update or delete by user '||v_lock_message, 'I', TRUE);
end;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2011
Added on Mar 2 2011
5 comments
2,190 views