A B两个用户各有同名同结构的表tab,在B下创建一触发器,从B的tab里查找记录插入到A表,但在B的触发器里调用A.tab提示“表或视图不存在”,该怎么调用?
解决方案 »
- oracle存储过程中二维数组
- 一个字段值作为另一张表名,怎么查询?
- 请教高手 ,Oracle 中自定义的确定性函数执行效率的问题
- oracle group by 的优化
- 如何分组排序并产生序号
- 我在RESIZE数据文件时报错ORA-03297,请问如何Drop or move segments containing extents 或是避免这个错误啊?
- 高分求oracle的sql语句
- 一用户具有能操作某功能,但是只能操作此功能下的某些数据,如何设置此用户的操作这些数据的权限?
- 将联合查询的结果排序
- 安装oracle9i的问题,100分
- 求sql语句
- minus 、union、 union all、intersect
2个库之间要建DBLINK
不同用户之间要 用户名.表名。
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;
2.赋权GRANT SELECT ON tablename TO userb;