Logo 
Search:

Oracle Articles

Submit Article
Home » Articles » Oracle » CursorRSS Feeds

Cursor to display employees having salary greater than 1900

Posted By: Dominic Brown     Category: Oracle     Views: 4040

Write a cursor to display employees having salary greater than 1900.

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;
  
Share: 



Dominic Brown
Dominic Brown author of Cursor to display employees having salary greater than 1900 is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!