Tuesday, October 21, 2014

Write the Code to input the dept’s no and print the total emp’s and sum of salary with in that dept.




DECLARE
DNO NUMBER;
TOTAL NUMBER
SUM_SAL NUMBER;
BEGIN
DNO := &DEPTNO;
SELECT COUNT(*), SUM(SAL) INTO TOTAL, SUM_SAL FROM EMP WHERE DPETNO = DNO;
DBMS_OUTPUT.PUT_LINE(TOTAL);
DBMS_OUTPUT.PUT_LINE(SUM_SAL);
END;

No comments: