Ensure two data table structure is the same, if not the same can only synchronize the same field;
Just the idea, please modify according to the requirements.
Declare cursorCsrn_mon is Select * fromtable2; Row_mon Csrn_mon%RowType;cursorCsrn_loc isSelect * fromTable1;row_loc Csrn_loc%RowType;cursorCsrn_del isSelectXh fromTable1 minusSelectXh fromTable2;row_del Csrn_del%RowType;cursorCsrn_ins isSelectXh fromTable2 minusSelectXh fromtable1;row_ins csrn_ins%RowType;begin forRow_moninchCsrn_mon Loop forRow_locinchCsrn_loc LoopifRow_loc.xh=Row_mon.xh ThenDbms_output.put_line ('Update information:' ||row_loc.xh); End if; EndLoop;EndLoop; forRow_delinchCsrn_del Loop Dbms_output.put_line ('Delete Information:' ||row_del.xh);EndLoop; forRow_insinchCsrn_ins Loop Dbms_output.put_line ('Insert Information:' ||row_ins.xh);EndLoop;End;
Data synchronization between Oracle data tables