16.10 - Triggers - Teradata Database

Teradata Database SQL Fundamentals

Product
Teradata Database
Release Number
16.10
Release Date
June 2017
Content Type
Programming Reference
Publication ID
B035-1141-161K
Language
English (United States)

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.

Triggers have two types of granularity:

  • 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.
  • enable a trigger
  • disable a trigger
  • change the creation timestamp for a trigger
ALTER 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.

Related Topics

For details on creating, dropping, and altering triggers, see SQL Data Definition Language - Syntax and Examples, B035-1144.