To_Number doubt
958205Sep 1 2012 — edited Sep 1 2012Hi 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