%ISOPEN returns TRUE if its explicit cursor is open; FALSE otherwise.
%ISOPEN is useful for Checking that an explicit cursor is not already open before you try to open it.
If you try to open an explicit opened cursor, PL/SQL raises the predefined exception CURSOR_ALREADY_OPEN.
You must close an explicit cursor before you can reopen it.
SQL> SQL> drop table emp; Table dropped.-- from www. j av a 2s .c om SQL> CREATE TABLE emp( 2 empid NUMBER(6), 3 first_name VARCHAR2(20), 4 last_name VARCHAR2(25), 5 email VARCHAR2(25), 6 phone_number VARCHAR2(20), 7 hire_date DATE, 8 job_id VARCHAR2(10), 9 salary NUMBER(8,2), 10 commission_pct NUMBER(2,2), 11 manager_id NUMBER(6), 12 department_id NUMBER(4)) ; SQL> SQL> INSERT INTO emp VALUES( 100, 'Steven', 'King', 'SKING', '123.123.4567', TO_DATE('17-JUN-2000', 'dd-MON-yyyy'), 'CODER', 24000, NULL, NULL, 10); SQL> INSERT INTO emp VALUES( 200, 'Joe', 'Lee', 'abc', '123.123.9999', TO_DATE('17-JUN-2010', 'dd-MON-yyyy'), 'TESTER', 25000, NULL, NULL, 20); SQL> SQL> SQL> DECLARE 2 CURSOR c1 IS 3 SELECT last_name, salary FROM emp; 4 5 the_name emp.last_name%TYPE; 6 the_salary emp.salary%TYPE; 7 BEGIN 8 IF NOT c1%ISOPEN THEN 9 OPEN c1; 10 END IF; 11 12 FETCH c1 INTO the_name, the_salary; 13 14 IF c1%ISOPEN THEN 15 CLOSE c1; 16 END IF; 17 END; 18 / PL/SQL procedure successfully completed. SQL>