Triggers are active database objects associated with a subject table. A trigger essentially consists of a stored SQL statement or a block of SQL statements.
Triggers execute when an INSERT, UPDATE, DELETE, or MERGE modifies a specified column or columns in the subject table.
Typically, a stored trigger performs an UPDATE, INSERT, DELETE, MERGE, or other SQL operation on one or more tables, which may possibly include the subject table.
Triggers in Teradata Database conform to the ANSI/ISO SQL:2008 standard, and also provide some additional features.
- Row triggers fire once for each row of the subject table that is changed by the triggering event and that satisfies any qualifying condition included in the row trigger definition.
- Statement triggers fire once upon the execution of the triggering statement.
You can create, alter, and drop triggers.
|IF you want to …||THEN use …|
|define a trigger||CREATE TRIGGER.|
Disabling a trigger stops the trigger from functioning, but leaves the trigger definition in place as an object. This allows utility operations on a table that are not permitted on tables with enabled triggers.
Enabling a trigger restores its active state.
|remove a trigger from the system permanently||DROP TRIGGER.|
For details on creating, dropping, and altering triggers, see Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.