db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Lichtman <swa...@rcn.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 Thu, 29 Sep 2005 06:24:32 GMT

>I agree with your and Dan's point about possible precision loss. I 
>am trying to find a way where rather than hard coding the -?/+? to 
>Double, try to get it's datatype from the context where it is used.

There are circumstances where you can figure this out, but it's 
ambiguous in the general case. For example:

    where t1.int_column + ? = - ?

Since both sides of the "=" operator have parameters, you can't use 
the type of one side to figure out the type of the other side.

Here are some more examples of ambiguity:

    where t1.int_column = ? / - ?

    where - ? not in (select t1.int_column + ? from . . .)

I don't think it's a good idea to try to solve this problem at all. 
There are a few cases where it's obvious what the type should be, and 
many more where it's not. There's also an easy workaround (use the 
CAST function). Even if we were able to figure out an algorithm to 
determine the type of a parameter in all cases, would it be possible 
to explain the behavior to an average user?


                        -        Jeff Lichtman
                                 swazoo@rcn.com
                                 Check out Swazoo Koolak's Web Jukebox at
                                 http://swazoo.com/ 


Mime
View raw message