Application Development Guide
When you create a trigger, you associate it with a table. This table
is called the subject table of the trigger. The term
update operation refers to any change in the state of the subject
table. An update operation is initiated by:
- an INSERT statement
- an UPDATE statement, or a referential constraint which performs an UPDATE
- a DELETE statement, or a referential constraint which performs a DELETE
You must associate each trigger with one of these three types of update
operations. The association is called the trigger event for
that particular trigger.
You must also define the action, called the triggered action,
that the trigger performs when its trigger event occurs. The triggered
action consists of one or more SQL statements which can execute either before
or after the database manager performs the trigger event. Once a
trigger event occurs, the database manager determines the set of rows in the
subject table that the update operation affects and executes the
trigger.
When you create a trigger, you declare the following attributes and
behavior:
- The name of the trigger.
- The name of the subject table.
- The trigger activation time (BEFORE or AFTER the update operation
executes).
- The trigger event (INSERT, DELETE, or UPDATE).
- The old values transition variable, if any.
- The new values transition variable, if any.
- The old values transition table, if any.
- The new values transition table, if any.
- The granularity (FOR EACH STATEMENT or FOR EACH ROW).
- The triggered action of the trigger (including a triggered action
condition and triggered SQL statement(s)).
- If the trigger event is UPDATE, then the trigger column list for the
trigger event of the trigger, as well as an indication of whether the trigger
column list was explicit or implicit.
- The trigger creation timestamp.
- The current function path.
For more information on the CREATE TRIGGER statement, refer to the SQL Reference.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]