DECLARE CURSOR Statement [T-SQL]

Declares a cursor that is compatible with Adaptive Server Enterprise.

Syntax

DECLARE cursor-nameCURSOR FOR select-statement
…[ FORREAD ONLY | UPDATE } ]

Usage

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

See also Reference: Building Blocks, Tables, and Procedures > System Procedures > System Stored Procedures > sp_iqcursorinfo Procedure.

Standards

  • SQL—The FOR UPDATE and FOR READ ONLY options are Transact-SQL extensions to ISO/ANSI SQL grammar.

  • Sybase—There are some features of the Adaptive Server Enterprise DECLARE CURSOR statement that are not supported in Sybase IQ.

    • In the Sybase 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 Adaptive Server Enterprise, when a cursor is declared in a procedure or batch, it exists for the duration of the procedure or batch. In Sybase 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 a Sybase IQ or Transact-SQL compound statement).

Permissions

None

Related reference
DECLARE CURSOR Statement [ESQL] [SP]