SQLNextResult - Process the next result set

 

SQLNextResult() determines whether there is more information available on the statement handle that has been associated with a stored procedure that is returning result sets.

 

Syntax

SQLRETURN   SQLNextResult   (SQLHSTMT          StatementHandle,
                             SQLHSTMT          NextResultHandle);

 

Function arguments

Table 1. SQLNextResult arguments
Data type Argument Use Description
SQLHSTMT StatementHandle Input Statement handle.
SQLHSTMT NextResultHandle Input Statement handle for next result set.

 

Usage

This function is used to associate the next result set from StatementHandle with NextResultHandle. This differs from SQLMoreResults() because it allows both statement handles to process their result sets simultaneously.

If all the result sets have been processed, SQLNextResult() returns SQL_NO_DATA_FOUND.

If SQLFreeStmt() is called with the SQL_CLOSE or SQL_DROP option, all pending result sets on this statement handle are discarded.

 

Return codes

 

Error conditions

Table 2. SQLNextResult SQLSTATEs
SQLSTATE Description Explanation
40003 08S01 Communication link failure The communication link between the application and data source fails before the function is completed.
58004 Unexpected system failure Unrecoverable system error.
HY001 Memory allocation failure DB2® UDB CLI is unable to allocate memory required to support the processing or completion of the function.
HY010 Function sequence error The function is called while in a data-at-processing (SQLParamData(), SQLPutData()) operation.
HY013 Unexpected memory handling error DB2 UDB CLI is unable to access memory required to support the processing or completion of the function.
HY021 Internal descriptor that is not valid The internal descriptor cannot be addressed or allocated, or it contains a value that is not valid.
HYT00 Timeout expired  

 

References

SQLMoreResults - Determine whether there are more result sets

 

Parent topic:

DB2 UDB CLI functions