Referential integrity errors

There are two types of referential integrity errors:
  • The first type of referential integrity error occurs if you are editing a parent table and you either delete or update a primary key value. If the restrict rule applies to foreign key values in the dependent table, Db2® rejects the update or delete operation. To make the change to the primary key value in the parent table, you must edit the dependent table and either delete or change all rows with a matching foreign key.
  • The second type of referential integrity error occurs if you are editing a dependent table and you create a foreign key value for which there is no corresponding entry in the parent table. Db2® rejects the insert or update operation (because a foreign key value cannot exist without a corresponding primary key value). To change the value of the foreign key in the dependent table, you must edit the parent table and create a row with a primary key value that matches the value of the new foreign key value in the dependent table.

Related tasks