Success in SQLSTATE

When the database server executes an SQL statement successfully, it sets SQLSTATE to "00000" (class = "00", subclass = "000"). To check for successful execution, your code needs to verify only the first two characters of SQLSTATE.
Tip: After a CONNECT, SET CONNECTION, DATABASE, CREATE DATABASE, or START DATABASE statement, the SQLSTATE variable has a class value of "01" and a subclass value, which is specific to HCL OneDB™, to provide information about the database and connection. For more information, see SQL statements that set a warning specific to HCL OneDB for a given condition.

The getdiag sample program in Guide to the getdiag.ec file uses the sqlstate_err() function to compare the first two characters of SQLSTATE with the string "00" to check for successful execution of an SQL statement. The sqlstate_exception() function shown in Example of an exception-handling function that uses SQLSTATE checks for a success in SQLSTATE with the system strncmp() function.