有如下触发器,当向远程数据库更新数据发生异常时,该怎么捕获异常。有没有一种异常可以代替所有的,类似于java中的Exception,本人不是很懂,不知道这样问是否合适,请大家帮帮忙
create or replace trigger tr_AQSC_COMPANY_insupd
after INSERT ORupdate on company
for each row
DECLARE
iCount int;
begin
select count(*) into iCount fromCOMPANY@ODSDBLINK where id=:new.id;
if iCount>0 then
updateCOMPANY@ODSDBLINK set NAME=:new.Name,Type=:new.Type,Remark=:NEW.REMARK,SHORT_NAME=:NEW.SHORT_NAME,LAST_UPDATE_DATE=sysdate
where id=:new.ID;
else
insert into COMPANY@ODSDBLINK
(ID,NAME,TYPE,REMARK,SHORT_NAME) values(:NEW.ID,:NEW.NAME,:NEW.TYPE,:NEW.REMARK,:NEW.SHORT_NAME);
end if;
end tr_AQSC_COMPANY_insupd;
|