OPEN_CURSOR v17
The OPEN_CURSOR
function creates a cursor. A cursor must be used to parse and execute any dynamic SQL statement. Once a cursor is open, you can reuse it with the same or different SQL statements. You don't have to close the cursor and reopen it to reuse it.
<c> INTEGER OPEN_CURSOR
Parameters
c
Cursor ID number associated with the newly created cursor.
Examples
This example creates a new cursor:
DECLARE curid NUMBER; v_sql VARCHAR2(150); v_status INTEGER; BEGIN v_sql:='INSERT INTO dept VALUES (50,''HR'',''LOS ANGELES'')'; curid := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(curid,v_sql,DBMS_SQL.native); v_status := DBMS_SQL.EXECUTE(curid); DBMS_OUTPUT.PUT_LINE('Number of rows processed: ' || v_status); DBMS_SQL.CLOSE_CURSOR(curid); END;
- On this page
- Parameters
- Examples