读书人

PL/SQL中如何忽略异常?

发布时间: 2014-01-28 21:26:34 作者: rapoo

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;

        

读书人网 >oracle

热点推荐