MartinusP MartinusP - 3 months ago 21
SQL Question

Teradata formatting amounts of money

I have a problem with formatting, I exports data of the amount of money balances to excel, but I have a bad format.

SELECT COALESCE(TRIM(CAST(ZEROIFNULL(balance) AS DECIMAL(15,2) FORMAT '--Z(15)D9(2)')), 0);


I would like to change the character dot on the comma and when the balance is equal to 0 to display 0,00 because now I have a .00

Is it possible without changes to VARCHAR ?

Thanks in advance for your help

Answer

It will be easier when you switch to TO_CHAR instead of a FORMAT:

to_char(coalesce(balance,0),'999999999999990,99', 'NLS_NUMERIC_CHARACTERS = ''.,''')
Comments