create table mt_apply_101231 as select * from mt_apply ;update mt_apply m---31060
set m.admit_date = to_date('20111231','yyyy-mm-dd') where m.valid_flag = '1';现在执行了这些,COMMIT了。
现在要恢复这个。。
update MT_APPLY ma
   set ma.apply_date = (select mae.apply_date
                          from mt_apply_101231 mae
                         where mae.serial_apply = ma.serial_apply and mae.valid_flag=1)             
 WHERE ma.serial_apply in
       (select mae.serial_apply
          from mt_apply_101231 mae
         where mae.serial_apply = ma.serial_apply and mae.valid_flag=1)
这样行吗?

解决方案 »

  1.   

    update MT_APPLY ma
      set ma.apply_date = (select mae.apply_date
      from mt_apply_101231 mae
      where mae.serial_apply = ma.serial_apply and mae.valid_flag=1)   
     WHERE ma.valid_flag=1
       and exists   (select 1  from mt_apply_101231 mae
      where mae.serial_apply = ma.serial_apply and mae.valid_flag=1)
      

  2.   

    update MT_APPLY ma
      set ma.apply_date = (select mae.apply_date
      from C mae
      where mae.serial_apply = ma.serial_apply and mae.valid_flag=1)   
     WHERE ma.serial_apply in
      (select mae.serial_apply
      from mt_apply_101231 mae
      where mae.serial_apply = ma.serial_apply ) and mae.valid_flag=1
    --ormerge into MT_APPLY a using mt_apply_101231 b on(a.serial_apply = b.serial_apply)
    when matched then
    update set a.apply_date=b.apply_date
    where a.valid_flag=1
    --or你直接清空数据在插入不可以吗