Help Center > > Developer Guide> Stored Procedures> Cursors> Implicit Cursor

Implicit Cursor

Updated at: Mar 13, 2020 GMT+08:00

Implicit cursors are automatically set by the system for non-query statements such as modify or delete operations, along with their workspace. Implicit cursors are named SQL, which is defined by the system.


Implicit cursor operations, such as definition, open, value-grant, and close operations, are automatically performed by the system and do not need users to process. Users can use only attributes related to implicit cursors to complete operations. In workspace of implicit cursors, the data of the latest SQL statement is stored and is not related to explicit cursors defined by users.

Format call: SQL%

INSERT, UPDATE, DELETE, and SELECT statements do not need defined cursors.


An implicit cursor has the following attributes:

  • SQL%FOUND attribute: returns TRUE if the last fetch returns a row.
  • SQL%NOTFOUND attribute: works opposite to the %FOUND attribute.
  • SQL%ROWCOUNT attribute: returns the number of records fetched from the cursor.
  • SQL%ISOPEN attribute: always takes FALSE. Close implicit cursors immediately after an SQL statement is run.


-- Delete all employees in a department from the EMP table. If the department has no member, delete the department from the DEPT table.
CREATE TABLE hr.staffs_t1AS TABLE hr.staffs;
CREATE TABLE hr.sections_t1AS TABLE hr.sections;

    V_DEPTNO NUMBER(4) := 100;
        DELETE FROM hr.staffs WHERE section_ID = V_DEPTNO;
        -- Proceed based on cursor status:
        DELETE FROM hr.sections_t1 WHERE section_ID = V_DEPTNO;
        END IF;

CALL proc_cursor3();

-- Delete the stored procedure and the temporary table:
DROP PROCEDURE proc_cursor3;
DROP TABLE hr.staffs_t1;
DROP TABLE hr.sections_t1;

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?

Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel