Use the OPEN statement to open a local cursor.
<cursor_name> ::= <identifier>
Name of a local cursor
The OPEN statement opens a local cursor. Opening a
cursor means that the associated query is executed and the that the
result set is kept available for subsequent processing by the FETCH
statement. The cursor must have been declared in the declarations
section of the PSQL program.
Attempts to open a cursor that is already open, or
attempts to open a named FOR SELECT cursor will fail and generate a
run-time exception. All cursors which were not explicitly closed will
be closed automatically on exit from the current PSQL program.
The following PSQL program opens a cursor, fetches
a single row and then closes the cursor:
DECLARE RNAME CHAR(31);
(SELECT RDB$RELATION_NAME FROM
C INTO :RNAME;
CLOSE statement, FETCH statement.