PROGRAM USING CURSOR TO PRINT NAME JOB IF EMPLOYEE HAVING DESIGNATION AS MANAGER OR ANALYST
DECLARE
CURSOR C1 IS SELECT ENAME,JOB FROM EMP;
E EMP.ENAME%TYPE;
J EMP.JOB%TYPE;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO E,J;
EXIT WHEN C1%NOTFOUND;
IF J='MANAGER' OR J='ANALYST' THEN
DBMS_OUTPUT.PUT_LINE(E||' '||j);
END IF;
END LOOP;
CLOSE C1;
END;
DECLARE
CURSOR C1 IS SELECT ENAME,JOB FROM EMP;
E EMP.ENAME%TYPE;
J EMP.JOB%TYPE;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO E,J;
EXIT WHEN C1%NOTFOUND;
IF J='MANAGER' OR J='ANALYST' THEN
DBMS_OUTPUT.PUT_LINE(E||' '||j);
END IF;
END LOOP;
CLOSE C1;
END;
1 Comments:
Click here for CommentsPlease give output of code