时间:2021-07-01 10:21:17 帮助过:4人阅读
删除表数据。数据量太大(7444741)无法直接删除,需批量删除。
declare cursor mycursor is SELECT ROWID FROM {tablename} WHERE ltl_time < to_date(‘2017-08-01‘,‘YYYY-mm-dd‘) order by rowid; --------按ROWID排序的Cursor,删除条件是XXX=XXXX,根据实际情况来定。 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; --------每次处理5000行,也就是每5000行一提交 exit when v_rowid.count=0; forall i in v_rowid.first..v_rowid.last delete from {tablename} nologging where rowid=v_rowid(i); commit; end loop; close mycursor; END;
oracle性能分析2
标签:tab cursor rom int bsp 分区 div where 表数