java - When I insert 78.9 into Mysql (using JDBC) it gets rounded up to 79? Is this normal -
When I put 78.9 in MySQL (using JDBC) it gets up to 79 goals? This is normal ... if so, how can I stop it?
More information:
Column name: num
Data type: decimal (12,0)
* the above items to phpMyAdmin
The query is
stmt.executeUpdate ("TRANS (INSERT IN triples (sub_id), PRO_ID, number) value (" + Subid + "," + Proid + ", 78.9)"); Ideally I would use a variable instead of hard-coded 78.9
BigDecimal obj = New BigDecimal (78.9 );
You have to set the datatype of the column that you
> float (x, y)
or
decimal (x, y)
Where x is the total number of digits and y is the total number of decimal.
For example Float (5,2) - & gt; 325.46 decimals (10,5) - & gt; 42579.12345
Comments
Post a Comment