Re: working with dates in oracle
From: Walt <walt_at_boatnerd.com.invalid>
Date: Mon, 28 Jul 2003 10:08:34 -0400
Message-ID: <3F252E62.EC478B30_at_boatnerd.com.invalid>
Date: Mon, 28 Jul 2003 10:08:34 -0400
Message-ID: <3F252E62.EC478B30_at_boatnerd.com.invalid>
andrewst wrote:
> Originally posted by Kuljeet
> > try-->
> > select f1,f2 from tablea where to_char(lastdate,'DD/MM/YYYY') >=
> > '01/01/2002';
> NO! See Jim Kennedy's answer for the correct approach. The above does
> a string comparison, and will say that '02/01/1999' is greater than
> '01/01/2002'!
And it'll be much slower since you're applying the to_char() function for each row in the table, instead of just applying the to_date() function once.
Of course, the bigger problem is the accuracy, not the performance...
-- //-Walt // //Received on Mon Jul 28 2003 - 16:08:34 CEST