Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.6Mb
PDF (A4) - 35.6Mb
PDF (RPM) - 34.7Mb
EPUB - 8.7Mb
HTML Download (TGZ) - 8.5Mb
HTML Download (Zip) - 8.5Mb
HTML Download (RPM) - 7.3Mb
Eclipse Doc Plugin (TGZ) - 9.4Mb
Eclipse Doc Plugin (Zip) - 11.5Mb
Man Pages (TGZ) - 203.5Kb
Man Pages (Zip) - 310.2Kb
Info (Gzip) - 3.3Mb
Info (Zip) - 3.3Mb
Excerpts from this Manual

14.6.7 Condition Handling

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 14.6.7.1, “DECLARE ... CONDITION Syntax”, and Section 14.6.7.2, “DECLARE ... HANDLER Syntax”. For information about how the server chooses handlers when a condition occurs, see Section 14.6.7.6, “Scope Rules for Handlers”.

To raise a condition, use the SIGNAL statement. To modify condition information within a condition handler, use RESIGNAL. See Section 14.6.7.1, “DECLARE ... CONDITION Syntax”, and Section 14.6.7.2, “DECLARE ... HANDLER Syntax”.

To retrieve information from the diagnostics area, use the GET DIAGNOSTICS statement (see Section 14.6.7.3, “GET DIAGNOSTICS Syntax”). For information about the diagnostics area, see Section 14.6.7.7, “The MySQL Diagnostics Area”.


User Comments
Sign Up Login You must be logged in to post a comment.