Script to delete rows from a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rthota211
    New Member
    • Jan 2012
    • 2

    Script to delete rows from a table

    Hi All,

    Is there a possiblity to write a script in oracle which deletes the rows from a table based on the age.i.e., I want to delete the rows which are >120 days . I have a table with millions of rows in it and I want to keep only the latest two months rows. I have the following table with column names as ERROR_IND
    FEED_ID
    QUEUE_ID
    FEED_DT_TM

    I have written "delete * from tablename where (sysdate-to_date(feed_dt _tm))>=120"

    Please advise on writing a script for it.

    Thanks in Advance
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    So you want ot execute that delete statement monthly? You can write simple sql script with this delete query and add a monthly crontab rule for that script if you use linux. Under windows there is also scheduler for periodic executing script but I didn't use that.

    Comment

    Working...