CLOSE (result set cursor)

Closes a database cursor and frees resources allocated on the database server for the result set.

Syntax

CLOSE cid
  1. cid is the identifier of the database cursor.

Usage

The CLOSE instruction releases the resources allocated for the result set on the database server.

After using the CLOSE instruction, you must reopen the cursor with OPEN before retrieving values with FETCH.

It is recommended that you close the cursor when the result set is no longer used, this saves resources on the database client and database server side.

Example

MAIN
   DATABASE stores 
   DECLARE c1 CURSOR FOR SELECT * FROM customer 
   OPEN c1
   CLOSE c1
   OPEN c1
   CLOSE c1
END MAIN