oracle 批次更新、批次刪除的匿名塊

abin1703發表於2015-12-30
begin
  declare
    cursor c_update is
     select rowid row_id
        from E_INV_INVESTMENT where (invtype  in ('10','11','12','13','14','20','21','22','30','35','36'))or (regexp_like(cerno,'([0-9]|[x]|[X]){18}$') and invtype in ('15','31','32','33','34','40','50','90'));
    v_counter number := 0;
  begin
    for one_row in c_update loop
      v_counter := v_counter + 1;
      update E_INV_INVESTMENT SET CERNO='' where  rowid = one_row.row_id;
      if (v_counter = 1000) then
        v_counter := 0;
        commit;
      end if;
    end loop;
    commit;
  end;
end;
/

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30345407/viewspace-1967659/,如需轉載,請註明出處,否則將追究法律責任。

相關文章