Deleting Record 3 months and older
liangtehMay 17 2009 — edited May 19 2009Hi All,
I would like to select all record which are older than 3 months for deletion, however due to the record size of the table(20mil) I would like to delete it by batches.
1. I would select records older than 3 months
2. I would pick the oldest record to date using min(column)
3. I would add +14 days to the where condition to delete only 2 weeks of data
Is there any better ways I can rewrite my delete statement?
with record_older_than_three_months as
(
select * from table where column < add_months(sysdate, -3)
)
delete from record_older_than_three_months where column between min(column) and min(column) + 14