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.

(1)
REFERENCING Clause for Update

1  REFERENCING + 
2.1 1 OLD
2.1 1 NEW
1?  AS
1 correlation
Notes:
  • 1 Use path no more than once
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.