The SQLSTATE Variable
SQLSTATEvariable provides the application, in a standardized way, with return code information about the most recently executed SQL statement.
SQLSTATEmust be declared between the
BEGIN DECLARE SECTIONand 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
SQLSTATEcan contain digits and capital letters.
SQLSTATEconsists 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
SQLSTATEaccording to the following:
For a list of SQLSTATE values, see Return Codes.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40