Database Triggers | SQL Fundamentals | Teradata Vantage - Triggers - Advanced SQL Engine - Teradata Database

SQL Fundamentals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
zwv1557098532464.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1141
lifecycle
previous
Product Category
Teradata Vantage™

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 the 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 Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.