Conditions may arise during stored program execution that require special handling, such as exiting the current program block or continuing execution. Handlers can be defined for general conditions such as warnings or exceptions, or for specific conditions such as a particular error code. Specific conditions can be assigned names and referred to that way in handlers.
To name a condition, use the
CONDITION statement. To declare a handler, use the
HANDLER statement. See
Section 188.8.131.52, “DECLARE ... CONDITION Syntax”, and
Section 184.108.40.206, “DECLARE ... HANDLER Syntax”.
Other statements related to conditions are
GET DIAGNOSTICS. The
RESIGNAL statements are not supported until
MySQL 5.5. The
GET DIAGNOSTICS statement is not
supported until MySQL 5.6.