我正在sqlplus上执行以下PL / SQL脚本:
declare
cursor c is select sal, empno, ename from emp where ((comm is null and sal>2000) or (comm is not null and (sal+comm)>2000));
v_sal emp.sal%type;
v_empno emp.sal%type;
v_ename emp.ename%type;
begin
open c;
loop
fetch c into v_sal,v_empno,v_ename;
insert into temp values(v_sal,v_empno,v_ename);
exit when(c%notfound);
end loop;
close c;
end;
/
我获得了我想要的所有n-uplets,但最后一个是重复的。
答案 0 :(得分:2)
将exit
语句放在insert
之前。