读书人

PL/SQL中怎么忽略错误

发布时间: 2012-10-29 10:03:53 作者: rapoo

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;

    

读书人网 >SQL Server

热点推荐