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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Timestamp

Re: Oracle Timestamp

From: Martin T. <bilbothebagginsbab5_at_freenet.de>
Date: 10 Aug 2006 02:56:26 -0700
Message-ID: <1155203785.866290.97730@75g2000cwc.googlegroups.com>


Faby wrote:
> Hi,
> I was wondering how I should convert a timestamp to compare it to
> '01-AUG-2006'.
>
> Is any of the following right?
>
> TO_CHAR(TRUNC(MYTIMESTAMP)) < '01-AUG-2006'
>
> TO_DATE(TRUNC(MYTIMESTAMP)) < '01-AUG-2006'
>
> TO_CHAR(MYTIMESTAMP,'DD-MON-YYYY') < '01-AUG-2006'
>
> If you could give a brief explaination of why I am getting a different
> result for each of the previous answer, i would really appreciate.
>

If you want to compare timestamps, compare timestamps, not strings. :)

TRUNC(MYTIMESTAMP) < TO_DATE('01-AUG-2006', fmt_string)

Btw. Do you have TIMESTAMPs, or DATEs? (Though I guess it doesn't make a difference in this case.)

best,
Martin Received on Thu Aug 10 2006 - 04:56:26 CDT

Original text of this message

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