DECLAREcondition_nameCONDITION FORcondition_valuecondition_value: SQLSTATE [VALUE]sqlstate_value|mysql_error_code
The DECLARE ... CONDITION statement defines a
named error condition. It specifies a condition that needs
specific handling and associates a name with that condition. The
name can be referred to in a subsequent DECLARE ...
HANDLER statement. For an example, see
Section 12.7.4.2, “DECLARE for Handlers”.
A condition_value for
DECLARE ... CONDITION can be an SQLSTATE
value (a 5-character string literal) or a MySQL error code (a
number). You should not use SQLSTATE value
'00000' or MySQL error code 0, because those
indicate success rather than an error condition. For a list of
SQLSTATE values and MySQL error codes, see
Section B.3, “Server Error Codes and Messages”.

User Comments
Add your own comment.