SQL/MX 2.x Messages Manual (G06.24+, H06.03+)
HP NonStop SQL/MX Messages Manual—523730-004
20-1
20
SQLSTATE Values Returned by
NonStop SQL/MX
NonStop SQL/MX returns SQLSTATE values that are defined in the ISO/ANSI SQL
standard and implementation-defined SQLSTATE values. See Subclause 22, “Status
Codes” in the ISO/ANSI SQL92 Standard “Database Language SQL.”
SQLSTATE and SQLCODE Considerations
•
Using SQLSTATE causes performance overhead because of the representation of
SQLSTATE as five characters. The overhead is most noticeable with short SQL
statements and in error situations.
•
Mapping SQLSTATE values to SQLCODE values can result in ambiguous
SQLCODE values:
°
SQLCODE values will often not map to a unique SQLSTATE value. For
example, see the many SQLCODE values mapped to SQLSTATE 42000 in
Table 20-1, SQLSTATE Values.
°
To deal with the problem of ambiguous SQLCODE values, HP recommends
retrieving the error message text or the SQLCODE value in addition to the
SQLSTATE.
•
SQLSTATE values for some SQL/MX error and warning messages might be
subject to change:
°
In the future, NonStop SQL/MX might return different SQLSTATE values for
error conditions than it does now.
°
In the future, SQL/MX’s error handling might use a different error path, and
therefore return a slightly different SQLCODE and implementation-defined
SQLSTATE value for an error.
•
In SQLJ programs, SQLSTATE is returned, in accordance with the SQL ANSI-92
standard, by both JDBC and SQLJ. However, the SQLCODE values returned by
JDBC and SQLJ for the same error condition might not be the same.
SQLSTATE Values
See the section “Error Codes” in the SQL/MX Comparison Guide for SQL/MP Users for
information about equivalent SQLCODE and SQLSTATE values for key messages
returned by NonStop SQL/MX and NonStop SQL/MP.
Table 20-1 is a list of returned SQLSTATE values ordered by SQLSTATE. SQLSTATE
values are provided for both warning messages (positive SQLCODE numbers) and
error messages (negative SQLCODE numbers).