Trigger packages

A trigger package is a special type of package that is created only when you execute a CREATE TRIGGER statement. A trigger package executes only when the associated trigger is activated.

As with any other package, Db2 marks a trigger package invalid when you drop a table, index, or view on which the trigger package depends. Db2 executes an automatic rebind the next time the trigger is activated. However, if the automatic rebind fails, Db2 does not mark the trigger package as inoperative.

Unlike other packages, a trigger package is freed if you drop the table on which the trigger is defined, so you can re-create the trigger package only by recreating the table and the trigger.

Db2 supports basic and advanced triggers. You use a different REBIND subcommand for each type.
  • For basic trigger packages, use the REBIND TRIGGER PACKAGE subcommand . You can also use REBIND TRIGGER PACKAGE to change a limited subset of the default bind options that Db2 used when creating the package. You can identify basic triggers by querying the SYSIBM.SYSTRIGGERS catalog table. Blank values in the SQLPL column identify basic triggers.
  • For advanced trigger packages, use the REBIND PACKAGE subcommand. You can use the ALTER TRIGGER statement to change the option values with which Db2 originally bound the trigger package. You can identify advanced triggers by querying the SYSIBM.SYSTRIGGERS catalog table. 'Y' values in the SQLPL column identify advanced triggers.

    If you issue a REBIND PACKAGE command against a package for an advanced trigger, the only bind options that you can change are EXPLAIN, FLAG, PLANMGMT, and CONCENTRATESTMT. If you try to change other bind options, the command will fail and return message DSNT215I.