declare
cursor c1 is select fleet_id from fleet where fleet_id = 122 or fleet_id = 6;
v_fid number;
flag number;
i number;
begin
i := 0;
select count(*) into flag from fleet where fleet_id=122 or fleet_id=6;
dbms_output.put_line('--num-'||flag);
open c1;
loop
fetch c1 into v_fid;
exit when c1%notfound; ---放在此位置,数据不会重复
dbms_output.put_line('---'||v_fid);
--exit when c1%notfound; --放在此位置,最后一条数据会重复一次
end loop;
close c1;
end;
oracle cursor
最新推荐文章于 2021-04-09 05:36:39 发布