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

1

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.

Share.

About Author

1 Comment

  1. /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:”Table Normal”;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-qformat:yes;
    mso-style-parent:””;
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:”Calibri”,”sans-serif”;
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-fareast-font-family:”Times New Roman”;
    mso-fareast-theme-font:minor-fareast;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:”Times New Roman”;
    mso-bidi-theme-font:minor-bidi;}

    This is very helpful and I can’t wait to take my programming expertise onto the next level. But is it also possible to make one of this and not the Row Trigger? If so, how?