WRITE A PL/SQL PROGRAM FOR DISPLAYING EMPLOYEE WORKING IN COMPUTER DEPARTMENT USING CURSOR

PROGRAM FOR DISPLAYING EMPLOYEE WORKING IN COMPUTER DEPARTMENT

DECLARE
CURSOR C1 IS SELECT ENAME,SAL,DNAME FROM EMP,DEPT WHERE EMP.DEPTNO=DEPT.DEPTNO;
E EMP.ENAME%TYPE;
S EMP.SAL%TYPE;
D DEPT.DNAME%TYPE;
BEGIN
OPEN C1;
LOOP
  FETCH C1 INTO E,S,D;
 EXIT WHEN C1%NOTFOUND;
 IF D='SCRIPT' THEN
    DBMS_OUTPUT.PUT_LINE(E ||' '|| S||' '||D);
 END IF;
END LOOP;
   CLOSE C1; 
END;
Previous
Next Post »