SQLSTATE value
Certain HCL®
OneDB® products,
such as ,
support the SQLSTATE value in compliance with X/Open and ANSI SQL
standards. The GET DIAGNOSTICS statement reads the SQLSTATE value
to diagnose errors after you run an SQL statement. The database server
returns a result code in a five-character string that is stored in
a variable called SQLSTATE. The SQLSTATE error code, or value, tells
you the following information about the most recently executed SQL
statement:
- If the statement was successful
- If the statement was successful but generated warnings
- If the statement was successful but generated no data
- If the statement failed
For more information on the GET DIAGNOSTICS statement, the SQLSTATE
variable, and the meaning of the SQLSTATE return codes, see the GET
DIAGNOSTICS statement in the HCL OneDB Guide to SQL:
Syntax.
Tip: If your HCL
OneDB product
supports GET DIAGNOSTICS and SQLSTATE, it is recommended that you
use them as the primary structure to detect, handle, and diagnose
errors. Using SQLSTATE allows you to detect multiple errors, and it
is ANSI compliant.