Closing a declared cursor
Available in
PSQL
A CLOSE
statement closes an open cursor. Any cursors that are still open will be automatically closed after the module code completes execution. Only a cursor that was declared with DECLARE CURSOR
can be closed with a CLOSE
statement.
Using the CLOSE
statement:
SET TERM ^;
RETURNS (
RNAME CHAR(31)
)
DECLARE C CURSOR FOR (
SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS);
BEGIN
OPEN C;
WHILE (1 = 1) DO
FETCH C INTO :RNAME;
IF (ROW_COUNT = 0) THEN
LEAVE;
SUSPEND;
END
CLOSE C;
See also
, OPEN
,