在 DB2 中转换为货币或货币格式 [英] Convert to currency or money format in DB2
本文介绍了在 DB2 中转换为货币或货币格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一列数据类型为 dec (16,2)
的列,可能的值类似于 20000.00
.我想要以逗号分隔的货币或货币格式的结果,如下所示:20,000.00
.
I have a column of datatype dec (16,2)
with a possible value like 20000.00
.
I want the result in comma-separated currency or money format like this: 20,000.00
.
到目前为止,我计划将其除以 1000 并用逗号连接.但我想知道 DB2 是否具有隐藏这一点的内置功能.或任何其他更简单的将整数转换为货币格式的方法.
As of now I am planning to divide this by 1000's and concat with comma. But I want to know if DB2 has an inbuilt functionality to covert this. Or any other easier method to convert integer to currency format.
select A.Billing_Amount
from Transaction_Table A with ur;
推荐答案
你也可以试试:
select decimal(A.Billing_Amount,9,2) from Transaction_Table A with ur;
这篇关于在 DB2 中转换为货币或货币格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文