需求:查询并输出部门名称为SALES的员工信息
1 SET serveroutput ON; 2 DECLARE 3 CURSOR c_emp(paramName VARCHAR2) IS 4 SELECT * FROM emp WHERE deptno = (select deptno from dept where dname = paramName); 5 BEGIN 6 FOR e IN c_emp('SALES')loop 7 dbms_output.put_line(e.empno||' '||e.ename||' '||e.job||' '||e.mgr||' '||e.hiredate||' '||e.sal||' '||e.comm||' '||e.deptno); 8 end loop; 9 END; 10 /