Constraints
DB2® UDB for iSeries™ supports unique, referential, and check constraints.
A unique constraint is a rule that guarantees that the values of a key are unique. A referential constraint is a rule that all non-null values of foreign keys in a dependent table have a corresponding parent key in a parent table. A check constraint is a rule that limits the values allowed in a column or group of columns. DB2 UDB for iSeries will enforce the validity of the constraint during any DML (data manipulation language) statement. Certain operations (such as restore of the dependent table), however, cause the validity of the constraint to be unknown. In this case, DML statements may be prevented until DB2 UDB for iSeries has verified the validity of the constraint.
- Unique constraints are implemented with indexes. If an index that implements a unique constraint is invalid, the Edit Rebuild of Access Paths (EDTRBDAP) command can be used to display any indexes that currently require rebuild.
- If DB2 UDB for iSeries does not currently know whether a referential constraint or check constraint is valid, the constraint is considered to be in a check pending state. The Edit Check Pending Constraints (EDTCPCST) command can be used to display any indexes that currently require rebuild.
- Adding and using check constraints
A check constraint ensures the validity of data during insert and update operations by limiting the allowed values in a column or group of columns.
Parent topic:
Data integrity
Related concepts
Constraints