MySQL: When are Referential Actions (ON DELETE; ON UPDATE) executed?

119 Views Asked by At

I'm trying to act on a cascaded delete.

So if a row in parent Table "A" is deleted, all related child-rows in Table "B" should also be deleted AND when a row in "B" is deleted there should be an update on some other tables. (The constraints and ON DELETE CASCADE do work as expected.)

Because triggers aren't executed on referential actions, I tried to trigger the delete of the child-records. (BEFORE DELETE ON 'A' ... DELETE FROM 'B' WHERE ...) ... without success.

Why? And therefore: When are Referential Actions executed and is there a way to act before ON DELETE?

And: How is it possible to act on a cascaded or "trigger-triggered" UPDATE/DELETE.

I didn't find anything about that in the MySQL-Docs.

thx in advance

0

There are 0 best solutions below