MySQL Forums
Forum List  »  Triggers

Multiple triggers
Posted by: Ken Quad
Date: August 15, 2006 10:34AM

Hi all:

Got this syntax from a previous thread to delete "orphan" records in auxiliary tables when the parent record is removed:


DELETE un
FROM unit_notes_main AS un
LEFT JOIN units_main AS u ON u.unit_id = un.unit_id
WHERE u.unit_id IS NULL

(this deletes all notes pertinent to a given "unit", obviously).

Problem is, I need to execute 3 of these statements, 1 for notes, 1 for options, and 1 for curtailments. (Call them n, o, and c if you like). The function is the same, only I can't figure out how to do multiple triggers. If I try to create more than one "after-delete" trigger, I get "Trigger alread exists" (though the syntax of the second trigger is of course diffferent from the first). And I don't know how to concatenate the statements or execute one after the other in the same trigger. I'd appreciate any help. Thanks.

Ken Quad

Options: ReplyQuote


Subject
Views
Written By
Posted
Multiple triggers
3035
August 15, 2006 10:34AM
1854
August 15, 2006 01:14PM
2007
August 15, 2006 03:25PM
1796
August 15, 2006 03:46PM
1739
August 16, 2006 12:19PM
1759
August 16, 2006 01:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.