Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Re: I must be missing the obvious

Re: I must be missing the obvious

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Fri, 02 Jul 2004 14:05:45 GMT
Message-ID: <ZYdFc.13364$wY5.11595@attbi_s54>

"Wit Serdakovskij" <wit_no_at_spam_dba.kiev.ua> wrote in message news:20040702104526.GA26790_at_tormoz.net...
> Hello, Joe,
>
> [...]
>
> > I get today 30-JUN-04. If there are 10 records in X including 3 from
> > today, why does
> >
> > 'select count(1) from X where datestamp < '01-JUL-04' return 10 but
> >
> > 'select count(1) from X where datestamp <= '30-JUN-04' returns 7?
>
> It's simple. Really your first query gets all the JUNE records. The second
> query gets record with datestamp less than '01-JUN-04 00:00:00' and
records
> with datestamp equal to '01-JUN-2004 00:00:00' (not with 01-JUN-04 with
some
> time portion). Again, '01-JUN-04 14:14:14' is greater than '01-JUN-04'.
>
> [...]
>
> Be careful with DD-MON-YY. Use DD-MON-RR (or DD-MON-YYYY) instead.
>
> --
> wbr,
> Wit.

Don't use an implicit conversion of a string to a date! Use to_date() instead. You have bug in your code just waiting to bite you. Jim Received on Fri Jul 02 2004 - 09:05:45 CDT

Original text of this message

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