CLOSE frees the resources associated with an open cursor. After the cursor is closed, no subsequent operations are allowed on it. A cursor should be closed when it is no longer needed.
An implicit close is executed for every open cursor when a transaction is terminated by COMMIT or ROLLBACK.
Close a cursor:
CREATE TABLE POINT_TBL2(f1 point);
INSERT INTO POINT_TBL2(f1) VALUES ('(0.0,0.0)');
INSERT INTO POINT_TBL2(f1) VALUES ('(-10.0,0.0)');
INSERT INTO POINT_TBL2(f1) VALUES ('(-3.0,4.0)');
INSERT INTO POINT_TBL2(f1) VALUES ('(5.1, 34.5)');
INSERT INTO POINT_TBL2(f1) VALUES ('(-5.0,-12.0)');
INSERT INTO POINT_TBL2(f1) VALUES ('(7.0,-3.0)');
BEGIN WORK;
/* DECLARE the CURSOR */
DECLARE cursor1 CURSOR FOR SELECT * FROM POINT_TBL2;
/* FETCH IN CURSOR */
FETCH FORWARD 3 IN cursor1;
MOVE BACKWARD 5 IN cursor1;
/* CLOSE the CURSOR */
CLOSE cursor1;
COMMIT WORK;
|