原本的存储过程太长了,截取出来,大家帮忙看下到底是哪儿错了。。以前没用过游标,现在我每次遍历游标都有这个我问题。就算游标没有数据,不会在exit notfound 那里停,非要进去走一遍才好不知道该怎么办了。
open sel_dl_id for select yingyetingid from yingyeting where yingyetingid not in(select yingyetingid from ClientOnLine where to_char(VisitStartDate)=to_char(sysdate));
loop
exit when sel_dl_id%notfound;
fetch sel_dl_id into yingyetingid2;
insert into ExceptionInfo values(seq_exceptioninfo.nextval,dl_id,sysdate,yingyetingid2);
end loop;谢谢大家了
open sel_dl_id for select yingyetingid from yingyeting where yingyetingid not in(select yingyetingid from ClientOnLine where to_char(VisitStartDate)=to_char(sysdate));
loop
exit when sel_dl_id%notfound;
fetch sel_dl_id into yingyetingid2;
insert into ExceptionInfo values(seq_exceptioninfo.nextval,dl_id,sysdate,yingyetingid2);
end loop;谢谢大家了
解决方案 »
- 问下这句SQL是什么意思?(在水一方) 来
- oracle ORA-01008: 并非所有变量都已绑定
- group by 数据缺少问题
- 菜鸟问题:几个有一对多关系的表怎么删除?
- 在vb中生成过程的语句,为什么执行后总是invalid状态,而加个空格或去个空格就valid了,情有经验的人指正!!!
- 关于分类统计前N条的问题
- 求一求和SQL!
- 那位人兄,能告诉我 我想学 ORACLE但不知道 用那本书!谁能推荐一本!
- call与execute调用存储过程(在sqlplus中)有什么区别
- 执行计划(索引为啥没有使用)
- oracle 11g jdbc连接问题
- 请问oracle如何实现MySql enum类型?
while sel_dl_id%notfound loop
fetch sel_dl_id into yingyetingid2;
insert into ExceptionInfo values (seq_exceptioninfo.nextval,dl_id,sysdate,yingyetingid2);
end loop;
loop
fetch sel_dl_id into yingyetingid2;
exit when sel_dl_id%notfound; ---这句放这里来
insert into ExceptionInfo values(seq_exceptioninfo.nextval,dl_id,sysdate,yingyetingid2);
end loop;
loop
fetch sel_dl_id into yingyetingid2;--注意位置顺序
exit when sel_dl_id%notfound;
insert into ExceptionInfo values(seq_exceptioninfo.nextval,dl_id,sysdate,yingyetingid2);
end loop;