Work with triggers and constraints

Triggers and constraints can be used to manipulate and manage data in your database tables. These links describe different methods for adding and using triggers and constraints.

A trigger is a type of stored procedure program that is automatically called whenever a specified action is performed on a specific table. Triggers are useful for keeping audit trails, for detecting exceptional conditions, for maintaining relationships in the database, and for running applications and operations that coincide with the change operation.

Constraints are restrictions or limitations that you place on your database. Constraints are implemented at the table level. You can use constraints to create referential integrity in your database.

You can work with triggers and constraints using iSeries™ Navigator, SQL, or the traditional file interface. The following table shows the available options for each task. Click the appropriate “X” for more information about performing the task.

The iSeries Navigator tasks are also documented in the Online help. For more information about accessing iSeries Navigator objects and using Online help, see iSeries Navigator database tasks.

Task iSeries Navigator SQL Traditional file interface
Write an external trigger program X   X
Add an external trigger X   X
Add an SQL trigger X X  
Write an SQL trigger program X X  
Enable and disable a trigger X   X
Remove a trigger X X X
Create a key constraint X X X
Remove a key constraint X X X
Create a referential constraint X X X
Enable and disable a referential constraint X   X
Remove a referential constraint X X X
Create a check constraint X X X
Remove a check constraint X X X
Manage check pending constraints X