How to resolve the Postgresql Float precision issue

Submitted 3 years, 7 months ago
Ticket #173
Views 255
Language/Framework Postgresql
Priority Medium
Status Closed

I am facing some challenge to formatting the Float data type in Postgresql DB.

I have order table after I sum up it returns the rows like this,

3.469384874497004E9

But expected data should be 3469384874.97. How to return the data like this, as I have to concat this values for some other business purpose.

Submitted on Sep 18, 20
add a comment

1 Answer

Verified

Try this,

select
    sum(1032432234.00000000::decimal) some_column

So we need to cast as decimal to reflect all data as it is. So basically this will take all integers before precision and after precision as well.

Submitted 3 years, 7 months ago


Latest Blogs