PL/SQL (MOSC)

MOSC Banner

Strange behaviour of "to_number"

edited Jun 24, 2012 9:37PM in PL/SQL (MOSC) 6 commentsAnswered ✓
Who can explain why
Select to_number(1) || '*'  From dual
gives me "1" and
Select to_char( to_number(1) ) From dual 
gives ORA-01481: invalid number format model?

Yes, I know that "1" is number, not varchar, but types are converted and if "Select to_number(1)" gives "1" and
"Select '*'" gives "*", so why their concatenation can't give "1*" :-) ?

One detail more: both "Select (to_number(1) || '*')" and "Select to_char( (to_number(1)) )" work fine.

 

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