Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Date ... Date ...Da
"moon" <only_forme4_at_hotmail.com> wrote in message
news:2afc1efd.0404141522.528bb030_at_posting.google.com...
> Hi All,
>
> I don't know why Oracle complicating the issue of implicit and
> explicit converion, I think if they follow the same pattern of Java
> then it would be much better to deal with. Whatever, My question is
> about the following parg I read from Oracle SQL REf. and it says the
> following:
>
> "During arithmetic operations on and comparisons between character and
> noncharacter datatypes, Oracle converts from any character datatype to
> a
> number, date, or rowid, as appropriate. In arithmetic operations
> between
> CHAR/VARCHAR2 and NCHAR/NVARCHAR2, Oracle converts to a number."
>
> According to the Ref this should executes successfuly:
>
> >select '12-AUG-19' - sysdate from dual
>
> but i got this error:
>
> >ORA-00932: inconsistent datatypes: expected CHAR got DATE
>
> Why ? Why?
>
> Thank you very much for your help in advance
>
> Note:
> The NLS_DATE_FORMAT is 'DD-MON-RR'
>
> :)
Don't make assumptions about converting strings to dates. (sysdate is a date
and '12-AUG-19' is a string) Instead do:
to_date('12-AUG-19' ,'dd-mmm-rr') Although to tell you the truth put in 4
didgit years. Much clearer, less chance of errors.
Oracle!=Java
Jim
Received on Wed Apr 14 2004 - 22:06:51 CDT
![]() |
![]() |