Examples

Create an after trigger EMPISRT1 that invokes user-defined function NEWEMP when the trigger is activated. An insert operation on table EMP activates the trigger. Pass transition variables for the new employee number, last name, and first name to the user-defined function.

   CREATE TRIGGER EMPISRT1
      AFTER INSERT ON EMPLOYEE
      REFERENCING NEW AS N
      FOR EACH ROW
      MODE DB2SQL
      BEGIN ATOMIC
        VALUES( NEWEMP(N.EMPNO, N.LASTNAME, N.FIRSTNAME));
      END