RESIGNAL
Syntax
RESIGNAL
passes on the error condition information that is available during execution of a condition handler within a compound statement inside a stored procedure or function, trigger, or event. RESIGNAL
may change some or all information before passing it on.
RESIGNAL
makes it possible to both handle an error and return the error information. Otherwise, by executing an SQL statement within the handler, information that caused the handler's activation is destroyed. RESIGNAL
also can make some procedures shorter if a given handler can handle part of a situation, then pass the condition "up the line" to another handler.
No special privileges are required to execute the RESIGNAL
statement.
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".
Unless otherwise indicated, the definitions and rules for condition_value
and signal_information_item
are the same for the RESIGNAL
statement as for SIGNAL
(see , "SIGNAL
Syntax").
The RESIGNAL
statement takes condition_value
and SET
clauses, both of which are optional. This leads to several possible uses:
RESIGNAL
alone:RESIGNAL;
RESIGNAL
with new signal information:RESIGNAL SET
signal_information_item
[,signal_information_item
] ...;RESIGNAL
with a condition value and possibly new signal information:RESIGNAL
condition_value
[SETsignal_information_item
[,signal_information_item
] ...];
These use cases all cause changes to the diagnostics and condition areas:
- A diagnostics area contains one or more condition areas.
- A condition area contains condition information items, such as the
SQLSTATE
value,MYSQL_ERRNO
, orMESSAGE_TEXT
.
The maximum number of condition areas in a diagnostics area is determined by the value of the max_error_count
system variable. See , "Diagnostics Area-Related System Variables".