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

To raise a condition, use the SIGNAL statement. To modify condition information within a condition handler, use RESIGNAL. See , "DECLARE ... CONDITION Syntax", and , "DECLARE ... HANDLER Syntax".

To retrieve information from diagnostics area, use the GET DIAGNOSTICS statement (see , "GET DIAGNOSTICS Syntax"). For information about the diagnostics area, see , "The MariaDB Diagnostics Area".

Retornar