REFERENCING Clause for Delete

The REFERENCING clause for a Delete trigger can declare a correlation name for the deleted value in a column.

REFERENCING Clause for Delete

1  REFERENCING OLD?  AS  correlation
Element Description Restrictions Syntax
correlation Name that you declare here to qualify an old column value (as correlation.column) in a triggered action Must be unique within this CREATE TRIGGER statement Identifier

The correlation is a qualifier for the column value in the triggering table before the triggering statement executed. The correlation is in scope in the FOR EACH ROW trigger action list. See Correlated Table Action.

To use a correlation name in a trigger action to refer to an old column value, prefix the column name with the correlation name and a period ( . ) symbol. For example, if the NEW correlation name is post, refer to the new value for the column fname as post.fname.

If the trigger event is a DELETE statement, using the new correlation name as a qualifier causes an error, because the column has no value after the row is deleted. For the rules that govern the use of correlation names, see Using Correlation Names in Triggered Actions.

You can use the REFERENCING clause for Delete only if you define a FOR EACH ROW trigger action.