Working with triggers and constraints

 

You can use triggers or constraints to manage data in your database tables.

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, detecting exceptional conditions, maintaining relationships in the database, and running applications and operations that coincide with the change operation.

A constraint is a restriction or limitation 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
Adding an external trigger X   X
Adding an SQL trigger X X  
Creating a check constraint X X X
Creating a key constraint X X X
Creating a referential constraint X X X
Enabling and disabling a referential constraint X   X
Enabling and disabling a trigger X   X
Managing check pending constraints X    
Removing a check constraint X X X
Removing a key constraint X X X
Removing a referential constraint X X X
Removing a trigger X X X
Writing an external trigger program X   X
Writing an SQL trigger program X X  

 

Parent topic:

Database administration