Set up constraints for your database

You can use physical file constraints to control the integrity of the data that is maintained in your database. You can also add constraints using iSeriesā„¢ Navigator.

To add a physical file constraint, use the Add Physical File Constraint (ADDPFCST) command.
You can also add constraints using iSeries Navigator. See the following topics in the SQL programming topic:

You can also add constraints when using the SQL CREATE TABLE and ALTER TABLE statements.

Rules for setting up constraints

Here is a list of rules that apply to all physical file constraints.
  • The file must be a physical file.
  • A file can have a maximum of one member, MAXMBR(1).
  • A constraint can be defined when the file has zero members. A constraint cannot be established, however, until the file has one, and only one, member.
  • A file can have a maximum of one primary key constraint, but might have many unique constraints.
  • There is a maximum of 300 constraint relations per file. This maximum value is the sum of the following constraints:
    • The unique constraints
    • The primary key constraint
    • The check constraints
    • The referential constraints, whether they are participating as a parent or a dependent, and whether the constraints are defined or established.
  • Constraint names must be unique in a library.
  • Constraints cannot be added to files in the QTEMP library.
  • Referential constraints must have the parent and dependent file in the same auxiliary storage pool (ASP).
Related concepts
DB2 UDB for iSeries SQL Reference
SQL programming
Get started with iSeries Navigator
Related reference
Add Physical File Constraint (ADDPFCST) command
CREATE TABLE
ALTER TABLE