A用户下的触发器如何更新B用户下的表?
时间:2011-09-14
来源:互联网
作者: leeloy 发布时间: 2011-09-14
2个库之间要建DBLINK
不同用户之间要 用户名.表名。
作者: reg13141 发布时间: 2011-09-14
你是2个数据库还是同一个数据库的两个用户,
2个库之间要建DBLINK
不同用户之间要 用户名.表名。
不同用户,我引用的时候是用的A.tab,但也提示那错
作者: leeloy 发布时间: 2011-09-14
create or replace trigger trg_AAA_TRI
after insert or update or delete on AAA_TRI
for each row
declare
str_action varchar2(32);
str_sql varchar2(32000);
i_sqlcode int;
begin
if inserting then
str_action := 'inserting' ;
--INSERT字段名由select table_name from user_tab_columns where table_name=:table_name;动态生成
insert into AAA_TRI@db205(AAA,BBB) values(:new.AAA,:new.BBB);
end if;
if updating then
str_action := 'updating' ;
--更新字段名由select table_name from user_tab_columns where table_name=:table_name;动态生成
--条件字段名由st_tblsync的primary_fields动态生成
update AAA_TRI@db205 set AAA=:new.AAA,BBB=:new.BBB
where 1=1 and aaa =:old.aaa and bbb =:old.bbb;
end if;
if deleting then
str_action := 'deleting' ;
--条件字段名由st_tblsync的primary_fields动态生成
delete from AAA_TRI@db205
where 1=1 and aaa =:old.aaa and bbb =:old.bbb;
end if;
end;
作者: reg13141 发布时间: 2011-09-14
作者: lizhuxin2008 发布时间: 2011-09-14
作者: luochaofeng520 发布时间: 2011-09-14
作者: minitoy 发布时间: 2011-09-14
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28