问题
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
.
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;
回答1:
You can also try:
select decimal(A.Billing_Amount,9,2) from Transaction_Table A with ur;
回答2:
You can create a distinct UDT to store the column as currency type like the following:
CREATE DISTINCT TYPE CURRENCY AS DEC(15,2) WITH COMPARISONS;
来源:https://stackoverflow.com/questions/29852504/convert-to-currency-or-money-format-in-db2