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: [Q] ORACLE date select problem?

Re: [Q] ORACLE date select problem?

From: Dennis Taylor <ismgr_at_pctc.com>
Date: Fri, 13 Oct 2000 08:00:08 -0700
Message-Id: <10648.119184@fatcity.com>


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

Original text of this message

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