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: Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>
Date: Mon, 8 Jan 2001 14:01:24 -0800
Message-Id: <10735.126063@fatcity.com>


This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.

------_=_NextPart_001_01C079BE.8B0A7780
Content-Type: text/plain;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

> -----Original Message-----
> From: Lisa Yates [mailto:cosnit_at_creighton.edu]
> Sent: lundi, 8. janvier 2001 11:27
>=20
> Why doesn't this query ever return...
>=20
> where run_date =3D to_date('01-03-2001 16:34:59','mm-dd-yyyy=20
> 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=20
> 16:34:59'

Well, I guess my suggestion that run_date may contain a "BCE" (before = common
era) date was not the answer to your problem. Maybe I misunderstood the issue. When you say "why doesn't the query ever return", do you mean it returns zero rows, or do you mean that the query is taking an = abnormally
long time? If it's taking an abnormally long time, an explain plan on = the
two queries may reveal the cause.

Jacques R. Kilcho=EBr
(949) 754-8816
Quest Software, Inc.

8001 Irvine Center Drive
Irvine, California 92618
U.S.A.
http://www.quest.com

------_=_NextPart_001_01C079BE.8B0A7780
Content-Type: text/html;

        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE>RE: Date comparison question</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>&gt; From: Lisa Yates [<A =
HREF=3D"mailto:cosnit_at_creighton.edu">mailto:cosnit_at_creighton.edu</A>]</F=

ONT>

<BR><FONT SIZE=3D2>&gt; Sent: lundi, 8. janvier 2001 11:27</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Why doesn't this query ever return...</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; where run_date =3D to_date('01-03-2001 =
16:34:59','mm-dd-yyyy </FONT>
<BR><FONT SIZE=3D2>&gt; hh24:mi:ss')</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; but this query does....</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; where to_char(run_date) =3D =
to_char(to_date('01-03-2001</FONT>
<BR><FONT SIZE=3D2>&gt; 16:34:59','mm-dd-yyyy hh24:mi:ss'))</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; and so does this query....</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; where to_char(run_date,'mm-dd-yyyy hh24:mi:ss') =
=3D '01-03-2001 </FONT>
<BR><FONT SIZE=3D2>&gt; 16:34:59'</FONT>
</P>

<P><FONT SIZE=3D2>Well, I guess my suggestion that run_date may contain =
a &quot;BCE&quot; (before common era) date was not the answer to your = problem. Maybe I misunderstood the issue. When you say &quot;why = doesn't the query ever return&quot;, do you mean it returns zero rows, = or do you mean that the query is taking an abnormally long time? If = it's taking an abnormally long time, an explain plan on the two queries = may reveal the cause.</FONT></P>

<P><FONT SIZE=3D2>Jacques R. Kilcho=EBr</FONT>
<BR><FONT SIZE=3D2>(949) 754-8816</FONT>
<BR><FONT SIZE=3D2>Quest Software, Inc.</FONT>
</P>

<P><FONT SIZE=3D2>8001 Irvine Center Drive</FONT>
<BR><FONT SIZE=3D2>Irvine, California 92618</FONT>
<BR><FONT SIZE=3D2>U.S.A.</FONT>
<BR><FONT SIZE=3D2><A HREF=3D"http://www.quest.com" =
TARGET=3D"_blank">http://www.quest.com</A></FONT> Received on Mon Jan 08 2001 - 16:01:24 CST

Original text of this message

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