异常处理的问题

[复制链接]
查看11 | 回复3 | 2015-11-11 09:58:34 | 显示全部楼层 |阅读模式
在循环中插入数据,如产生异常后将进入exception,循环将终止,能否有办法让循环继续进行处理而不终止。
不胜感谢
模拟例程如下:
declare
v_id number; v_desc varchar2(256);
begin
v_id := 0;
while v_id <= 10 loop

v_desc := v_id||'测试';

insert into test_err1(err1,errdesc)
values(v_id,v_desc);

commit;

v_id := v_id + 1;
end loop;
exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
end;
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
去掉上面這些!
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
declare
v_id number; v_desc varchar2(256);
begin
v_id := 0;
while v_id <= 10 loop
v_desc := v_id||'测试';
begin
insert into test_err1(err1,errdesc)
values(v_id,v_desc);
commit;
exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
end;
v_id := v_id + 1;
end loop;
exception
when others then
dbms_output.put_line(sqlcode||sqlerrm);
end;
回复

使用道具 举报

千问 | 2015-11-11 09:58:34 | 显示全部楼层
非常感谢各位
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行