如何在oracle中更改数字格式? [英] How to change Number format in oracle?
问题描述
我需要根据配置文件中指定的区域性对应用程序进行全球化.
I have a requirement to globalize the application based on culture specified in config file.
我有Amounts和date值.我决定将其转换为查询本身.就像下面的
I have Amounts and date values .I decided to convert them in query itself.Like below
对于西班牙语智利Es-CL
:
对于日期格式为"dd-mm-yyyy",我将使用Select TO_CHAR(busdate,'dd-mm-yyyy') from itemTable.
for Date format is "dd-mm-yyyy" I will use Select TO_CHAR(busdate,'dd-mm-yyyy') from itemTable.
类似地,我想使用相同的金额Select to_char(Amount,'99.999.99,00') from table1.
Similarly i want to use same for the amounts Select to_char(Amount,'99.999.99,00') from table1.
但徒劳无功.
请向我建议达到要求的正确方法.
Please suggest me the right way to achive my requirement.
这些金额和日期格式可以使用,但是需要知道如何转换.
These amounts and date formats can be available.but need to know how to convert them.
我想在On_Data_bound事件中使用datagrids,但这仍然是性能问题.
I thought to use in On_Data_bound event for datagrids ,but still this will be a performance issue.
推荐答案
您将使用格式模型:
SQL> alter session set NLS_NUMERIC_CHARACTERS='.,';
Session altered
SQL> select to_char(123456789.01, 'fm999G999G990D00') from dual;
TO_CHAR(123456789.01,
---------------------
123,456,789.01
SQL> alter session set NLS_NUMERIC_CHARACTERS=', ';
Session altered
SQL> select to_char(123456789.01, 'fm999G999G990D00') from dual;
TO_CHAR(123456789.01,
---------------------
123 456 789,01
这篇关于如何在oracle中更改数字格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!