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!!!