Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Date comparison question
Because the column run_date is apparently of date datatype.
The query that doesn't work looks like it compares a date datatype to a character datatype which won't evaluate as a match.
The other two situations compare a character datatype to a character datatype, which can evaluate as a match.
Michael Armstead
Database Administrator, OCP-Certified
Corporate & Finance Information Systems
Glaxo SmithKline
> -----Original Message-----
> From: Lisa Yates [SMTP:cosnit_at_creighton.edu]
> Sent: Monday, January 08, 2001 2:27 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Date comparison question
>
>
> Why doesn't this query ever return...
>
> where run_date = to_date('01-03-2001 16:34:59','mm-dd-yyyy hh24:mi:ss')
>
> but this query does....
>
> where to_char(run_date) = to_char(to_date('01-03-2001
> 16:34:59','mm-dd-yyyy hh24:mi:ss'))
>
> and so does this query....
>
> where to_char(run_date,'mm-dd-yyyy hh24:mi:ss') = '01-03-2001 16:34:59'
>
> ?
>
> TIA
>
> Lisa
>
>
> ********************************************
> * Lisa Yates cosnit_at_creighton.edu *
> * Creighton University *
> * Omaha, Nebraska *
> * (402) 280-2419 fax: (402) 280-2573 *
> * Define the Universe, give 2 examples. *
> ********************************************
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Lisa Yates
> INET: cosnit_at_creighton.edu
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
Received on Mon Jan 08 2001 - 13:54:36 CST