Trailing Zeros for decimal (12,2) on redshift query editor.

0

I could not find any official AWS documentation that specifically addresses the display of trailing zeros for decimal values in the Redshift Query Editor. However, based on my testing and experience, it seems that the Query Editor does not display trailing zeros for decimal values by default. My reporting layer requires price based on columns with 2 point precision. However, the trailing zeros aren't available. Is there a way to save them as e.g. 21.00, 10.20?

posta un anno fa917 visualizzazioni
1 Risposta
3

Start with TO_CHAR function to format

https://docs.aws.amazon.com/redshift/latest/dg/r_TO_CHAR.html and https://docs.aws.amazon.com/redshift/latest/dg/r_Numeric_formating.html

and the following example can help you

SELECT TO_CHAR(your_decimal_column, 'FM9999999990.00') AS formatted_decimal
FROM your_table;
profile picture
ESPERTO
con risposta un anno fa
  • Hi @sdtslmn thanks so much for responding! We need the data to be in decimal for calculations. Is that not possible?

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande