declare scrollable cursor

Description

Declare a cursor for each select statement that returns rows of data. You must declare the cursor before using it, and you cannot declare it within a declare section.

Syntax

exec sql declare  cursor_name  [cursor sensitivity] 
[cursor scrollability] cursor for select_statement ;

Parameters

cursor_name

Identifies the cursor.

cursor sensitivity

Specifies the sensitivity of the cursor.

cursor scrollability

Specifies the scrollability of the cursor.

select_statement

A select statement that can return multiple rows of data. The syntax for select is the same as that shown in the Adaptive Server Enterprise Reference Manual, except that you cannot use into or compute clauses.

Examples

Example 1

EXEC SQL BEGIN DECLARE SECTION;
char    username[30];
char    password[30];
char    a_type[TITLE_STRING+1];
EXEC SQL END DECLARE SECTION;

.....

/*
** Declare an insensitive scrollable cursor against the
** titles table. Open the cursor.
*/
EXEC SQL DECLARE typelist INSENSITIVE SCROLL CURSOR FOR
SELECT DISTINCT title FROM titles;

EXEC SQL OPEN typelist;

Usage

See also

fetch scrollable cursor