`
yjgyjg4
  • 浏览: 116313 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

oracle cursor

阅读更多
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;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics