Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: search by date range
Henry,
Oracle does something slightly strage with date comparisons, it
includes the time component in the calculation when not forced not to
do this. Thus, by Oracle logic a record dated 01/01/1999 00:00:01
meets the > '01-NOV-1999' criterion. You need to either code either:
SELECT BLAH_DT
FROM BLAH
WHERE BLAH_DT >= TO_DATE('02-NOV-1999');
or
SELECT BLAH_DT
FROM BLAH
WHERE TRUNC(BLAH_DT) > TRUNC(TO_DATE('01-NOV-1999');
unless you can be absolutely certain that all records have 00:00:00
times components. TRUNC() eliminates the time component from the
comparison.
In article <80l272$c37$1_at_nnrp1.deja.com>,
henry_atwork_at_my-deja.com wrote:
> will the following command work to find entries that are entered after
> 11/01/1999? select BLAH, BLAH, BLAH where date > '01-NOV-1999';
>
> if not how i can fix it? thanks.
>
> -hc
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Sun Nov 14 1999 - 05:01:46 CST