New in Oracle 11g: the FOLLOWS Clause in Create Trigger Statement

The order in which triggers of the same type fire is arbitrary. But in Oracle 11g the create trigger statement has a FOLLOWS clause. With the FOLLOWS clause you can specify after which other trigger of the same type the trigger should fire. For example, if you have two triggers, testa and testb, on table test and you want trigger testb to fire after testa, then you can create the triggers as follows:....

create or replace trigger testa
before update on test for each row
begin
  …
end;

and

create or replace trigger testb
before update on test for each row follows testa
begin
  …
end;

Trigger testa should exist before you create trigger testb. If trigger testa does not yet exist trigger testb is created with compilation errors. Then you can compile trigger testb after testa is created.
Also, trigger testb becomes invalid if you drop trigger testa after testb is created.

One Response

  1. Hayden December 23, 2011