CLOSE
Go Up to Statement and Function Reference (Language Reference Guide)
Closes an open cursor. Available in gpre.
CLOSE <cursor>;
| Argument | Description |
|---|---|
|
<cursor> |
Name of an open cursor |
Description: CLOSE terminates the specified cursor, releasing the rows in its active set and any associated system resources. A cursor is a one-way pointer into the ordered set of rows retrieved by the select expression in the DECLARE CURSOR statement. A cursor enables sequential access to retrieved rows in turn and update in place.
There are four related cursor statements:
| Stage | Statement | Purpose |
|---|---|---|
|
1 |
|
Declares the cursor; the |
|
2 |
|
Retrieves the rows specified for retrieval with |
|
3 |
|
Retrieves the current row from the active set, starting with the first row; subsequent |
|
4 |
|
Closes the cursor and releases system resources. |
FETCH statements cannot be issued against a closed cursor. Until a cursor is closed and reopened, InterBase does not reevaluate values passed to the search conditions. Another user can commit changes to the database while a cursor is open, making the active set different the next time that cursor is reopened.
- Note: In addition to CLOSE, COMMIT and ROLLBACK automatically close all cursors in a transaction.
Example: The following embedded SQL statement closes a cursor:
EXEC SQL CLOSE BC;