Skip to main content
Version: 1.0.16

CLOSE

CLOSE — Close a cursor

Synopsis

CLOSE { name | ALL }

Description

CLOSE releases the resources associated with an open cursor. After a cursor is closed, no further operations are allowed on it. A cursor should be closed when it is no longer needed.

When a transaction is terminated by COMMIT or ROLLBACK, every non-holdable open cursor is implicitly closed. When the transaction that created a holdable cursor is aborted by ROLLBACK, the holdable cursor is implicitly closed.

If the creating transaction successfully commits, a holdable cursor remains open until an explicit CLOSE is executed or the client connection is disconnected.

Parameters

name

The name of an open cursor to close.

ALL

Close all open cursors.

Notes

In Halo, cursors can be declared using the DECLARE statement.

All available cursors can be viewed by querying the pg_cursors system view.

If a cursor is closed after a savepoint and the transaction is later rolled back to that savepoint, the CLOSE is not rolled back; that is, the cursor remains closed after the rollback.

Examples

Close cursor liahona:

CLOSE liahona;

See Also

DECLARE, FETCH, MOVE