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: Igor Neyman <ineyman_at_perceptron.com>
Date: Mon, 8 Jan 2001 16:41:01 -0500
Message-Id: <10735.126062@fatcity.com>


William,

You are wrong.
In Oracle "Date" is stored in fixed-length fields of 7 bytes each, corresponding to century, year, month,day, hour, minute, and second (time portion - counting after midnight).

Igor Neyman, OCP DBA
Perceptron, Inc.
(734)414-4627
ineyman_at_perceptron.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.
>
> 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).
>
>


--
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).

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: William Beilstein
  INET: BeilstWH_at_OBG.com

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

Original text of this message

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