The SQLSTATE Variable
The SQLSTATE variable provides the application, in a standardized way, with return code information about the most recently executed SQL statement.
SQLSTATE must be declared between the BEGIN DECLARE SECTION and the END DECLARE SECTION (i.e. in the SQL declare section), as a 5 character long string (excluding any terminating null byte).
The return codes provided by SQLSTATE can contain digits and capital letters.
SQLSTATE consists of two fields. The first two characters of SQLSTATE indicates a class, and the following three characters indicates a subclass. Class codes are unique, but subclass codes are not. The meaning of a subclass code depends on the associated class code.
To determine the category of the result of an SQL statement, the application can test the class of SQLSTATE according to the following:
00 Success 01 Success with warning 02 No data Other Error
For a list of SQLSTATE values, see Return Codes.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40