Code for Cursor to display employees having salary greater than 1900 in Oracle
DECLARECURSOR A ISSELECT EMP_CODE,EMP_NAME,SALARY FROM EMPLOYEE WHERE SALARY > 1900;
CODE EMPLOYEE.EMP_CODE%TYPE;
NAME EMPLOYEE.EMP_NAME%TYPE;
SAL EMPLOYEE.SALARY%TYPE;
BEGINOPEN A;
IF A%ISOPEN THEN
DBMS_OUTPUT.PUT_LINE('CURSOR HAS BEEN OPENED');
LOOP
FETCH A INTO CODE,NAME,SAL;
EXITWHEN A%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(CODE||' '||NAME||' '||SAL);
END LOOP;
ELSE
DBMS_OUTPUT.PUT_LINE('UNABLE TO OPEN THE CURSOR');
ENDIF;
END;