开发者

PART 2 - Formate the double precisiont's as 0.00 in postgreSQL

开发者 https://www.devze.com 2023-01-04 19:24 出处:网络
SELECT trim(to_char(123,开发者_高级运维\'9999999999D99\')); 123.00 (1 row) SELECT trim(to_char(00,\'9999999999D99\'));

SELECT trim(to_char(123,开发者_高级运维'9999999999D99'));

123.00 (1 row)

SELECT trim(to_char(00,'9999999999D99'));

.00 (1 row)

I wrote the above query it giving the result as .00 if the amount is 0 (Zeor)? I need the output formate as 0.00. how to do this.

PART -1 Format double precision in PostgreSQL


Use a 0 instead of 9 of:

SELECT trim(to_char(00,'999999990D99'));


You need to use the following:

SELECT trim(to_char(00,'9999999990D99'));

The 0 sets a leading zero.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号