A trigger is a procedure body associated with a table and an
event. A trigger can take effect before, after or instead of the
event on the subject table. Several before, after or instead of
triggers may exist for a given event on a given table, which can be
fired in a specified order.
Triggers are useful for enforcing integrity rules, maintaining
the validity of data computed from other data, accumulating history
A trigger body has no arguments in the sense a procedure does. A
trigger body implicitly sees the columns of the subject table as
read-only parameters. An update trigger may see both the new and
old values of the row of the subject table. These are
differentiated by correlation names in the REFERENCING clause.
Triggers are capable of cascading; the code of a trigger may
cause another trigger to be activated. This may lead to
non-terminating recursion in some cases. Triggers may be turned off
either inside a compound statement or inside a connection with the
SET TRIGGERS OFF statement.
An update trigger may have a set of sensitive columns whose
update will cause the trigger code to be run. Update of
non-sensitive columns will not invoke the trigger. If no column
list is specified any update will invoke the trigger.