Including SQLSTATE and SQLCODE host variables in embedded SQL applications
You can review error
information that is returned in the SQLCODE and SQLSTATE fields of
the SQLCA structure. The SQLCA structure is updated after every executable
SQL statement and most database manager API calls.
Before you begin
If your application is compliant with the FIPS 127-2 standard, you can declare host variables named SQLSTATE and SQLCODE instead of explicitly declaring the SQLCA structure in embedded SQL applications.
- The PREP option LANGLEVEL SQL92E needs to be specified
About this task
In the following example, the application checks the SQLCODE
field
of the SQLCA
structure to determine whether the
update was successful.
Language | Sample Source Code |
---|---|
C and C++ |
|
COBOL |
|
FORTRAN |
|