Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two Trigger of same type on same table which will get executed first?

I have a very basic doubt. Suppose we heve two after insert trigger TR1 and TR2 on table 1. One trigger updates same Table 1 and second trigger Call procedure .. I need TR1 to execute before TR2.. How this can be achieved.. Thanks

like image 337
Avi Avatar asked Dec 04 '22 19:12

Avi


1 Answers

In Oracle 11G you can use the PRECEDES or FOLLOWS clauses e.g.

create trigger TR2
after insert on table1
for each row
follows TR1 -------------------------------------------------<<
begin
 ...
end;

Prior to 11G the order if firing was indeterminate; the only way to ensure correct execution was to combine the 2 triggers into 1.

like image 197
Tony Andrews Avatar answered May 18 '23 19:05

Tony Andrews