Repeats a statement for each parent-to-child reference in the current table fulfilling a condition.
.FOREACH_CHILD ("condition")
"statement"
.ENDFOR
Condition |
Selects |
---|---|
UPDATE RESTRICT |
Restrict on update |
UPDATE CASCADE |
Cascade on update |
UPDATE SETNULL |
Set null on update |
UPDATE SETDEFAULT |
Set default on update |
DELETE RESTRICT |
Restrict on delete |
DELETE CASCADE |
Cascade on delete |
DELETE SETNULL |
Set null on delete |
DELETE SETDEFAULT |
Set default on delete |
In a trigger for the table TITLE, the following macro:
.FOREACH_CHILD("DELETE RESTRICT") -- Cannot delete parent "%PARENT%" if children still exist in "%CHILD%" .ENDFOR
generates the following trigger script:
-- Cannot delete parent "TITLE" if children still exist in "ROYSCHED" -- Cannot delete parent "TITLE" if children still exist in "SALE" -- Cannot delete parent "TITLE" if children still exist in "TITLEAUTHOR"