Hi, The triggers will be fired on the basis of TimeStamp of their creation in Data Dictionary. The trigger with latest timestamp will be fired at last.
Ritesh
Above answer was rated as good by the following members: manish.baehal
RE: Can we have same trigger with different names for ...
Yes you can have . This is because the triggers dont share the same namespace for tables.whereas funtions procedures tables etc share the same namespace.so they cant have the same name
RE: Can we have same trigger with different names for ...
Yes we can create trigger on same event with different names but cannot predict which trigger is executed.
for example: create or replace trigger trigg1 before delete on emp begin raise_application_error(-20001 'Delete not allowed'); end;
create or replace trigger trigg2 before delete on emp begin raise_application_error(-20001 'Deletion is not allowed'); end;
SQL> delete from emp; delete from emp * ERROR at line 1: ORA-20001: Deletion is not allowed ORA-06512: at "SCOTT.TRIGG2" line 2 ORA-04088: error during execution of trigger 'SCOTT.TRIGG2'
RE: Can we have same trigger with different names for a table?eg: create trigger trig1after insert on tab1;andeg: create trigger trig2after insert on tab1;If yes,which trigger executes first.
RE: Can we have same trigger with different names for a table?eg: create trigger trig1after insert on tab1;andeg: create trigger trig2after insert on tab1;If yes,which trigger executes first.
We can have same trigger with different names for a table
The triggers will be fired on the basis of TimeStamp of their creation in Data Dictionary. The trigger with latest timestamp will be fired at last.
RE: Can we have same trigger with different names for a table?eg: create trigger trig1after insert on tab1;andeg: create trigger trig2after insert on tab1;If yes,which trigger executes first.
Yes we can decide which trigger should fire first if two triggers are defined with the same timing point.
Eg: create trigger trig2 after insert on tab1 for each row FOLLOWS trig1;
create trigger trig1 after insert on tab1 for each row;
Here trig2 will fire after trig1. This is available on Oracle 11g onwards ONLY.
RE: Can we have same trigger with different names for a table?eg: create trigger trig1after insert on tab1;andeg: create trigger trig2after insert on tab1;If yes,which trigger executes first.
Yes you can very well have a trigger on a single table performing the same operation but with different names.
The trigger which has the latest timestamp will be executed first and then followed by the others in the order of their creation :)
RE: Can we have same trigger with different names for a table?eg: create trigger trig1after insert on tab1;andeg: create trigger trig2after insert on tab1;If yes,which trigger executes first.
yes we can create the Triggers
Firing sequence is inreverse order of creation
say :: m trigger ---created last fires first. a trigger z trigger ttt trigger tt trigger-- created first fires last