17,086
社区成员
发帖
与我相关
我的任务
分享
exception
when others then
--把操作失败的记录 写入你的日志表
null;
大致语法如下:
merge into t1
using t2
on (t1.c1=t2.c1)
when matched then
update set t1.c1=t2.c1,t1.c2=t2.c2, ......
when not matched then
insert values(t2.c1,t2.c2,......)
以上希望有所帮助。
id//自增的ID
table_name//发生insert,update,delete的表名
record_id//发生insert,u,d的记录行的ID
flag//标志,是insert,update还是delete
create trigger tri_teall
after insert or update or delete on tb_mine for each row
declare
begin
if inserting then
insert into tb_other@dblink values(:new.mycol1,:new.mycol2...);
elsif updating then
update tb_other@dblink set
othercol1 = :new.mycol1,
othercol2 = :new.mycol2...
where otherid = :old.myid;
elsif deleting then
delete from tb_other@dblink where otherid = :old.myid;
end if;
exception
when others then
--把操作失败的记录 写入你的日志表
null;
end;