在Oracle中使用逗号分割金额 [英] Splitting amount using comma in oracle

查看:622
本文介绍了在Oracle中使用逗号分割金额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在oracle中,无论出现什么情况,我都需要使用逗号来分割金额,例如10,000和1,00,000.我需要分开.是否有任何解决方案可用于此.卡住了.我的结果集是1000和10000等.

In oracle i need to split amount using comma such as 10,000 and 1,00,000 whatever it comes. I need to split this. Is there any solution available for this. Am stuck with this. my result set is comes as 1000 and 10000 etc..

推荐答案

使用 TO_CHAR 和所需的数字格式.

Use TO_CHAR and desired number format.

SQL> with data(num) as(
  2  select 100 from dual union
  3  select 1000 from dual union
  4  select 10000 from dual union
  5  select 1000000 from dual
  6  )
  7  SELECT TO_CHAR(num, '9,999,999') FROM data;

此外,在 SQL * Plus 中,存在默认的数字格式.您可以按照所需的格式设置numformat:

Also, in SQL*Plus there is a default number format. You could set numformat as per your desired format:

SQL> set numformat 9,99,999
SQL> SELECT 100000 FROM DUAL;

   100000
---------
 1,00,000

TO_CHAR(NU
----------
       100
     1,000
    10,000
 1,000,000

这篇关于在Oracle中使用逗号分割金额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆