Re: working with dates in oracle

From: andrewst <member14183_at_dbforums.com>
Date: Mon, 28 Jul 2003 09:42:00 +0000
Message-ID: <3156099.1059385320_at_dbforums.com>


Originally posted by Kuljeet
> rafel.coyle_at_pfshouston.com (UnixUser) wrote in message
> news:news:...
> > I need to write a query in oracle 8i that will allow me to
  select some
> > rows of date within a date range. In MSSQL I would do something
  like
> > "select f1,f2 from tablea where lastdate >= '01/01/2002'" . How
  do I
> > accomplish the same type of query in Oracle.
>
> 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'!

--
Posted via http://dbforums.com
Received on Mon Jul 28 2003 - 11:42:00 CEST

Original text of this message