Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: [Q] ORACLE date select problem?
At 07:35 AM 10/13/00 -0800, you wrote:
>
> select account_id, datestamp from table1
> where to_char(datestamp,'DD-MON-YY') < '31-DEC-96';
>
>
>It still print date like '21_JAN-98'.
>
That's because '21-JAN-98' *IS* less than '31-DEC-96'. 2 is less than 3. Because you are converting to char (string), oracle is doing a text comparison. Instead, convert the '31-DEC-96' to a date and compare it directly with datestamp.
--- Dennis Taylor --- Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats.Received on Fri Oct 13 2000 - 10:00:08 CDT