SQLNumResultCols - Get number of result columns

 

SQLNumResultCols() returns the number of columns in the result set associated with the input statement handle.

SQLPrepare() or SQLExecDirect() must be called before calling this function.

After calling this function, you can call SQLDescribeCol(), SQLColAttributes(), SQLBindCol(), or SQLGetData().

 

Syntax

SQLRETURN SQLNumResultCols (SQLHSTMT       hstmt,
                            SQLSMALLINT    *pccol);

 

Function arguments

Table 1. SQLNumResultCols arguments
Data type Argument Use Description
SQLHSTMT hstmt Input Statement handle.
SQLSMALLINT * pccol Output Number of columns in the result set.

 

Usage

The function sets the output argument to zero if the last statement processed on the input statement handle is not a SELECT.

 

Return codes

 

Diagnostics

Table 2. SQLNumResultCols SQLSTATEs
SQLSTATE Description Explanation
40003 * Statement completion unknown The communication link between the CLI and the data source fails before the function completes processing.
58004 System error Unrecoverable system error.
HY001 Memory allocation failure The driver is unable to allocate memory required to support the processing or completion of the function.
HY009 Argument value that is not valid pcbCol is a null pointer.
HY010 Function sequence error The function is called before calling SQLPrepare or SQLExecDirect for the hstmt.
S1013 * Memory management problem. The driver is unable to access memory required to support the processing or completion of the function.

 

References

 

Parent topic:

DB2 UDB CLI functions