SQLNumResultCols--Get number of result columns

Purpose

Specification: DB2 CLI 1.1 ODBC 1.0

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 SQLColAttribute() or one of the bind column functions.

Syntax

SQLRETURN   SQLNumResultCols (SQLHSTMT          StatementHandle,   /* hstmt */
                              SQLSMALLINT  FAR  *ColumnCountPtr);  /* pccol */

Function arguments

ǥ 72. SQLNumResultCols arguments

Data type Argument Use Description
SQLHSTMT StatementHandle input Statement handle.
SQLSMALLINT * ColumnCountPtr output Number of columns in the result set.

Usage

The function sets the output argument to zero if the last statement or function executed on the input statement handle did not generate a result set.

Return codes

Diagnostics

ǥ 73. SQLNumResultCols SQLSTATEs

SQLSTATE Description Explanation
40003 08S01 Communication link failure. The communication link between the application and data source failed before the function completed.
58004 Unexpected system failure. Unrecoverable system error.
HY001 Memory allocation failure. DB2 CLI is unable to allocate memory required to support execution or completion of the function.
HY010 Function sequence error. The function is called prior to calling SQLPrepare() or SQLExecDirect() for the StatementHandle.
HY013 Unexpected memory handling error. DB2 CLI is unable to access memory required to support execution or completion of the function.

Restrictions

None.

Related reference