CLOSE_CURSOR v14

The CLOSE_CURSOR procedure closes an open cursor. The resources allocated to the cursor are released and you can no longer use it.

CLOSE_CURSOR(<c> IN OUT NUMBER)

Parameters

c

Cursor ID of the cursor to be closed.

Examples

This example closes an open cursor:

DECLARE
    curid         NUMBER;
    v_sql         VARCHAR2(150);
    v_status      INTEGER;
BEGIN
    v_sql:='INSERT INTO emp VALUES (9001,''JONES'',''SALESMAN'',7369,TO_DATE(''13-DEC-07'',''DD-MON-YY''),8500.00,1500.00,50)';
    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;