RE: Delete Data older than exactly 2 years

  • From: Sanjay Mishra <smishra_97@xxxxxxxxx>
  • To: mnavickas@xxxxxxxxx, rjamya@xxxxxxxxx
  • Date: Fri, 20 Apr 2007 08:35:51 -0700 (PDT)

Thanks Mindaugas

Mindaugas Navickas <mnavickas@xxxxxxxxx> wrote:       delete table  where 
record_timestamp < ADD_MONTHS(sysdate, -24)
   
  Regards
  Mindaugas Navickas
  Oracle&DB2 DBA
   
    
  -----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of rjamya
Sent: April 19, 2007 10:17 PM
To: smishra_97@xxxxxxxxx
Cc: oracle-l@xxxxxxxxxxxxx
Subject: Re: Delete Data older than exactly 2 years


  Why can't you use that logic? And come to think of it, I'd rather run this 
cleanup on the FIRST sunday of the month. So, I can do a trun() at month (to 
get the first), then substract 24 months. So you will always cleanup on a month 
boundary. 
   
  Month to month cleanup is always better than on a random date in the last 
week. What do you think?
   
  rjamya

 
  On 4/19/07, Sanjay Mishra <smishra_97@xxxxxxxxx> wrote:     Hi 
   
  Can somebody suggest good method to delete all record older than 2 years from 
the current date. This script will run on the last sunday of each month. I will 
write the logic for Last sunday in Unix shell but need some idea about the SQL. 
I can't use some 365+366 or so kind of logic. THis is 9i. 



       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Other related posts: