IMPLICIT CONVERSION [message #441734] |
Tue, 02 February 2010 23:33  |
mohley_s
Messages: 10 Registered: January 2010 Location: bangalore, india
|
Junior Member |
|
|
Hi All,
(I am fresher to oracle database)
i have a small doubt..
oracle does implicit conversion of data types when we call some function. Implicit conversion to date happens for some given format.
I executed the SQl -
SELECT TO_CHAR('23-JUL-09','DD-MM-RR') FROM DUAL;
AND GOT ERROR:ORA-01722: invalid number
Why implict conversion is not taking place in this case.
NLS_DATE_FORMAT was DD-MON-RR
Please someone clear my doubt
thankyou,
Mohley Singh
[Updated on: Wed, 03 February 2010 00:20] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: IMPLICIT CONVERSION [message #441740 is a reply to message #441737] |
Wed, 03 February 2010 00:15   |
mohley_s
Messages: 10 Registered: January 2010 Location: bangalore, india
|
Junior Member |
|
|
when we give sql
select concat('123','345') from dual;
here also it makes no sense, but still implicit conversion from charecter to number is taking place.
so, why not in this(SELECT TO_CHAR('23-JUL-09','DD-MON-RR') FROM DUAL;) statement.
and when does implicit conversion from charecter to date happens or oracle does not support this implict conversion?
|
|
|
|
|
|
|
|
Re: IMPLICIT CONVERSION [message #441749 is a reply to message #441734] |
Wed, 03 February 2010 00:28   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
The cause of the error, despite what everyone is telling you, is that Oracle actually IS trying to do an implicit conversion.
However, to_char can take either a number or a date as (first) parameter. Oracle guessed wrong about which of the two you meant and tried to implicitly convert your string to a number.
|
|
|
|
|