Reputation: 501
I have table A and 4 row level Before Insert triggers on table A. what would be order of trigger firing? Is it runtime decided? can we order trigger firing e.g. Trigger 2 then Trigger 4 then Trigger 3 then Trigger 1?
Upvotes: 1
Views: 2528
Reputation: 10525
From the documentation, all triggers of the same type before executing triggers of a different type. If there are multiple triggers of the same type on the same table, the database chooses an arbitrary, unpredictable order.
If you want it to execute in a definite order you should use FOLLOWS clause.
CREATE OR REPLACE TRIGGER2
BEFORE INSERT
ON TEST_TABLE
FOR EACH ROW
CREATE OR REPLACE TRIGGER4
BEFORE INSERT
ON TEST_TABLE
FOR EACH ROW
FOLLOWS TRIGGER2
CREATE OR REPLACE TRIGGER3
BEFORE INSERT
ON TEST_TABLE
FOR EACH ROW
FOLLOWS TRIGGER4
Upvotes: 3