Start of change

Trigger pseudo columns

A pseudo column is an identifier that shares the same namespace as columns and variables. After regular name resolution for a column has failed, Db2® attempts to match an unqualified identifier to a pseudo column name.

Trigger pseudo columns can be referenced within an SQL trigger to access the name of the file, library, and member that caused the trigger to fire.

These names can only be used on the right side of a SET statement. The SET can only assign a single value. The target of the SET statement must be a variable declared within the trigger as either fixed length or varying length character. The length must be 10, and it cannot have a CCSID defined.

TRIGGER_FILE_NAME

This pseudo column returns the system name of the file that caused the trigger to fire.

TRIGGER_FILE_LIBRARY_NAME

This pseudo column returns the name of the library containing the file that caused the trigger to fire.

TRIGGER_FILE_MEMBER_NAME

This pseudo column returns the member name in the file that caused the trigger to fire.

Example

Access the names of the file, library, and member that caused the trigger to fire.
CREATE OR REPLACE TRIGGER MYLIB.TRIGGER1
    AFTER INSERT ON MYLIB.MYTABLE
  BEGIN
    DECLARE V_TRIG_FILE, V_TRIG_LIB, V_TRIG_MBR VARCHAR(10);
    SET V_TRIG_FILE = TRIGGER_FILE_NAME;
    SET V_TRIG_LIB = TRIGGER_FILE_LIBRARY_NAME;
    SET V_TRIG_MBR = TRIGGER_FILE_MEMBER_NAME;
  END;
End of change