declare
--定义游标;
cursor c is select id,(SAL*0.3) sal,sal from Emplyoe for update;
id number;
sal number;
sal2 number;
BEGIN
open c;
loop
fetch c into id,sal,sal2;
exit when c%notfound;
if sal2>=1000 then
--insert into jingTie values(id,sal);
--dbms_output.put_line(' '||id||' '||sal);
dbms_output.put_line(' '||sal);
end if;
--退出;
--退出;
end loop;
close c;
end;
把 exit when c%notfound; 放到fetch c into id,sal,sal2;之后。即:
fetch c into id,sal,sal2;
exit when c%notfound;
重段则宽复的原因盯前是id,sal,sal2;保存了最后握亮一条记录的值。