SQL Language (MOSC)

MOSC Banner

Implicit conversion

edited Nov 15, 2014 10:00AM in SQL Language (MOSC) 6 commentsAnswered

Hi, I'm facing a strange behaviour with implicit convertion. It's not a real case, I'm just exploring the topic.

Look at the following simple selects, the first one runs fine, the second fires the exception:

   

SQL> select upper(100+234 || 'alfa') as C from dual;

C

-------

334ALFA

SQL> select upper('alfa'|| 100+234) as C from dual;

select upper('alfa'|| 100+234) as C from dual

                    *

ERROR at line 1:

ORA-01722: invalid number

I've found the problem the first time using functions, but it's a general topic:

SQL> select 123+4 ||'alfa' from dual;

123+4||

-------

127alfa

SQL> select 'alfa' || 1+2 from dual;

select 'alfa' || 1+2 from dual

               *

ERROR at line 1:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center