Is an UPDATE still executed if a BEFORE trigger creates an error?
Question
If no, is there any way to cancel the UPDATE from out of the trigger?
Solution
EDIT: If a BEFORE trigger fails then the UPDATE is canceled.
My previous stupid answer was referring to AFTER triggers. here it is just in case anybody still needs it: In case of AFTER trigger then the UPDATE is not canceled if a trigger fails. For "canceling" an UPDATE one has to use transactions and then ROLLBACK the transaction in case of error or commit the transaction in case of success. more info about transactions in MySQL can be found at: http://dev.mysql.com/doc/refman/5.0/en/commit.html
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow