Re: Problem with to_char function

From: Rick <Rick.UK_at_btinternet.com>
Date: Fri, 27 Nov 1998 10:11:47 -0800
Message-ID: <365EEB63.2135_at_btinternet.com>


[Quoted] 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 Fri Nov 27 1998 - 19:11:47 CET

Original text of this message