Handling SQL error codes
Application programs can request more information about SQL error codes from Db2.
About this task
The SQLCODE value is set by Db2 after each statement is executed, as shown in the following table.
SQLCODE value | Meaning | SQLCODE descriptions |
---|---|---|
SQLCODE = 0 | Successful execution, if SQLWARN0 is blank. If SQLWARN0 = 'W', successful execution with warning. |
000 |
SQLCODE = 100 | No data was found. For example, a FETCH statement returned no data because the cursor was positioned after the last row of the result table. | +100 |
SQLCODE > 0 and not = 100 | Successful execution with a warning. | +sqlcode-num |
SQLCODE < 0 | Execution was not successful. | -sqlcode-num |
For PDF format descriptions of the SQL codes that Db2 12 might issue, see Codes.
Procedure
To handle SQL error codes from host-language application programs, take action based on the programming language that you use, as described in the following topics.