Trigger and application programs that are under commitment control

 

Here are the considerations for trigger and application programs that are running under commitment control.

When the trigger program and the application program run under the same commitment definition, a failure of the trigger program causes the rollback of all statements that are associated with the trigger program. This includes any statement in a nested trigger program. The originating change operation also rolls back. This requires the trigger program to signal an exception when it encounters an error.

When the trigger program and the application program run under different commitment definitions, the COMMIT statements in the application program only affect its own commitment definition. The programmer must commit the changes in the trigger program by issuing the COMMIT statement.

When insert or update record operations are performed under commitment control, the detection of any specific duplicate key errors is deferred until the logical end of the operation, to allow for the possibility that such errors have been resolved by that time. In the case of a trigger program running in the same commitment definition as its calling program, the logical end of the operation occurs after the single or blocked insert, update, or delete record operation is performed by the calling program, and control returns from any called before or after trigger programs. As a result, duplicate key errors are not detectable in trigger programs that use the same commitment definition as the insert, update, or delete record operation that called the trigger programs.

 

Parent topic:

Other important information about working with trigger programs