I have an Insert in a table (ex. field a1) which is a calculated value in a SELECT field01Value/1000000 .
How can I format the field to display 20 or more decimals after the operation.
I tried CAST(field01Value as double precision)/1000000 but the value is displayed as 2E-5.
Thanks!
2
Answers
Have you tried ROUND function ?
Seems duplicate :- How to round an average to 2 decimal places in PostgreSQL?
I suggest a cast to
numeric(precision, scale)
instead. Scale would be 20 in your case, and precision the maximum number of digits you would allow.Demo here : https://dbfiddle.uk/DLfdUN_Y