Function return codes

Every ODBC function returns a return code that indicates whether the function invocation succeeded or failed.

The following table lists all possible return codes for DB2® ODBC functions.

Table 1. DB2 ODBC function return codes
Return code Explanation
SQL_SUCCESS The function completed successfully, no additional SQLSTATE information is available.
SQL_SUCCESS_WITH_INFO The function completed successfully, with a warning or other information. Call SQLGetDiagRec() to receive the SQLSTATE and any other informational messages or warnings. The SQLSTATE class is '01'.
SQL_NO_DATA_FOUND The function returned successfully, but no relevant data was found. When this is returned after the execution of an SQL statement, additional information might be available which can be obtained by calling SQLGetDiagRec().
SQL_NEED_DATA The application tried to execute an SQL statement but DB2 ODBC lacks parameter data that the application had indicated would be passed at execute time..
SQL_ERROR The function failed. Call SQLGetDiagRec() to receive the SQLSTATE and any other error information.
SQL_INVALID_HANDLE The function failed due to an invalid input handle (environment, connection, or statement handle). This is a programming error. No further information is available.