Details: Specifying referential constraint delete rules
You can specify one of these values for the DLTRULE parameter. The delete rule specifies the action that the system takes when you delete a parent key value. The delete rule does not affect null parent key values.
- *NOACTION (the default value)
- Record deletion in a parent file will not occur if the parent key value has a matching foreign key value.
- *CASCADE
- Record deletion in a parent file causes records in the dependent file to be deleted when the parent key value matches the foreign key value.
- *SETNULL
- Record deletion in a parent file updates those records in the dependent file where the value of the parent non-null key matches the foreign key value. For those dependent records that meet the preceding criteria, all null-capable fields in the foreign key are set to null. Foreign key fields with the non-null attribute are not updated.
- *SETDFT
- Record deletion in a parent file updates those records in the dependent file where the value of the parent non-null key matches the foreign key value. For those dependent records that meet the preceding criteria, the foreign key field or fields are set to their corresponding default values.
- *RESTRICT
- Record deletion in a parent file will not occur if the parent key value has a matching foreign key value.
The system enforces a delete *RESTRICT rule immediately when the deletion is attempted. The system enforces other constraints at the logical end of the operation. The operation, in the case of other constraints, includes any trigger programs that are run before or after the delete operation. It is possible for a trigger program to correct a potential referential integrity violation. For example, a trigger program can add a parent record if one does not exist. The *RESTRICT rule does not prevent the violation.
Parent topic:
Specifying referential constraint rules