一个删除大表的存储过程
create or replace procedure prc_delete_table is
-- 指定表名和条件 CURSOR cur IS SELECT ROWID FROM data_cache_report_stat s WHERE s.month<'10' ORDER BY ROWID; TYPE rowid_table_type IS TABLE OF ROWID INDEX BY PLS_INTEGER; v_rowid rowid_table_type; begin OPEN cur; LOOP FETCH cur BULK COLLECT INTO v_rowid limit 5000; EXIT WHEN v_rowid.count=0; FORALL i IN v_rowid.first..v_rowid.last
-- 指定表名 DELETE FROM data_cache_report_stat WHERE rowid=v_rowid(i); COMMIT; END LOOP; CLOSE cur; end prc_delete_table;