Show TOC

DECLARE CURSOR Statement [T-SQL]Locate this document in the navigation structure

Declares a cursor that is compatible with SAP ASE.

Syntax
DECLARE <cursor-name>CURSOR FOR <select-statement>
   …[ FORREAD ONLY | UPDATE } ]
Usage

(back to top)

SAP IQ supports a DECLARE CURSOR syntax that is not supported in SAP ASE. For information on the full DECLARE CURSOR syntax, see DECLARE CURSOR Statement [ESQL] [SP].

Note Use the sp_iqcursorinfo system procedure to display detailed information about cursors currently open on the server.
Standards

(back to top)

  • SQL—The FOR UPDATE and FOR READ ONLY options are Transact-SQL extensions to ISO/ANSI SQL grammar.
  • SAP Database products—There are some features of the SAP ASE DECLARE CURSOR statement that are not supported in SAP IQ.
    • In the SAP IQ dialect, DECLARE CURSOR in a procedure or batch must immediately follow the BEGIN keyword. In the Transact-SQL dialect, there is no such restriction.
    • In SAP ASE, when a cursor is declared in a procedure or batch, it exists for the duration of the procedure or batch. In SAP IQ, if a cursor is declared inside a compound statement, it exists only for the duration of that compound statement (whether it is declared in an SAP IQ or Transact-SQL compound statement).
Permissions