DB version:10gR2
I created a trigger which will insert Blocking Lock info into an Audit table. I need the trigger to stop executing if v_blockexists =0 eventhough an UPDATE has triggered the execution of this trigger. So i used RETURN as shown below. But the trigger seems to be hanging or something because an update from another session is not firing this trigger .
Is there any other way to stop the execution of this trigger if v_blockexists = 0
Here is the code
create or replace trigger audit_EMP_DTL
before update or delete or insert
on EMP_DTL
for each row
declare
pragma autonomous_transaction;
v_blockexists number := 0;
no_lock exception;
begin
select count(a.sid) into v_blockexists
from v$session a
where a.sid=(select tab1.sid
from v$lock tab1, v$lock tab2
where tab1.block =1
and tab2.request > 0
and tab1.id1=tab2.id1
and tab1.id2=tab2.id2
);
if v_blockexists = 0 then
insert into audit_blocks(program_name) values ('No block yet');
commit;
*return;*
end if;
....
....
....
Edited by: user10656925 on Nov 26, 2008 11:06 PM