to_char(123456789, '999G999G999D99')
postgres=# SELECT to_char(123456789, '999G999G999D99') AS formatted,
postgres-# to_char(123456789, '999999999') AS just_digits,
postgres-# to_char(123456789, '00999999999') AS with_zeroes;
formatted | just_digits | with_zeroes
-----------------+-------------+--------------
123,456,789.00 | 123456789 | 00123456789
(1 row)
postgres=#
postgres=#
Related examples in the same category