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 and NLS parameters......don't understand

GusoraAug 9 2013 — edited Aug 12 2013

I am trying to get my head around the use of format elements and NLS parameters with TO_NUMBER and TBH am at my wits end. So I'm going to start with something simple. I've never bothered or had to bother with the third parameter 'nls params' for NLS settings and now that I have I really regret it.

This works even though the '.' and ',' characters are not in their normal positions....

SQL> SELECT TO_NUMBER(  '17.000,23', '999G999D99', 'nls_numeric_characters='',.'' ') FROM DUAL;

TO_NUMBER('17.000,23','999G999D99','NLS_NUMERIC_CHARACTERS='',.''')

-------------------------------------------------------------------

                                                           17000.2

So why is this version throwing up an error?   (I should say all I've changed is the order of ',' and '.' in the string)

SQL> SELECT TO_NUMBER(  '17,000.23', '999G999D99', 'nls_numeric_characters='',.'' ') FROM DUAL;

SELECT TO_NUMBER(  '17,000.23', '999G999D99', 'nls_numeric_characters='',.'' ') FROM DUAL

                   *

ERROR at line 1:

ORA-01722: invalid number

Also does the order of characters matter here  'nls_numeric_characters='',.'' ')  ?

I apologise but when marking code in my spl*plus CLI and trying to paste here as 'SQL insert' lines ended up missing or wrapping or line spacing changing seconds later. I ended up with one line written over the other and the missing lines only being visible when highlighted!!!

This post has been answered by odie_63 on Aug 9 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 9 2013
Added on Aug 9 2013
4 comments
4,891 views