DECLARE CURSOR statement [ESQL] [SP]
488
DECLARE CURSOR statement [ESQL] [SP]
Use this statement to declare a cursor. Cursors are the primary means for
manipulating the results of queries.
DECLARE
cursor-name
… [ UNIQUE
| NO SCROLL
| DYNAMIC SCROLL
| SCROLL
| INSENSITIVE
]
… CURSOR
FOR
select-or-call-statement
| FOR
statement-name
[ FOR { UPDATE | READ ONLY } ]
| USING
variable-name
cursor-name
:
identifier
statement-name
:{
identifier
|
host-variable
}
variable-name: identifier
None.
None.
"PREPARE statement" on page 578
"OPEN statement" on page 570
"EXPLAIN statement" on page 521
"SELECT statement" on page 601
"CALL statement" on page 410
The DECLARE CURSOR statement declares a cursor with the specified
name for a SELECT statement or a CALL statement.
UNIQUE cursors When a cursor is declared UNIQUE, the query is forced
to return all the columns required to uniquely identify each row. Often this
will mean ensuring that all of the columns in the primary key or a uniqueness
table constraint are returned. Any columns that are required but were not
specified will be added.
A DESCRIBE done on a UNIQUE cursor sets the following additional flags
in the indicator variables:
♦ DT_KEY_COLUMN The column is part of the key for the row
♦ DT_HIDDEN_COLUMN The column was added to the query,
because it was required to uniquely identify the rows
Function
Syntax
Permissions
Side effects
See also
Description
Parameters