db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Chaney (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DERBY-6483) JDBC setObject() on DECIMAL looses fractional part of value
Date Wed, 19 Feb 2014 11:25:19 GMT
Craig Chaney created DERBY-6483:
-----------------------------------

             Summary: JDBC setObject() on DECIMAL looses fractional part of value
                 Key: DERBY-6483
                 URL: https://issues.apache.org/jira/browse/DERBY-6483
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.8.2.2
            Reporter: Craig Chaney
            Priority: Minor


I have a table with a DECIMAL column:

ij> describe MODEL.WORK_ITEM_BIG_DECIMAL_EXTENSIONS;
COLUMN_NAME         |TYPE_NAME|DEC&|NUM&|COLUM&|COLUMN_DEF|CHAR_OCTE&|IS_NULL&
------------------------------------------------------------------------------
JZ_PARENT_ID        |CHAR     |NULL|NULL|23    |NULL      |46        |NO      
INTERNAL_ID         |CHAR     |NULL|NULL|23    |NULL      |46        |NO      
KEY_COL             |VARCHAR  |NULL|NULL|250   |NULL      |500       |NO      
VALUE               |DECIMAL  |4   |10  |28    |NULL      |NULL      |YES     

I use a prepared statement from the following SQL:
UPDATE MODEL.WORK_ITEM_BIG_DECIMAL_EXTENSIONS SET VALUE = ? WHERE INTERNAL_ID = ?

I set the first parameter like:
BigDecimal bd = new BigDecimal("123.456");
ps.setObject(1, bd, Types.DECIMAL);

This stores the incorrect value 123.0 into the database.

It works fine if I do instead:
ps.setBigDecimal(1, bd);



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message