Defining a Trigger Event and Action
This syntax defines the event and action of a trigger
on a table or on a view.
(explicit id tea003)
tea003
(explicit id tea004)
tea004
(explicit id tea005)
tea005
(explicit id tea006)
tea006
(explicit id tea007)
tea007
Trigger on a Table
{ { DELETE | SELECT [ OF column ] } ONtable <DELETE and SELECT Clauses> | UPDATE [ OF column ] ONtable <UPDATE Clause> | INSERTONtable { <NEW Declaration>[] <Correlated Action>[] | <Action Clause>[] } }
UPDATE Clause
{ <Action Clause>[] | <OLD Declaration>[] [ <NEW Declaration> [] ] <Correlated Action>[] }
Trigger on a View
{ INSERT ONview [ REFERENCING NEW [ AS ] correlation ] | DELETE ONview [ REFERENCINGOLD [ AS ] correlation ] | UPDATE ONview [ { [ REFERENCING OLD [AS] correlation [ NEW [AS] correlation ] ] | REFERENCINGNEW [AS] correlation [ OLD [AS] correlation ] } ] }
FOR EACH ROW
<INSTEAD OF Triggered Action>[]
Element | Description | Restrictions | Syntax |
---|---|---|---|
column | The name of a column in the triggering table | Must exist | Identifier |
correlation | Name that you declare here to qualify an old or new column value (as correlation.column) in a triggered action | Must be unique in this trigger | Identifier |
table, view | Name or synonym of the triggering table or view. The table or view can include an owner. qualifier. | Must exist in the current database | Identifier |
The left-hand portion of the main diagram (including the table or view) defines the trigger event (sometimes called the triggering event). The rest of the diagram declares correlation names and defines the trigger action (sometimes called the triggered action).
For the syntax to specify the triggered action of triggers on tables, see Action Clause and Correlated Table Action.
For the syntax to specify the triggered action of INSTEAD OF triggers on views, see The Action Clause of INSTEAD OF Triggers.
1 See Action Clause