Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006

    Red face Unanswered: How to delete records which is 365 day old

    Would u pls tell me
    How to delete record from the table
    which is 365 days old from the current date(in oracle)??

    Pls specify the example

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    If you do not know which records are more the 365 days old, why do you expect strangers who have never seen your data to know?
    It would help immensely if you posted the definition of the table being discussed.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    Does "365 days" mean EXACTLY 365 days, or would you rather refer to "1 year" old records (because every fourth year has 366 days, I hope you're aware of this fact) (plus the fact I don't know English word for this phenomenon ... "every fourth year". Having Google as my friend, I *suppose* it is called a leap year).

    Additionally, does your DATE column contain time fraction, or do you store "truncated" date (days-months-years with time component set to midnight)?

    There might be several ways to do it, depending on data you have. Here are some of them:

    DELETE FROM your_table WHERE date_column = TRUNC(SYSDATE) - 365;

    DELETE FROM your_table WHERE TRUNC(date_column) = TRUNC(SYSDATE) - 365;

    DELETE FROM your_table WHERE TRUNC(date_column) = ADD_MONTHS(TRUNC(SYSDATE), -12);

    There certainly are more ways to do it, but without knowing more details about your situation, it is hard to guess the correct answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts