Return Status and Conditions
In Mimer SQL, status information is returned in the SQLSTATE variable.
This variable must be declared as a 5-character long string (excluding any terminating null byte), and the declaration of SQLSTATE must be made between BEGIN DECLARE SECTION and END DECLARE SECTION. The SQLSTATE variable together with the GET DIAGNOSTICS statement will provide the application with information about the most recently executed SQL statement.
For compatibility reasons, error codes can also be returned in SQLCODE, as in earlier versions of Mimer SQL. However, SQLCODE in Mimer SQL can be either a field in the SQLCA, or a 4-byte integer variable in the application. Mimer SQL will assume the existence of an SQLCODE variable if no INCLUDE SQLCA statement is found and neither SQLSTATE nor SQLCODE is declared between BEGIN DECLARE SECTION and END DECLARE SECTION.
There are three different types of conditions in Mimer SQL: NOT FOUND, SQLERROR and SQLWARNING (see the WHENEVER).
SQLERRORs are returned using an error code in SQLSTATE or a negative value in the SQLCODE field. This is referred to as "an error code is returned" in this manual.
SQLWARNINGs are returned by setting either a Success with warning -code in SQLSTATE, or by setting the SQLWARN fields in the SQLCA to the character W. This is referred to as "a warning flag is set" in this manual.
The NOT FOUND condition is returned by setting SQLSTATE to No data ('02000'), or by setting SQLCODE to +100. This is referred to as "a NOT FOUND condition code is returned" in this manual.
More detailed information about certain operations can be obtained by the GET DIAGNOSTICS statement described in GET DIAGNOSTICS.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40