Return codes from a DB2 for i CLI application

Possible return codes for DB2® for i call level interface (CLI) functions include SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA_FOUND, SQL_ERROR, and SQL_INVALID_HANDLE.

Each function description in DB2 for i CLI functions lists the possible codes returned for each function.
Table 1. DB2 for i CLI function return codes
Return code Value Explanation
SQL_SUCCESS 0 The function is completed successfully, no additional SQLSTATE information available.
SQL_SUCCESS_WITH_INFO 1 The function is completed successfully, with a warning or other information. Call SQLError() to receive the SQLSTATE and any other error information. The SQLSTATE has a class of 01.
SQL_NO_DATA_FOUND 100 The function returned successfully, but no relevant data is found.
SQL_ERROR -1 The function fails. Call SQLError() to receive the SQLSTATE and any other error information.
SQL_INVALID_HANDLE -2 The function fails because an input handle is not valid (environment, connection or statement handle).
SQL_NEED_DATA 99 The application tries to run an SQL statement, but DB2 for i CLI lacks parameter data that the application indicates will be passed at run time.