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?

asked a year ago900 views
1 Answer
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
EXPERT
answered a year ago
  • Hi @sdtslmn thanks so much for responding! We need the data to be in decimal for calculations. Is that not possible?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions