SQLSTATE and SQLCODE status codes are returned to indicate either that an SQL statement completed successfully or that an exception condition was raised during execution of an SQL statement.

The ANSI SQL-92 SQLSTATE variable is a five-character string with a two-character class code followed by a three-character subclass code. An SQLSTATE value of 00000 indicates successful completion.

NonStop SQL/MX extends the ANSI SQL-92 SQLSTATE values to include other situations not described by the ANSI values. If an ANSI SQL-92 SQLSTATE value exists for an error condition, NonStop SQL/MX returns that value. Otherwise, NonStop SQL/MX returns an SQLSTATE value that is defined by NonStop SQL/MX.

NonStop SQL/MX also returns a numeric SQLCODE value after SQL statement execution. SQLCODE values with negative numbers signify errors. SQLCODE values with positive numbers other than 0 (successful completion) or 100 (no data was found) signify warning messages. NonStop SQL/MX identifies all messages by their unsigned SQLCODE value and their calculated SQLSTATE value. The SQLCODE is used to calculate the SQLSTATE value for all SQL/MX messages other than those for which an ANSI SQL-92 SQLSTATE value exists.

The SQLCODE parameter is a deprecated feature that is supported to maintain compatibility with earlier versions of the American standard.

SQLSTATE values identifies the equivalent SQLSTATE and SQLCODE values for SQL/MX warning and error messages.