oracle 判断游标是否为空
- 博客分类:
来自 https://www.iteye.com/blog/yuiop666-2098331
- while numRowCount < 10 loop
- numRand := TRUNC(dbms_random.value(1,30),0);
- select count(1) into i from dc_middle_rand where midRand = numRand;
- if i=0 then
- EXECUTE IMMEDIATE 'Insert into dc_middle_rand values('|| numRand ||')';
- commit;
- numRowCount := numRowCount + 1;
- end if;
- end Loop;
- PROCEDURE s IS
- v_yhbh varchar2(10);
- v_yhmc varchar2(60);
- cursor bh_list is select distinct yhbh,yhmc from dbuser_manager order by yhmc ;
- begin
- open bh_list;
- fetch bh_list into v_yhbh,v_yhmc;
- while bh_list %found loop
- --你的操作
- fetch bh_list into v_yhbh,v_yhmc;
- end loop;
- close bh_list;
- END;
来自 https://bbs.csdn.net/topics/390875259?list=lz
oracle 判断游标是否为空
begin
open cur_p;loop
fetch cur_p into var_a,var_b;
exit when cur_p%notfound;
if cur_p%rowcount = 0 then
begin
--语句块1
exception
when others then
null;
end;
else
begin
--语句块2
exception
when others then
null;
end;
end if;
end loop;
close cur_p;
end;