Opens a database cursor c in a
database table or
view for a SELECT
statement. The variable c must be of the type CURSOR. You can use
any SELECT statement that returns a table, but not a single record,
as a result. When the cursor has been opened, the dataset specified
with SELECT can be read with FETCH
until the cursor is closed.
OPEN CURSOR belongs to the Open SQL command set.
If you attempt to open a cursor that has already been opened, you get a runtime error.
The following events close a cursor:
Open the database cursor C1 in the database table SFLIGHT for the SELECT statement
TABLES SFLIGHT. DATA C1 TYPE CURSOR. OPEN CURSOR C1 FOR SELECT * FROM SFLIGHT WHERE CARRID = 'LH '.
In the above example, the OPEN statement contains no INTO clause. With cursor processing, you must always specify the target area for the selected data in the FETCH statement.
SELECT, FETCH and CLOSE.