format integer

From: ml(at)ft-c(dot)de
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: format integer
Date: 2021-01-24 14:57:02
Message-ID: f3f20234950352a5342a3f6d7fc96eca1f8ebba6.camel@ft-c.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I need a integer format with different decimal places
The integer should have 6 diggits. (or 7 or 8)

Example (6-diggits)
input -> output
123456.789 -> 123456
1234.56789 -> 1234.56
12.3456789 -> 12.3456

but when it is more then 10^6 then
12345678.9 -> 12345678 

Is there a pg function for this task?

Franz

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2021-01-24 16:06:27 Re: format integer
Previous Message Tom Lane 2021-01-23 21:50:10 Re: Question about WITH ORDINALITY and unnest