当前位置: 代码迷 >> SQL >> PL/SQL中,怎么忽略错误
  详细解决方案

PL/SQL中,怎么忽略错误

热度:43   发布时间:2016-05-05 13:04:18.0
PL/SQL中,如何忽略异常?
点击右边红色标题查看本文完整版:PL/SQL中,如何忽略异常?

PL/SQL中,如何忽略异常

举例:
begin
insert into t1 values( '1 ');
insert into t1 values( '2 ');
end;

第一个insert出错的时候,我想继续执行第二个,并且不允许异常抛出,该如何做呢?

------解决方法--------------------
把他们放在不同的块里 对每个块进行异常捕获


------解决方法--------------------



begin

begin
insert into t1 values( '1 ');
exception
when others then null;
end;

begin
insert into t1 values( '2 ');
exception
when others then null;
end;

exception
null;

end;

    
  相关解决方案