Re: Problem with to_char function

From: <_at_kzo.us.pnu.com>
Date: Mon, 30 Nov 1998 14:17:37 -0500
Message-ID: <73ur0l$j11$1_at_inet-1.pnu.com>


i feel better write the query this way

select maakdi, chngdate
 from maat
 where to_date(chngdate, 'DD.MM.YYYY') >= to_date('15.10.1998','DD.MM.YYYY')

Rick wrote in message <365EEB63.2135_at_btinternet.com>...
>It's because you're comparing character strings and not dates, hence
>anything starting 15... or above will be returned. Use a different date
>format eg. YYYY.MM.DD or convert 15.10.1998 to a date using the to_date
>function instead.
>
>
>Mika N. wrote:
>>
>> Hi!
>>
>> I have a problem with to_char function in sql*plus (oracle 7.3.4).
>>
>> I don't understand why my query selects all the rows...
>>
>> select maakdi, chngdate
>> from maat
>> where to_char(chngdate, 'DD.MM.YYYY') >= '15.10.1998'
>>
>> MA CHNGDATE
>> -- ----------
>> SK 16.02.1996 (why this row?)
>> SK 15.10.1998 (this is OK)
>> CZ 19.08.1997 (why this row?)
>> CZ 19.08.1997 (why this row?)
>>
>> -= Mika =-
Received on Mon Nov 30 1998 - 20:17:37 CET

Original text of this message