db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: Arithmetic operations and PreparedStatments
Date Wed, 02 Feb 2011 14:48:49 GMT
> update T_Professor set weight_In_B_D = ((((weight_In_B_D + ?) - ?) *
> ?) / ?) where (id = ?)

I'm not sure why the arithmetic is carried out using different
intermediate scale and precision when you use dynamically substituted
values for the constants in your expressions.

Did you try using the SQL CAST() operator? Does that help at all?

There might be a way to use Derby stored procedures to enable you
to implement the numeric processing in your own Java code, rather
than in SQL, which could be a workaround.

The behavior you are seeing has the feel of a bug, though it's
certainly possible it could be defined SQL language behavior. But since
you have such a nicely-constructed test program, I think you should
file your issue in the Derby bug-tracking system so that the developers
can analyze it in more detail.




View raw message