visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
262 experts, 1140 registered users, 1616 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

We now celebrate our 5 years of existence and break our frequentation records... Here are the stats of those 5 years.

Databases :: Oracle :: oracle problem with TO_NUMBER


By: Nono Great Britain  Date: 10/04/2008 09:27:08  English French  Points: 20 Status: Answered
Quality : Excellent
I'm trying basic string-to-number conversion in Oracle and I've problems :

SQL> select to_number('1,4','999999,9') from dual; select to_number('1,4','999999,9') from dual * ERREUR à la ligne 1 : ORA-01722: Nombre non valide SQL> select to_number('1,4','9G9') from dual; select to_number('1,4','9G9') from dual * ERREUR à la ligne 1 : ORA-01722: Nombre non valide


If using the other decimal separator with the correct number of decimals :

SQL> select to_number('1.4','999999D9') from dual; TO_NUMBER('1.4','999999D9') --------------------------- 14



The result should be 1.4 !!!

How come Oracle can't understand something as basic as this ?

By: VGR Date: 10/04/2008 10:07:04 French English  Type : Answer
the solution :

SQL> select to_number('1,4','999999D9') from dual; TO_NUMBER('1,4','999999D9') --------------------------- 1,4


mauvais séparateur décimal ; cf NLS_NUMERIC_CHARACTERS
Donc oracle = caca, dangereux

Do register to be able to answer

 Add This Article To:
 del.icio.usDel.icio.us  diggDigg  googleGoogle  spurlSpurl
 blinkBlink  wongWong  simpySimpy  yahooY! MyWeb 
EContact
browser fav
page generated in 4541.597130 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page