On 1/2/06, Bernt M. Johnsen <[EMAIL PROTECTED]> wrote:
> >>>>>>>>>>>> Thomas Dudziak wrote (2005-12-25 16:18:14):
> > 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 ?
>
> I think you have found a bug. I experimented a bit and found that it
> works for values >= 1.0 but the result will be 0 for values < 1.0.
>
> pstmt.setObject(2, new BigDecimal("1.0"), Types.NUMERIC);
>
> works perefectly ok while
>
> pstmt.setObject(2, new BigDecimal("0.999999999"), Types.NUMERIC);
>
> is errouneous.
Shall I file a JIRA issue then ?
Tom