I created a table with a single column of REAL type:
CREATE TABLE test.mytable (a REAL NOT NULL);
The SQL type REAL is a 32-bit floating point type. Using JDBC, I tried
to insert the maximum value of a 32-bit floating point number, which
is Float.MAX_VALUE, into this table:
PreparedStatement ps = connection.prepareStatement("insert into
test.mytable (a) values (?)");
ps.setFloat(1, Float.MAX_VALUE);
ps.executeUpdate();
However, it failed with the following exception:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0302N The
value of
a host variable in the EXECUTE or OPEN statement is too large for its
correspond
ing use. SQLSTATE=22003
So it seems that the maximum value that a REAL column can store is
less than Float.MAX_VALUE. What is the maximum value then?
Thanks in advance.
Yong Sing