CLOSE

Closes a cursor.

close.png

 

Usage

Embedded/Module/Procedural.

Description

The current state of the named cursor is closed.

If any states of the cursor have been saved on a stack by successive OPEN statements, see OPEN, the most recently saved cursor state is restored. Information about whether there are cursor states remaining on the stack is returned as diagnostic information. Otherwise the cursor is closed (deactivated), and may not be used until it has been re-opened with a new OPEN statement.

If the optional keyword RELEASE is used, all resources allocated to the cursor including any stacked references are destroyed. The cursor must be re-prepared (in dynamic SQL) and reopened before it can be used again.

See ALLOCATE CURSOR for a description of extended-cursor-name.

Restrictions

In a procedural usage context, a cursor cannot be specified by extended-cursor-name.

Notes

For the statement to be valid, the cursor in question must be open.

Example

DECLARE c_1 CURSOR FOR SELECT product, producer, format,

                             …

OPEN c_1;

CLOSE c_1;

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Core

Fully compliant.

 

Mimer SQL extension

The keyword RELEASE is a Mimer SQL extension.