OPEN CURSOR [WITH HOLD] dbcur FOR
[[FOR ALL ENTRIES IN itab] WHERE sql_cond]
[GROUP BY group] [HAVING group_cond]
[ORDER BY sort_key].
This statement opens a database
cursor for the selection defined after
FOR, and associates a cursor variable
dbcur with this database cursor. The result set of the selection can be read with the statement
dbcur expects host
variable declared using a specific predefined data type:
cursor. The name of this host variable must be prefixed with the name
of the escape character
@. A database cursor
that has already been opened cannot be opened again. A line of the result set is always assigned to
an opened database cursor as a cursor position. After the statement
OPEN CURSOR, the database cursor is positioned in front of the first line of the result set.
FOR, the syntax of a
statement can be entered which contains all the additions of the normal
statement, except for
APPENDING. In the
result, the addition
SINGLE also cannot be used after
Only a limited number of database cursors can be open at the same time. An open database cursor can
be closed using the statement
CLOSE CURSOR. In addition, an open database cursor is closed for a
database commit or a database rollback.
If a cursor variable
dbcur of an open database cursor is assigned to another
cursor variable or passed as a parameter, the latter is associated with the same database cursor at the same position. A cursor variable of an open database cursor can also be passed to
procedures that have been called externally, to enable the database cursor to be accessed from there.
It is not recommended that cursor variables are assigned to each other and they should be set only using the statements
- If write accesses are made on a database table for which a database cursor is open, the results set is database-specific and undefined. Avoid this kind of parallel access if possible.
Host variables without the escape character
@are obsolete. The escape character
@must be specified in the strict modes of the syntax check from Release 7.40, SP05.
... WITH HOLD
If the addition
WITH HOLD is specified, the database cursor is not closed by a database commit executed using
WITH HOLD can be used only in reads performed on the standard
database. It cannot be specified together with the addition