Table of Contents Previous Next


4 Triggers : 4.6 Compound Triggers

Advanced Server has added compatible syntax to support compound triggers. A compound trigger combines all the triggering timings under one trigger body that can be invoked at one or more timing points. A timing point is a point in time related to a triggering statement (an INSERT, UPDATE, DELETE or TRUNCATE statement that modifies data). The supported timing points are:
BEFORE STATEMENT: Before the triggering statement executes.
BEFORE EACH ROW: Before each row that the triggering statement affects.
AFTER EACH ROW: After each row that the triggering statement affects.
AFTER STATEMENT: After the triggering statement executes.
INSTEAD OF EACH ROW: Trigger fires once for every row affected by the triggering statement.
Note: It is not mandatory to have all the four timing blocks; you can create a compound trigger for any of the required timing-points.
If a GOTO statement is specified in a timing-point section, then the target of the GOTO statement must also be specified in the same timing-point section.
:OLD and :NEW variable identifiers cannot exist in the declarative section, the BEFORE STATEMENT section, or the AFTER STATEMENT section.
:NEW values can only be modified by the BEFORE EACH ROW block.

4 Triggers : 4.6 Compound Triggers

Table of Contents Previous Next