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

Home -> Community -> Usenet -> c.d.o.server -> Re: Date functions

Re: Date functions

From: Richard Foote <Richard.Foote_at_bigpond.com>
Date: Tue, 20 Aug 2002 19:42:40 +1000
Message-ID: <3D620F10.B6348296@bigpond.com>


Hi Oliver,

You'll get an error if your database default data format doesn't match YYYY-MM-DD. Try:

select benutzer, round(anlagedatum)
from zeit_table
where round(sysdate)=round(to_date('2002-08-19', 'YYYY-MM-DD'));

Note this query will round the date to the nearest day and will return either no rows or all rows in zeit_table. Do you really want to do this ? Either way, it'll now work for sure (and that's why I would recommend explicitly formatting all such dates).

Cheers

Richard

Oliver Otto wrote:
>
> Hi,
>
> maybe someone can explain me this behavior of Oracle. I do not
> understand the documentation in this.
>
> Doing this :
>
> select benutzer, round(anlagedatum) from zeit_table;
>
> selects a a date from a datetime-column and the names of my users.
>
> Ding this:
>
> select benutzer, round(anlagedatum) from zeit_table where
> round(sysdate)=round('2002-08-19');
>
> result in an error ORA-001722: invalidate number. I do not understand
> this. Reading the Documentation I understand ROUND returning a date
> value. Is it not possible to compare the return values ..?!
>
> Maybe someone can give me a hind. Thanx a lot.
>
> Oliver
>
>
>
>
Received on Tue Aug 20 2002 - 04:42:40 CDT

Original text of this message

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