首页 > 代码库 > Oracle数据表之间的数据同步
Oracle数据表之间的数据同步
保证两个数据表结构相同,如不相同只能同步相同字段;
只是思路,具体请根据需求修改.
declare cursor csrn_monis select * from table2; row_mon csrn_mon%rowtype;cursor csrn_locisselect * from table1;row_loc csrn_loc%rowtype;cursor csrn_delisselect xh from table1 minus select xh from table2;row_del csrn_del%rowtype;cursor csrn_insisselect xh from table2 minus select xh from table1;row_ins csrn_ins%rowtype;begin for row_mon in csrn_mon loop for row_loc in csrn_loc loop if row_loc.xh = row_mon.xh then dbms_output.put_line(‘更新信息:‘ || row_loc.xh); end if; end loop;end loop;for row_del in csrn_del loop dbms_output.put_line(‘删除信息:‘ || row_del.xh);end loop;for row_ins in csrn_ins loop dbms_output.put_line(‘插入信息:‘ || row_ins.xh);end loop;end;
Oracle数据表之间的数据同步
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。