## Signal Condition Information Items 

The following table lists the names of diagnostics area condition information items that can be set in a SIGNAL  (or RESIGNAL ) statement. All items are standard SQL except MYSQL_ERRNO , which is a MySQL extension. For more information about these items see Section 13.6.7.7, “The MySQL Diagnostics Area” . 

Item Name Definition --------- ---------- CLASS_ORIGIN VARCHAR(64) SUBCLASS_ORIGIN VARCHAR(64) CONSTRAINT_CATALOG VARCHAR(64) CONSTRAINT_SCHEMA VARCHAR(64) CONSTRAINT_NAME VARCHAR(64) CATALOG_NAME VARCHAR(64) SCHEMA_NAME VARCHAR(64) TABLE_NAME VARCHAR(64) COLUMN_NAME VARCHAR(64) CURSOR_NAME VARCHAR(64) MESSAGE_TEXT VARCHAR(128) MYSQL_ERRNO SMALLINT UNSIGNED 

The character set for character items is UTF-8. 

It is illegal to assign NULL  to a condition information item in a SIGNAL  statement. 

A SIGNAL  statement always specifies an SQLSTATE  value, either directly, or indirectly by referring to a named condition defined with an SQLSTATE  value. The first two characters of an SQLSTATE  value are its class, and the class determines the default value for the condition information items: 

•Class = ’00’  (success) 

Illegal. SQLSTATE  values that begin with ’00’  indicate success and are not valid for SIGNAL . 

•Class = ’01’  (warning) 

MESSAGE_TEXT = ’Unhandled user-defined warning condition’; MYSQL_ERRNO = ER_SIGNAL_WARN 

•Class = ’02’  (not found) 

MESSAGE_TEXT = ’Unhandled user-defined not found condition’; MYSQL_ERRNO = ER_SIGNAL_NOT_FOUND 

•Class > ’02’  (exception) 

MESSAGE_TEXT = ’Unhandled user-defined exception condition’; MYSQL_ERRNO = ER_SIGNAL_EXCEPTION 

For legal classes, the other condition information items are set as follows: 

CLASS_ORIGIN = SUBCLASS_ORIGIN = ’’; CONSTRAINT_CATALOG = CONSTRAINT_SCHEMA = CONSTRAINT_NAME = ’’; CATALOG_NAME = SCHEMA_NAME = TABLE_NAME = COLUMN_NAME = ’’; CURSOR_NAME = ’’; 

The error values that are accessible after SIGNAL  executes are the SQLSTATE  value raised by the SIGNAL statement and the MESSAGE_TEXT  and MYSQL_ERRNO  items. These values are available from the C API: 

• mysql_sqlstate()  returns the SQLSTATE  value. 

• mysql_errno()  returns the MYSQL_ERRNO  value. 

