Syntax:
DECLARE condition_name CONDITION FOR condition_value

condition_value:
    SQLSTATE [VALUE] sqlstate_value
  | mysql_error_code

This statement specifies conditions that need specific handling. It
associates a name with a specified error condition. The name can
subsequently be used in a DECLARE HANDLER statement. See [HELP DECLARE
HANDLER].

A condition_value can be an SQLSTATE value or a MySQL error code. For a
list of SQLSTATE and error values, see
http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html.

URL: http://dev.mysql.com/doc/refman/5.0/en/declare-conditions.html

