REFERENCING Clause for Update
The REFERENCING clause for an Update trigger can declare correlation names for the original value and for the updated value in a column.
Element | Description | Restrictions | Syntax |
---|---|---|---|
correlation | Name that you declare here to qualify an old or new column value (as correlation.column) in a triggered action | Must be unique within this CREATE TRIGGER statement | Identifier |
The OLD correlation is the name of the value of the column in the triggering table before execution of the triggering statement; the NEW correlation identifies the corresponding value after the triggering statement executes.
The scope of reference of the correlation names that you declare here is only within the FOR EACH ROW trigger action list. See Correlated Table Action.
To refer to an old or new column value, prefix the column name with the correlation name and a period ( . ) symbol. For example, if the new correlation name is post, you can refer to the new value in column fname as post.fname.
If the trigger event is an UPDATE statement, you can define both old and new correlation names to refer to column values before and after the triggering UPDATE statement. For rules that govern the use of correlation names, see Using Correlation Names in Triggered Actions.
You can use the UPDATE REFERENCING clause only if you define a FOR EACH ROW trigger action.