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 22.214.171.124, “DECLARE ... CONDITION Syntax”, and
Section 126.96.36.199, “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.