db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: [PATCH] (DERBY-582) Dynamic parameter should be allowed to be the operand of unary operator "-". Derby throws exception 42X36: The '-' operator is not allowed to take a ? parameter as an operand."
Date Wed, 28 Sep 2005 14:21:06 GMT
Mamta Satoor wrote:

> Hi Dan,
>  
> I will look to see if the type of the unary minus/plus dynamic parameter
> can be determined by the context in which it is getting used.

Thanks, my concern is that with always binding the parameter to DOUBLE
it means that these two sql statements are not equivalent.

select * from t1 where c11 = ?
select * from t1 where c11 = +?

Which I would expect them to be. The subtle difference comes when c11 is
a DECIMAL, the application provides a precise value for the parameter
and in the first statement (c11=?) the comparision is using precise
values. In the second case (c11=+?) the application's precise value
would be converted to an imprecise value and then compared to a precise
value. This lose of precision may cause bugs in the application.
Or if the -? or +? was always a double and used in an insert statement,
then the potential for the wrong value to be inserted exists.

Dan.


Mime
View raw message