%ISOPEN v16

Use the %ISOPEN attribute to test whether a cursor is open.

<cursor_name>%ISOPEN

cursor_name is the name of the cursor for which a BOOLEAN data type of TRUE is returned if the cursor is open, FALSE otherwise.

This example uses %ISOPEN:

CREATE OR REPLACE PROCEDURE cursor_example
IS
        ...
    CURSOR emp_cur_1 IS SELECT * FROM emp;
        ...
BEGIN
        ...
    IF emp_cur_1%ISOPEN THEN
        NULL;
    ELSE
        OPEN emp_cur_1;
    END IF;
    FETCH emp_cur_1 INTO ...
        ...
END;