提高delete效率方法

1 open c_1;
   loop
     fetch c_1 bulk collect
       into t2 limit 100000;
     exit when c_1%notfound;
     FORALL i IN 1 .. t2.count
       delete from a_wc_cb_cjcb where rowid = t2(i);
     commit;
   end loop;
   close c_1

2 for a in 1 .. 100 loop  
     t1 := t_1();
   end loop;
   select a bulk collect into t2 from a;
   FORALL t1_i IN 1 .. t2.count
     delete from a where a = t2(t1_i);

3 begin
    v_sql := 'alter table a_wc_cb_cjcb drop partition p' || v_value;
    execute immediate v_sql;
    commit;
  exception
    when others then
      null;
  end;
  v_sql := 'alter table a_wc_cb_cjcb add partition p' || v_value ||
           ' values(''' || v_value || ''') tablespace ts' || v_dwbm;
  execute immediate v_sql;
  commit;

原文地址:https://www.cnblogs.com/sddychj/p/4606878.html