7.6.15. CLOSE
Used for
Closing a declared cursor
Available in
PSQL
Syntax
CLOSE cursorname
Argument | Description |
---|---|
cursorname | Cursor name. A cursor with this name must be previously declared with a |
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.
Example
Using the CLOSE
statement:
SET TERM ^;
CREATE OR ALTER PROCEDURE GET_RELATIONS_NAMES
RETURNS (
RNAME CHAR(31)
)
AS
DECLARE C CURSOR FOR (
SELECT RDB$RELATION_NAME
FROM RDB$RELATIONS);
BEGIN
OPEN C;
WHILE (1 = 1) DO
BEGIN
FETCH C INTO :RNAME;
IF (ROW_COUNT = 0) THEN
LEAVE;
SUSPEND;
END
CLOSE C;
END^
See also