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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL date inquiry

Re: SQL date inquiry

From: Mungo Henning <mungoh_at_itacs.strath.ac.uk>
Date: Thu, 17 Sep 1998 14:23:00 +0100
Message-ID: <36010D33.587C3406@itacs.strath.ac.uk>


Alan D. Mills wrote:
>
> >
> >Time defaults to 12:00am for dates. If you have time, then you need
> >to check for the date being between date=> and <date +1.
> >
> >I've got a nasty looking algorythem that works. It converts date to
> >char adds 1, then converts back to date to do the arithmatic. I'd
> >love to see a simpler solution.
> >
>
> Make sure both sides of the comparison are both date format and then TRUNC
> both sides
>
> i.e. AND TRUNC(date1) = TRUNC(date2)
>
> This will be true if the days are the same regardless of times. It sames
> the date arithmetice (adding one) and an extra test.

And if you have an index on the date column to speed things along, once you apply a function to the column the index won't be used (IIRC). Something to bear in mind for the future...

Mungo Henning Received on Thu Sep 17 1998 - 08:23:00 CDT

Original text of this message

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