Row triggers are a more natural choice than statement triggers for various reasons, including performance and ease of operation.
When a data-changing statement with one or more triggers is executed, the system creates one (for delete or insert operations) or more (for update operations) transition tables before the statement executes.
For row triggers, the system scans the transition table set, accessing one row at a time. You cannot specify the ordering of the transition tables, so do not write triggered actions with outcomes that are intended to differ depending on the order of rows in the transition table.
The volume of work required to execute a row trigger can vary, depending on the information available to the triggered action, as described in the following table:
Source of data for triggered action | Comment |
---|---|
The specific rows being processed |
|
The transition tables composed of all the rows changed by the triggering statement |
|
The full set of rows in the table being changed | This behavior is similar to the behavior described in the transition tables row, but there is no syntax to indicate OLD or NEW values.
This information comes from the triggering table and does not require a REFERENCING clause to be accessed. For these kinds of outer references, the typical use of direct references to the triggering table is by means of the following methods:
|