SQLSTATE Values

OpenESQL statements return SQLSTATE values as defined by the X/Open and SQL Access Group SQL CAE specification (1992). SQLSTATE is a five character field that can be declared independently by an application, but which is also present in SQLCA, if declared. The table below lists SQLSTATE values that can be returned by OpenESQL statements.

The value returned in SQLSTATE consists of a two character class value followed by a three character subclass value. A class value of "01" indicates a warning and is accompanied by a SQLCODE of 1. Class values other than "01", except for the class "IM", indicate an error and are accompanied by a SQLCODE of -10000. The class "IM" is specific to warnings and errors that derive from the implementation of ODBC itself. The subclass value "000" in any class is for implementation defined conditions within the given class. The assignment of class and subclass values is defined by ANSI SQL-92.

Note:

Although successful execution of a function is normally indicated by a SQLCODE of 0, the SQLSTATE 00000 also indicates success.

SQLSTATE Error
01000 General warning
01002 Disconnect error
01004 Data truncated
01006 Privilege not revoked
01S00 Invalid connection string attribute
01S01 Error in row
01S02 Option value changed
01S03 No rows updated or deleted
01S04 More than one row updated or deleted
01S05 Cancel treated as SQLFreeStmt with the SQL_CLOSE option
01S06 Attempt to fetch before the result set returned the first rowset
   
07001 Wrong number of parameters
07006 Restricted data type attribute violation
07S01 Invalid use of default parameter
   
08001 Unable to connect to data source
08002 Connection in use
08003 Connection not open
08004 Data source rejected establishment of connection
08007 Connection failure during transaction
08S01 Communication link failure
   
21S01 Insert value list does not match column list
21S02 Degree of derived table does not match column list
   
22001 String data right truncation
22002 Indicator variable required but not supplied
22003 Numeric value out of range
22005 Error in assignment
22008 Datetime field overflow
22012 Division by zero
22026 String data, length mismatch