Cascading Triggers
The database server allows triggers other than Select triggers to cascade, meaning that the trigger actions of one trigger can activate another trigger. (For further information on the restriction against cascading Select triggers, see Circumstances When a Select Trigger Is Activated.)
Exceeded limit on maximum number of cascaded triggers.
CREATE TRIGGER del_manu DELETE ON manufact REFERENCING OLD AS pre_del FOR EACH ROW(DELETE FROM stock WHERE manu_code = pre_del.manu_code); CREATE TRIGGER del_stock DELETE ON stock REFERENCING OLD AS pre_del FOR EACH ROW(DELETE FROM items WHERE manu_code = pre_del.manu_code); CREATE TRIGGER del_items DELETE ON items REFERENCING OLD AS pre_del FOR EACH ROW(EXECUTE PROCEDURE log_order(pre_del.order_num));
When you are not using logging, referential integrity constraints on both the manufact and stock tables prohibit the triggers in this example from executing. When you use logging, however, the triggers execute successfully because constraint checking is deferred until all the trigger actions are complete, including the actions of cascading triggers. For more information about how constraints are handled when triggers execute, see Constraint Checking.
The database server prevents loops of cascading triggers by not allowing you to modify the triggering table in any cascading trigger action, except with an UPDATE statement that does not modify any column that the triggering UPDATE statement updated, or with an INSERT statement. An INSERT trigger can define UPDATE trigger actions on the same table.