Logo 
Search:

Oracle Articles

Submit Article
Home » Articles » Oracle » CursorRSS Feeds

Cursor to display employee details based on user input department number

Posted By: Volney Fischer     Category: Oracle     Views: 5581

Write a cursor to display employee details based on user input department number.

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



Volney Fischer
Volney Fischer author of Cursor to display employee details based on user input department number is from Frankfurt, Germany.
 
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!