Precision and scale 0 in metadata when using SUM-function
toukoNov 1 2007 — edited Nov 15 2009Hi,
I got problem with loss of precision & scale metadata when computing a sum (with JDBC).
The queries done are following (run through Sql*Plus)
SELECT ROW, CODE, A1 FROM DATA WHERE ROW = 'R1';
ROW CODE A1
-------------------- ------------------------- ----------
R1 YR1 123,25
R1 YR2 45
R1 KONS 0
And
SELECT SUM(A1) FROM DATA WHERE ROW = 'R1';
SUM(A1)
----------
168,25
When I'm doing same things with JDBC, the results for both queries and the metadata for the first query are fine. But for the second query, resulting metadata for the column has both precision and scale 0. (The column type is NUMERIC for numeric columns with both queries) Still, with detDouble I get that 168.25 as supposed.
So it seems to be that something is messed with the data type metadata when doing the SUM query or?
Or could it have something to do with locales etc? (Finnish way for decimal presentation is "168,25" when the "normal" way is "168.25") Still, works with the basic query without sum..
Java things used:
precision/scale got with OracleResultSetMetaData:getScale, OracleResultSetMetaData:getPrecision
Versions etc:
DB: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on Windows 2000
JDBC Drivers : I've tried JDBC Drivers 11.1.0.6.0, 10.2.0.2.0 and 10.2.0.3.0 - same with all of them (ojdbc14.jar and orai18n.jar just for sake)
Windows 2000, Java 6.