FREE (result set cursor)
Releases SQL cursor resources allocated by the DECLARE
instruction.
Syntax
FREE cid
- cid is the identifier of the database cursor.
Usage
The FREE
instruction
takes the name of a cursor as parameter.
All resources allocated to the database cursor are released.
If not done,
the cursor is automatically closed when doing a FREE
.
When cursor resources are released with FREE
,
the cursor must be declared again before usage.
Free the cursor when the result set is no longer used by the program; this saves resources on the database client and database server side.
Example
MAIN
DEFINE i, j INTEGER
DATABASE stores
FOR i=1 TO 10
DECLARE c1 CURSOR FOR SELECT * FROM customer
FOR j=1 TO 10
OPEN c1
FETCH c1
CLOSE c1
END FOR
FREE c1
END FOR
END MAIN