Wednesday 13 June 2018

FOLLOWS clause in Oracle11g Trigger

The FOLLOWS clause lets you control the firing order of triggers that are defined on the same table and have the same timing point.

Order of Trigger Firing :

If two or more triggers with different timing points (BEFORE, AFTER, INSTEAD OF) are defined for the same statement on the same table, then they fire in the following order:

  • All BEFORE statement triggers
  • All BEFORE row triggers
  • All AFTER row triggers
  • All AFTER statement triggers

If two or more triggers are defined with the same timing point, and the order in which they fire is important, then you can control the firing order using the FOLLOWS clause

FOLLOWS

This clause lets you specify the relative firing order of triggers of the same type. Use FOLLOWS to indicate that the trigger being created should fire after the specified triggers.

The specified triggers must already exist, they must be defined on the same table as the trigger being created, and they must have been successfully compiled. They need not be enabled.

You can specify FOLLOWS in the definition of a simple trigger with a compound trigger target, or in the definition of a compound trigger with a simple trigger target. In these cases, the FOLLOWS keyword applies only to the section of the compound trigger with the same timing point as the sample trigger. If the compound trigger has no such timing point, then FOLLOWS is quietly ignored.

No comments:

Post a Comment