Reputation: 7476
Say I want to round all the values in a column to 2 decimal points. In the following example, I am expecting to update all the values to 111.27
:
First I update all the rows with a varchar
type
update someTable
set cash = '111.2659516';
Now I want to round all these values. If I cast the varchar
update someTable
set cash = round(cast(cash as double precision), 2);
I will get this as the result
111.27000000000001
111.27000000000001
111.27000000000001
111.27000000000001
If I don't cast the values, I will get this as the result
111
111
111
111
Any idea what I am doing wrong?
Upvotes: 0
Views: 166