The SQLCODE variable
The SQLCODE variable is an int4 that indicates whether the SQL statement succeeded or failed.
The Informix® ESQL/C header file, sqlca.h, declares SQLCODE as a global variable. Since the Informix® ESQL/C preprocessor automatically includes sqlca.h in the Informix® ESQL/C program, you do not need to declare SQLCODE.
When the database server executes an SQL statement, the
database server automatically updates the SQLCODE variable
as follows:
- The database server stores the exception value in the sqlcode field of the sqlca structure.
- Informix® ESQL/C copies the value of sqlca.sqlcode to the global SQLCODE variable.
Tip: For readability and brevity, use SQLCODE in
your Informix®
ESQL/C program
in place of sqlca.sqlcode.
The SQLCODE value can indicate the following types
of exceptions:
- SQLCODE = 0
- Success
- SQLCODE = 100
- NOT FOUND condition
- SQLCODE < 0
- Runtime error
For a description of an error message, use the finderr utility.