Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Date comparison question

RE: Date comparison question

From: William Beilstein <BeilstWH_at_OBG.com>
Date: Mon, 08 Jan 2001 15:42:41 -0500
Message-Id: <10735.126056@fatcity.com>


The reason is that a date is actually stored as a number with the time = being stored as the fraction of 1, for example noon is .5

When you specify an exact time using the to_date function, you will not = get the exact same fractional value as you would with a division of = 1/86400 (one second past midnight)

>>> Lisa Yates <cosnit_at_creighton.edu> 01/08/01 03:06PM >>>

Michael,

you are correct, the column run_date is of date datatype. But, I thought that because I had the to_date function in us it would compare date type to date type.

Lisa

On Mon, 8 Jan 2001, Armstead, Michael A wrote:

> Because the column run_date is apparently of date datatype.=20

>=20

> The query that doesn't work looks like it compares a date datatype to a
> character datatype which won't evaluate as a match.
>=20

> The other two situations compare a character datatype to a character
> datatype, which can evaluate as a match.
>=20

> Michael Armstead
> Database Administrator, OCP-Certified
> Corporate & Finance Information Systems
> Glaxo SmithKline
>=20
>=20

> > -----Original Message-----
> > From: Lisa Yates [SMTP:cosnit_at_creighton.edu]=20
> > Sent: Monday, January 08, 2001 2:27 PM
> > To: Multiple recipients of list ORACLE-L
> > Subject: Date comparison question
> >=20
> >=20
> > Why doesn't this query ever return...
> >=20
> > where run_date =3D to_date('01-03-2001 16:34:59','mm-dd-yyyy hh24:mi:ss=
')
> >=20
> > but this query does....
> >=20
> > where to_char(run_date) =3D to_char(to_date('01-03-2001
> > 16:34:59','mm-dd-yyyy hh24:mi:ss'))
> >=20
> > and so does this query....
> >=20
> > where to_char(run_date,'mm-dd-yyyy hh24:mi:ss') =3D '01-03-2001 =
16:34:59'
> >=20
> > ?
> >=20
> > TIA
> >=20
> > Lisa
> >=20
> > =20
> > ********************************************
> > * Lisa Yates cosnit_at_creighton.edu *=20
> > * Creighton University *
> > * Omaha, Nebraska *
> > * (402) 280-2419 fax: (402) 280-2573 *
> > * Define the Universe, give 2 examples. *
> > ********************************************
> >=20
> >=20
> > --=20
> > Please see the official ORACLE-L FAQ: http://www.orafaq.com=20
> > --=20
> > Author: Lisa Yates
> > INET: cosnit_at_creighton.edu=20
> >=20
> > 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).
>=20
>=20

 =20


--=20
Please see the official ORACLE-L FAQ: http://www.orafaq.com=20 --=20
Author: Lisa Yates
  INET: cosnit_at_creighton.edu=20

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 Received on Mon Jan 08 2001 - 14:42:41 CST

Original text of this message

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