Display the employee information dept wise.
DECLARE
CURSOR C1(NO NUMBER) IS SELECT *FROM EMP WHERE DEPTNO=NO;
EMP_REC C1%ROWTYPE;
BEGIN
OPEN C1(10);
LOOP
FETCH C1 INTO EMP_REC;
EXIT WHEN C1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(EMP_REC.EMPNO||','||EMP_REC.ENAME);
END LOOP;
CLOSE C1;
END;
/
DECLARE
CURSOR C1(NO NUMBER) IS SELECT *FROM EMP WHERE DEPTNO=NO;
EMP_REC C1%ROWTYPE;
BEGIN
OPEN C1(10);
LOOP
FETCH C1 INTO EMP_REC;
EXIT WHEN C1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(EMP_REC.EMPNO||','||EMP_REC.ENAME);
END LOOP;
CLOSE C1;
END;
/
No comments:
Post a Comment