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: To_Char Problem

Re: To_Char Problem

From: Joe Testa <jtesta_at_dmc-it.com>
Date: Wed, 14 Aug 2002 18:23:46 -0800
Message-ID: <F001.004B580A.20020814182346@fatcity.com>


because it is.

its not a problem with oracle, its a problem with the way the query is written.

make the date mask YYYY/MM/DD HH24:MI:SS instead.

last i checked in math101, a number(or character string) 8 digits long, that starts with a 31 is larger than an 8 digit number starting with 01.

joe

karthikeyan S wrote:

>Hi All,
>
>I am using the to_char function in the following query. But it treats the date '31/12/2001' as greater than '01/01/2002'.
>Is there any solution to fix this problem?
>
> select distinct(a.default_type_id), a.new_val
> from amend_default_value a, amend_default_value b
> where a.effective_from <= sysdate and
> a.effective_to >= sysdate and
> a.group_id = '942' and
> a.default_type_id = b.default_type_id and
> to_char(a.updated_date,'dd/mm/yyyy hh:mi:ss') =
> ( select max(to_char(updated_date,'dd/mm/yyyy hh:mi:ss'))
> from amend_default_value c
> where c.effective_from <= sysdate and
> c.effective_to >= sysdate and
> c.group_id = '942' and
> c.default_type_id = b.default_type_id);
>
>Thanks in advance.
>
>regards,
>Karthik
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Joe Testa
  INET: jtesta_at_dmc-it.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
(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 Wed Aug 14 2002 - 21:23:46 CDT

Original text of this message

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