| how to implement thousand separator from sql [message #33247] |
Tue, 28 September 2004 23:45  |
krs
Messages: 9 Registered: November 2001
|
Junior Member |
|
|
Hi,
I have a table TB1 with COL1 as column.
tb1.col1
---------
1234567.567
3456878.345
458937939
Now i want to read the records with comma as thousand separator. How to write the sql.
eg: select to_char(col1,.......) from tb1.
col1
----
1,234,567.567
3,456,878.345
458,937,939
Any help is appreciated.
|
|
|
|
| Re: how to implement thousand separator from sql [message #33248 is a reply to message #33247] |
Wed, 29 September 2004 03:12   |
raviranjan
Messages: 41 Registered: April 2004
|
Member |
|
|
it would help u.....
select to_char('3234566777','999,999,999,999.99')from dual
TO_CHAR('3234566777','999,999,
3,234,566,777.00
|
|
|
|
| Re: how to implement thousand separator from sql [message #33252 is a reply to message #33247] |
Wed, 29 September 2004 05:00   |
Art Metzer
Messages: 2480 Registered: December 2002
|
Senior Member |
|
|
A safer approach would be to use this table's generic group separator (G) and decimal character (D), since the use of commas and periods varies by NLS_TERRITORY setting:
----------------------------------------------------------------------
SQL> SELECT value
2 FROM v$nls_parameters
3 WHERE parameter = 'NLS_TERRITORY'
4 /
VALUE
----------------------------------------------------------------
AMERICA
SQL> SELECT TO_CHAR(9876543201 / 100,'999G999G990D00') amt
2 FROM DUAL
3 /
AMT
---------------
98,765,432.01
SQL> ALTER SESSION SET NLS_TERRITORY='GERMANY'
2 /
Session altered.
SQL> SELECT TO_CHAR(9876543201 / 100,'999G999G990D00') amt
2 FROM DUAL
3 /
AMT
---------------
98.765.432,01
SQL>
|
|
|
|
|
|