有关oracle cursor游标无记录时的操作问题?

tvhtb 2005-09-10 09:17:37
当游标没记录时,我查到的资料都是exit操作,如下:
fetch cur_servhis into thisservhis;
exit when cur_servhis%notFound;
我现在需要当没记录时,要执行一个insert操作,请问怎么写?
...全文
160 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dinya2003 2005-09-10
  • 打赏
  • 举报
回复
.....
open c;
loop
fetch c into user_id,user_name;
if c%rowcount=0 then
insert into dinya_user values(1,'E');
commit;
exit;
end if;
end loop;
close c;
end ;
qiaozhiwei 2005-09-10
  • 打赏
  • 举报
回复
open cur_servhis;
loop
fetch cur_servhis into thisservhis;
exit when cur_servhis%notFound;
end loop;
if cur_servhis%rowcount = 0 then
insert into ......
end if;
close cur_servhis;

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧