Bookmark and Share
How MySQL handles errors during trigger execution?
(Publish Date: 2009-11-4 4:22pm, Total Visits: 3018, Today: 1, This Week: 2, This Month: 11)

MySQL handles errors during trigger execution as follows:

    * If a BEFORE trigger fails, the operation on the corresponding row is not performed.
    * A BEFORE trigger is activated by the attempt to insert or modify the row, regardless of whether the attempt subsequently succeeds.
    * An AFTER trigger is executed only if the BEFORE trigger (if any) and the row operation both execute successfully.
    * An error during either a BEFORE or AFTER trigger results in failure of the entire statement that caused trigger invocation.
    * For transactional tables, failure of a statement should cause rollback of all changes performed by the statement. Failure of a trigger causes the statement to fail, so trigger failure also causes rollback. For nontransactional tables, such rollback cannot be done, so although the statement fails, any changes performed prior to the point of the error remain in effect.

Please refer: