日期:2014-05-16  浏览次数:20674 次

oracle 数据同步求解
需求:通过表A,向表B同步数据,insert、update,同时把同步的数据记录到表C中。其中A表示中间数据,B表在A表的基础上添加id/状态灯字段,C表示B表的记录表,比B表多record_id 、date字段。本来打算用megre关键字
merge into B  using  A
on (B.htbh = A.htbh)
when matched  then update set ...
when not matched then
insert ...

但是不知道怎么忘C表插数据,求大神指点一下!
------解决方案--------------------
insert into C
select 、、、 from A,B
where B.htbh = A.htbh;

insert into C
select 、、、 from A
where not exists
(select 1 from B where B.htbh = A.htbh);
------解决方案--------------------
物化视图\DBLINK\同义词\触发器\存储过程\DMBS_JOB  etc.
------解决方案--------------------
你把ABC表的详细字段信息贴出来才能帮你啊。
例如:C表的record_id 、date是放什么的?还是说空着就行。