create or replace procedure sp_mirror_caiwu
as
begin
merge into odm_erp_info_t a
using (select distinct * from caiwu@ln_erp) b
on (a.id=b.id)
when matched then
update set
a.dept=b.dept,
a.operation=b.operation,
a.reason=b.reason,
a.money=b.money,
a.dt=b.dt,
a.etl_time=sysdate
when not matched then
insert(a.id,a.dept,a.operation,a.reason,a.money,a.dt,a.etl_time,a.syssource)
values(b.id,b.dept,b.operation,b.reason,b.money,b.dt,sysdate,'erp');
commit;
end;