Write a PL/SQL Program to display the department number, department name, location and number of employees. The department which is having more than three employees.
0
Write a PL/SQL Program to display the department number, department name, location and number of employees. The department which is having more than three employees.
SQL>DECLARE
CURSOR cs is
SELECT d.deptno,d.dname,d.loc,v.noe
FROM dept d,(SELECT deptno,count(*) noe
FROM emp
Group by deptno) v
WHERE v.noe>3 AND
d.deptno=v.deptno;
BEGIN
FOR i in cs
LOOP
display(i.deptno||’ ‘||i.dname||’ ‘||i.loc||’ ‘||i.noe);
END LOOP;
END;
CURSOR cs is
SELECT d.deptno,d.dname,d.loc,v.noe
FROM dept d,(SELECT deptno,count(*) noe
FROM emp
Group by deptno) v
WHERE v.noe>3 AND
d.deptno=v.deptno;
BEGIN
FOR i in cs
LOOP
display(i.deptno||’ ‘||i.dname||’ ‘||i.loc||’ ‘||i.noe);
END LOOP;
END;
0 comments: