declare
cursor c_emp is
select ename,sal,deptno from emp;
v_name emp.ename%type;
v_sal emp.sal%type;
v_deptno emp.deptno%type;
begin
open c_emp;
fetch c_emp into v_name,v_sal,v_deptno;
dbms_output.put_line(v_name||' '||v_sal||' '||v_deptno);
end;
/
答案 0 :(得分:0)
也许这个......?
declare
cursor c_emp is
select ename,sal,deptno from emp;
v_name emp.ename%type;
v_sal emp.sal%type;
v_deptno emp.deptno%type;
begin
open c_emp;
loop
fetch c_emp into v_name, v_sal, v_deptno;
exit when c_emp%NOTFOUND;
dbms_output.put_line(v_name||' '||v_sal||' '||v_deptno);
end loop;
close c_emp;
end;
/
答案 1 :(得分:0)
declare
cursor c_emp is
select ename,sal,deptno from emp where deptno=20;
v_name emp.ename%type;
v_sal emp.sal%type;
v_deptno emp.deptno%type;
begin
open c_emp;
loop
fetch c_emp into v_name, v_sal, v_deptno;
exit when c_emp%NOTFOUND;
dbms_output.put_line(v_name||' '||v_sal||' '||v_deptno);
end loop;
close c_emp;
end;
/