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.The optional declaration section in a compound trigger allows you to declare trigger-level variables and subprograms. The content of the declaration is accessible to all timing points referenced by the trigger definition. The variables and subprograms created by the declaration persist only for the duration of 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.