OPEN_CURSOR procedure - Open a cursor

The OPEN_CURSOR procedure creates a new cursor.

A cursor must be used to parse and execute any dynamic SQL statement. Once a cursor has been opened, it can be used again with the same or different SQL statements. The cursor does not have to be closed and reopened in order to be used again.

Syntax

Read syntax diagramSkip visual syntax diagramDBMS_SQL.OPEN_CURSOR( c)

Parameters

c
An output argument of type INTEGER that specifies the cursor ID of the newly created cursor.

Authorization

EXECUTE privilege on the DBMS_SQL module.

Usage notes

This procedure can be invoked using function invocation syntax in a PL/SQL assignment statement.

Examples

Example 1: The following example creates a new cursor:
DECLARE
    curid           INTEGER;
BEGIN
    curid := DBMS_SQL.OPEN_CURSOR;
            .
            .
            .
END;