Enforcement of delete rules
When you delete a record from a parent file, the system checks the dependent file for any dependent records (matching non-null foreign key values). If the system finds any dependent records, the delete rule determines the action to be taken.
- No Action. If the system finds any dependent records, it returns a constraint violation and does not delete records.
- Cascade. The system deletes dependent records that its finds in the dependent file.
- Set Null. The system sets null-capable fields in the foreign key to null in every dependent record that it finds.
- Set Default. The system sets all fields of the foreign key to their default value when it deletes the matching parent key.
- Restrict. Same as no action except that enforcement is immediate.
If part of the delete rule enforcement fails, the entire delete operation fails and all associated changes are rolled back. For example, a delete cascade rule causes the database to delete ten dependent records, but a system failure occurs while deleting the last record. The database will not allow deletion of the parent key record, and the deleted dependent records are re-inserted.
If a referential constraint enforcement causes a change to a record, the associated journal entry will have an indicator value noting that a referential constraint caused the record change. For example, a dependent record that is deleted by a delete cascade rule will have a journal entry indicator which indicates that the record change was generated during referential constraint enforcement.
Parent topic:
Parent key enforcement