删除大表数据

declare  
   cursor mycursor is SELECT  ROWID FROM tpr_zjjx1 WHERE jxrq=to_date('2013-06-30','yyyy-mm-dd')  order by rowid;  
   type rowid_table_type is  table  of rowid index by pls_integer;
   v_rowid   rowid_table_type;
BEGIN
   open mycursor;
   loop
     fetch   mycursor bulk collect into v_rowid  limit 5000;   
     exit when v_rowid.count=0;
     forall i in v_rowid.first..v_rowid.last
        delete from tpr_zjjx1  where rowid=v_rowid(i);
     commit;
   end loop;
   close mycursor;
END;

 

posted on 2015-01-29 18:40  相约future  阅读(170)  评论(0编辑  收藏  举报