Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

To_Number doubt

958205Sep 1 2012 — edited Sep 1 2012
Hi Again guis,
i've got this other doubt, still on implicit conversions.. (!!!!)
i'm reading the book SQL Fundamentals 1 Exam Guide to prepare for the exam, at the end of each chapter there're some questions to prove your understanding and few pages after there're the answers. There's this question:

What value is returned after executing the following statement?

SELECT TO_NUMBER(1234.49, '999999.9') FROM DUAL;

this query raises an error because "the statement is trying to convert a number using an incompatible format mask. If the expresion was TO_NUMBER(1234,49,'999999.99') the number would be returned".
My question is: WHY??
TO_NUMBER function gets a string as its first parameter, so it implicitly converts 1234.49 to "1234.49", shouldn't it round up to the first decimal digit and return 1234,5?
just like a to_char would do?

thanks

Paolo
This post has been answered by Frank Kulash on Sep 1 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2012
Added on Sep 1 2012
21 comments
1,136 views