Working with triggers and constraints

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

A trigger is a type of program that is automatically called whenever a specified action is performed on a specific table or view. 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.

Alternatively, generated columns can be used instead of a trigger to maintain auditing information. For more information about using generated columns for auditing, see Using a system-period temporal table for tracking auditing information.

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 IBM i Access Client Solutions, SQL, or the traditional system interface.