Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Date in SQL

Re: Date in SQL

From: Nicolas Bronke <news_at_TRINITY.de>
Date: Wed, 28 Jul 1999 10:07:10 +0200
Message-ID: <379eabe5@news.uk.ibm.net>

Marien Kaptein <m.kaptein_at_optimit.nospam.nl>
> I have a table with a date field. From this table I want to list all
records
> of which the date is 15 days old, thus the date in the table must be 15
days
> before sysdate.

I am not sure I understood you right.
Try simply that:
select * from table where trunc(datefield)=trunc(sysdate)-15 Trunc removes the time part of a date field (and can a lot of more)

> I have tried something with adding days to the day-number and compare this
> with last_day. But this gets to complex because you must also account for
> situations where you cross months and years.
>

Last_day returns the last day of a month.

Regards
Nicolas Bronke Received on Wed Jul 28 1999 - 03:07:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US