REFERENCING Clauses

The REFERENCING clause for any event declares a correlation name (or for Update triggers, two correlation names) that can be used to qualify column values in the triggering table. These names enable FOR EACH ROW actions to reference new or old column values in the result of trigger events.

They also enable FOR EACH ROW actions to reference old column values that existed in the triggering table prior to modification by trigger events.

Correlation names are not valid if the triggered action includes both the INSERT statement and the BEFORE WHEN or AFTER WHEN keywords. This restriction does not affect triggered actions that specify the FOR EACH ROW keywords without the BEFORE or AFTER keywords, or that include no INSERT statement.

The REFERENCING clause syntax that is described here for the CREATE TRIGGER statement is also valid in CREATE FUNCTION and CREATE PROCEDURE statements that define a trigger routine, provided that the CREATE FUNCTION or CREATE PROCEDURE statement also includes the FOR table_object clause to specify the table or view whose FOR EACH ROW actions can invoke the trigger routine.