This documentation is for an older version. If you're using the most current version, select the documentation for that version with the version switch in the upper right corner of the online documentation, or by downloading a newer PDF or EPUB file.

13.6.7 Condition Handling DECLARE ... CONDITION Syntax DECLARE ... HANDLER Syntax

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 DECLARE ... CONDITION statement. To declare a handler, use the DECLARE ... HANDLER statement. See Section, “DECLARE ... CONDITION Syntax”, and Section, “DECLARE ... HANDLER Syntax”.

Other statements related to conditions are SIGNAL, RESIGNAL, and GET DIAGNOSTICS. The SIGNAL and RESIGNAL statements are not supported until MySQL 5.5. The GET DIAGNOSTICS statement is not supported until MySQL 5.6.