CLOSE
Function
The CLOSE statement closes a cursor.
Invocation
Embedded Mode P Dynamic Mode Interactive Mode
Syntax
cursor_identifier | A valid cursor identifier which identifies the cursor that you want closed. |
host_variable_specification | A valid single host variable specification. It must be defined in the application program according to the host language rules. |
Description
The CLOSE statement closes a cursor. It releases resources allocated by an OPEN cursor statement. The value of the host variable must be a valid cursor identifier. A host variable can be used as cursor identifier only if the cursor is a dynamically declared cursor.
Limitations
The cursor to be closed must have been opened.
ANSI Specifics
All cursors opened within a transaction are automatically closed by a COMMIT or ROLLBACK statement. The associated DECLARE CURSOR statement must precede the CLOSE statement in the host program.
CONNX Embedded SQL Specifics
The CLOSE statement does not have to be preceded by the associated DECLARE CURSOR statement. It may appear anywhere in the host program, even in another compilation unit.
Here is an example on how to close cursor1:
CLOSE cursor1;