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

INSERT Events and DELETE Events

INSERT and DELETE events on tables are defined by those keywords and by the ON table clause, using the following syntax.

Read syntax diagramSkip visual syntax diagramINSERT or DELETE Event on a Table:
 
|--+-INSERT-+--ON--table----------------------------------------|
   '-DELETE-'
 

Element Description Restrictions Syntax
table Name of the triggering table Must exist in the database Identifier, p. Identifier

An Insert trigger is activated when an INSERT statement includes the specified table (or a synonym for table) in its INTO clause. Similarly, a Delete trigger is activated when a DELETE statement includes the specified table (or a synonym for table) in its FROM clause.

For triggers on views, the INSTEAD OF keywords must immediately precede the INSERT, DELETE, or UPDATE keyword that specifies the type of trigger event, and the name or synonym of a view (rather than of a table) must follow the ON keyword. The section INSTEAD OF Triggers on Views (IDS) describes the syntax for defining INSTEAD OF trigger events.

No more than one Insert trigger, and no more than one Delete trigger, can be defined on one table.

If you define a trigger on a subtable within a table hierarchy, and the subtable supports cascading deletes, then a DELETE operation on the supertable activates the Delete trigger on the subtable.

See also the section Re-Entrancy of Triggers for information about dependencies and restrictions on the actions of Insert triggers and Delete triggers.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]