judyW
2017-06-01 15:38
set serveroutput on
declare
cursor cemp(dno number) is select ename from emp where empno=dno;
pename emp.ename%type;
begin
open cemp(10);
LOOP
fetch cemp into pename;
exit when cemp%notfound;
dbms_output.put_line(pename);
end loop;
close cemp;
end;
/
SQL--> select ename, empno from emp; ENAME EMPNO ---------- ---------------------- SMITH 7369 ALLEN 7499 WARD 7521 JONES 7566 MARTIN 7654 BLAKE 7698 CLARK 7782 SCOTT 7788 KING 7839 TURNER 7844 ADAMS 7876 JAMES 7900 FORD 7902 MILLER 7934
将参数dno赋值7369等值,就可以了
Oracle数据库开发必备利器之PL/SQL基础
75048 学习 · 208 问题
相似问题