Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > CREATE TRIGGER >

Usage

A trigger, unless disabled, automatically executes a specified set of SQL statements, called the trigger action, when a specified trigger event occurs.

The trigger event that initiates the trigger action can be an INSERT, DELETE, UPDATE, or (for triggers on IDS tables only) a SELECT statement. The event must specify the table or view on which the trigger is defined. (SELECT or UPDATE events for triggers on tables can also specify one or more columns.)

You can use the CREATE TRIGGER statement in two distinct ways:

Any SQL statement that is an instance of the trigger event is called a triggering statement. When the event occurs, triggers defined on tables and triggers defined on views differ in whether the triggering statement is executed:

The CREATE TRIGGER statement can support the integrity of data in the database by defining rules by which specified DML operations (the triggering events) cause the database server to take specified actions. The following sections describe the syntax elements. Sections whose names are followed by "(IDS)" describe features that are not supported by Extended Parallel Server.

Clause Page Effect
Defining a Trigger Event and Actions Defining a Trigger Event and Action Associates triggered actions with an event
Trigger Modes (IDS) Trigger Modes (IDS) Enables or disables the trigger
Insert Events and Delete Events INSERT Events and DELETE Events Defines Insert events and Delete events
Update Events UPDATE Event Defines Update events
Select Events (IDS) SELECT Event (IDS) Defines Select events
Action Clause Action Clause Defines triggered actions
REFERENCING Clause for Delete REFERENCING Clause for Delete Declares qualifier for deleted values
REFERENCING Clause for Insert REFERENCING Clause for Insert Declares qualifier for inserted values
REFERENCING Clause for Update REFERENCING Clause for Update Declares qualifiers for old and new values
REFERENCING Clause for Select (IDS) REFERENCING Clause for Select (IDS) Declares qualifier for result set values
Correlated Table Action Correlated Table Action Defines triggered actions
Triggered Action List Triggered-Action List Defines triggered actions
INSTEAD OF Trigger on Views (IDS) INSTEAD OF Triggers on Views (IDS) Defines a trigger on views
Action Clause of INSTEAD OF Triggers (IDS) The Action Clause of INSTEAD OF Triggers (IDS) Triggered actions on views
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]