Using SQLCODE

Table 8-1 lists the values SQLCODE can contain:

Table 8-1: SQLCODE return values

Value

Meaning

0

No warnings or errors occurred.

<0

Error occurred and the SQLCA variables contain useful information for diagnosing the error.

100

No rows returned from last statement although the statement executed successfully. This condition is useful for driving a loop that fetches rows from a cursor. When SQLCODE becomes 100, the loop and all rows that have been fetched end. This technique is illustrated in Chapter 6, “Using Transact-SQL Statements.”