Syntax:
DECLARE handler_type HANDLER FOR condition_value[,...] statement

handler_type:
    CONTINUE
  | EXIT
  | UNDO

condition_value:
    SQLSTATE [VALUE] sqlstate_value
  | condition_name
  | SQLWARNING
  | NOT FOUND
  | SQLEXCEPTION
  | mysql_error_code

The DECLARE ... HANDLER statement specifies handlers that each may deal
with one or more conditions. If one of these conditions occurs, the
specified statement is executed. statement can be a simple statement
(for example, SET var_name = value), or it can be a compound statement
written using BEGIN and END (see [begin-end]).

For a CONTINUE handler, execution of the current routine continues
after execution of the handler statement. For an EXIT handler,
execution terminates for the BEGIN ... END compound statement in which
the handler is declared. (This is true even if the condition occurs in
an inner block.) The UNDO handler type statement is not yet supported.

If a condition occurs for which no handler has been declared, the
default action is EXIT.

A condition_value can be any of the following values:

o An SQLSTATE value or a MySQL error code.

o A condition name previously specified with DECLARE ... CONDITION. See
  [declare-conditions].

o SQLWARNING is shorthand for all SQLSTATE codes that begin with 01.

o NOT FOUND is shorthand for all SQLSTATE codes that begin with 02.

o SQLEXCEPTION is shorthand for all SQLSTATE codes not caught by
  SQLWARNING or NOT FOUND.
