15.00 - Trigger Terminology - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Trigger Terminology

The following table defines terms associated with the creation and use of an SQL trigger:

 

Term

Description

DISABLED

An optional element of a trigger definition that defines the current state of the trigger.

A disabled trigger is inactive until it is enabled, but its definition remains in the data dictionary.

ENABLED

An optional element of a trigger definition that defines the current state of the trigger.

An enabled trigger is an active database object.

ORDER clause

An optional clause that assigns an integer value to determine the order of execution of the trigger when multiple triggers having the same trigger action time and trigger event are defined on the same table.

REFERENCING clause

An optional clause that allows the WHEN condition and triggered actions of a trigger to reference the set of rows in the transition table set.

See “REFERENCING Clause” on page 708.

Subject table

The table with which a trigger is associated and on which its triggering event takes place.

Transition row

A row in the transition table.

Transition table

A temporary table that contains either old or new values, or both, for rows modified by a triggering statement.

See “Transition Tables” on page 707 for more information about transition tables.

Trigger action time

A specification that indicates when triggered SQL statements perform in relation to the triggering event.

A triggered statement performs either BEFORE or AFTER a triggering event.

Trigger granularity

A specification that indicates whether the trigger performs for each row or for each statement modified by the triggering event.

Trigger granularity is expressed as the trigger type, either FOR EACH STATEMENT or FOR EACH ROW.

FOR EACH STATEMENT is the default granularity for all triggers.

Triggered action

The main action part of the trigger definition, consisting of the following elements:

  • An optional trigger granularity clause
  • An optional WHEN condition
  • A triggered SQL statement
  • Triggered SQL statement

    A set of SQL statements fired by the triggering event.

    A triggered SQL statement can modify one or more tables, including the subject table.

    Triggering event

    The DML statement whose execution fires the trigger. This is a DELETE, INSERT, or UPDATE operation or a variation of these operations. An UPDATE operation can have a list of columns associated with it.

    WHEN condition

    A Boolean search condition that defines different things for different trigger types.

  • For a Statement trigger, the WHEN condition determines whether the trigger executes.
  • For a Row trigger, the WHEN condition determines the set of changed rows for which the trigger executes.