Code for Cursor to display employee details based on user input department number in Oracle
DECLARECURSOR A ISSELECT EMP_NAME,SALARY FROM EMPLOYEE WHERE DEPTNO = &DEPTNO;
NAME EMPLOYEE.EMP_NAME%TYPE;
SAL EMPLOYEE.SALARY%TYPE;
BEGINOPEN A;
IF A%ISOPEN THEN
DBMS_OUTPUT.PUT_LINE('DESIRABLE CURSOR HAS BEEN OPENED');
LOOP
FETCH A INTO NAME,SAL;
EXITWHEN A%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(NAME||' '||SAL);
END LOOP;
ELSE
DBMS_OUTPUT.PUT_LINE('UNABLE TO OPEN THE CURSOR');
ENDIF;
END;