views:

26

answers:

1

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

A: 

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

johnbk
My column table is defined as Number(19,4). For now, I resolve my problem changing the java type from Float do Double.
Victor