del_cursor 批量刪除遊標

  1. declare
  2.  
    cursor [del_cursor] is select a.*, a.rowid row_id from [table_name] a order by a.rowid;
  3.  
    begin
  4.  
    for v_cusor in [del_cursor] loop
  5.  
    if v_cusor.[time_stamp] < to_date('2014-01-01','yyyy-mm-dd') then
  6.  
    delete from [table_name] where rowid = v_cusor.row_id;
  7.  
    end if;
  8.  
    if mod([del_cursor]%rowcount,1000)=0 then
  9.  
    commit;
  10.  
    end if;
  11.  
    end loop;
  12.  
    commit;
  13.  
    end;
相關文章
相關標籤/搜索