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: How to compare a date to sysdate

Re: How to compare a date to sysdate

From: Matthias Gresz <GreMa_at_t-online.de>
Date: Wed, 03 Mar 1999 09:27:57 +0100
Message-ID: <36DCF28D.E6C1200E@t-online.de>

Sybrand Bakker schrieb:
>
> This is because there is a time (mm:ss) in the sysdate and maybe also in
> the readdate
> try
> select * from tab1row where readdate = trunc(sysdate) /* No need to select
> from dual, sysdate is a built-in function, trunc will cut off the time */

won't work if readdat has a time portion too

> or (worse)
> select * from tab1row where trunc(readdate) = trunc(sysdate)

indexes wont be used

> or (complicated, but it does work)
> select * from tab1row where readdate between trunc(sysdate) and
> trunc(sysdate) + 1/*day*/ -1/3600

third stat may use indexes, and works even though readate may have a time portion.  

Matthias
--
grema_at_t-online.de Received on Wed Mar 03 1999 - 02:27:57 CST

Original text of this message

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