在PL/SQL中使用带参数的游标
时间:2021-07-01 10:21:17
帮助过:2人阅读
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 /
在PL/SQL中使用带参数的游标
标签: