Numeric (not integer or double precision) picture token Clarion+Postgresql

85 Views Asked by At

i need numeric mask like this:

100
101.1
102.123

Take maksimum given decimal places but if last digit is 0 trim it. Something like: @n-12_`2 but trim right 0 and . Ex:

x = 102.1230057::double precision
select rtrim(rtrim(round(x::numeric, 2)::text, '0'), '.')::numeric
2

There are 2 best solutions below

1
Carlos Gutiérrez On

If you don't need right aligned numbers, you can use @S10 (or the length you want).

0
riffrazor On

@P<#.##P style pictures might help.