CLOSE

Function

The CLOSE statement closes a cursor.

Invocation

Embedded Mode P

Dynamic Mode

Interactive Mode

 

Syntax



close_statement.bmp
 

 

cursor_identifier

A valid cursor identifier which identifies the cursor to be closed.

host_variable_specification

A valid single host variable specification. It must have been 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.

Adabas SQL Gateway 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.

 

Example

The following example closes cursor1.

 

CLOSE cursor1;