ITPub博客

首页 > 数据库 > Oracle > oracle 批量更新、批量删除的匿名块

oracle 批量更新、批量删除的匿名块

原创 Oracle 作者:abin1703 时间:2015-12-30 10:56:32 0 删除 编辑
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博客 ” ,链接:https://blog.itpub.net/30345407/viewspace-1967659/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2015-07-13

  • 博文量
    204
  • 访问量
    426792