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: dates in where clause using to_date and =

Re: dates in where clause using to_date and =

From: George Harding <george_d_harding_at_hotmail.com>
Date: 2000/08/07
Message-ID: <8mmh97$fk8@news.or.intel.com>#1/1

Inherent in the comparison is the time. Try using the trunc function on both sides of the =.

Peter Shankey wrote in message <398F6E93.BB7400DC_at_charlestoncounty.org>...
>I would like to use the to_date function in a where clause.
>If I do
>
>select eventdate from countycal;
>stuff
>stuff
>07/06/2000
>07/06/2000
>07/06/2000
>stuff
>stuff
>ie nls format is 'MM/DD/YYYY'
>
>however if I do:
>
>select eventdate
>from countycal
>where eventdate = to_date('07/06/2000','MM/DD/YYYY')
>
>no rows selected
>
>However if I do:
>
>select eventdate
>from countycal
>where eventdate like to_date('07/06/2000','MM/DD/YYYY')
>07/06/2000
>07/06/2000
>07/06/2000
>
>or if I do
>
>select eventdate
>from countycal
>where eventdate BETWEEN to_date('07-05-2000','MM-DD-YYYY')
>and to_date('07-07-2000','MM-DD-YYYY')
>07/06/2000
>07/06/2000
>07/06/2000
>07/07/2000
>
>which make sense.
>
>I evidentally do not understand the use of the equals sign with repect
>to date
>formating. Could someone explain where I am missing it.
>
>Thanks
>Pete
>
Received on Mon Aug 07 2000 - 00:00:00 CDT

Original text of this message

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