Ibatis+Oracle: How to update a float value
I'm trying to update a float value in oracle database, but the saved value is only the integer part of the 开发者_运维百科float value.
I'm using the expression
update TABLE
SET VALUE = #value:NUMERIC#
WHERE ID = #id#
The Value is defined as Number(19,4) NULL
Most likely you are trying to update a column of data type NUMBER(p) with a floating point value.
For example, If I create a table with a column type of NUMBER(2) and try to insert 10.2 into that column the actual value that gets inserted is 10. Try this.
CREATE TABLE t
( a NUMBER(2)
);
INSERT INTO t VALUES
(10.2
);
SELECT * FROM t;
The output would be 10. If you want to save floating point values into the column change its datatype to just 'NUMBER' or if you are sure about the precision and scale of the floating point values, you can use NUMBER(p,s).Read about NUMBER type here
精彩评论