Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: dates in where clause using to_date and =
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