db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject setObject(idx, bigDecimal, Types.NUMERIC); doesn't work ?
Date Sun, 25 Dec 2005 15:18:14 GMT
When executing this code snippet:


Statement  stmt = conn.createStatement();

stmt.executeUpdate("CREATE TABLE test (\n"+
                   "    pk INTEGER NOT NULL,\n"+
                   "    value NUMERIC(15,7) NOT NULL,\n"+
                   "    PRIMARY KEY (pk)\n"+
                   ")");
stmt.close();

PreparedStatement pstmt = conn.prepareStatement("INSERT INTO test (pk,
value) VALUEs (?, ?)");

pstmt.setInt(1, 1);
pstmt.setObject(2, new BigDecimal("0.01"), Types.NUMERIC);

pstmt.execute();
pstmt.close();

conn.close();


the resulting value in the database is 0e-7, not 1e-2 as I would expect.
When changing that to


pstmt.setBigDecimal(2, new BigDecimal("0.01"));


it works though.
Did I make a mistake or is this a bug ?

Tom

Mime
View raw message