SQLCloseCursor - Close cursor statement

SQLCloseCursor() closes the open cursor on a statement handle.

Syntax

SQLRETURN SQLCloseCursor (SQLHSTMT     hstmt);

Function arguments

Table 1. SQLCloseCursor arguments
Data type Argument Use Description
SQLHSTMT hstmt Input Statement handle

Usage

Calling SQLCloseCursor() closes any cursor associated with the statement handle and discards any pending results. If no open cursor is associated with the statement handle, the function has no effect.

If the statement handle references a stored procedure that has multiple result sets, the SQLCloseCursor() closes only the current result set. Any additional result sets remain open and usable.

Return codes

  • SQL_SUCCESS
  • SQL_INVALID_HANDLE
  • SQL_ERROR

Diagnostics

Table 2. SQLCloseCursor SQLSTATEs
SQLSTATE Description Explanation
08003 * Connection not open The connection for hstmt is not established.
HY009 * Argument value that is not valid hstmt is not a statement handle.
HY021 Internal descriptor that is not valid The internal descriptor cannot be addressed or allocated, or it contains a value that is not valid.