John English wrote:
> I have a function to round a Double to a specified number of decimal
> places:
>
> public static final Double derbyDouble (Double value, Integer places) {
> ...
> }
>
> I've declared it to Derby like so:
>
> CREATE FUNCTION DoubleFormat (value FLOAT,
> places INTEGER)
> RETURNS FLOAT
> PARAMETER STYLE Java
> LANGUAGE Java
> EXTERNAL NAME 'utils.Utils.derbyDouble';
>
> This works if I use "double" and "int" but not Double and Integer (as in,
> the methos is found & used corrrectly if I use primitive types but it isn't
> found if I use the corresponding wrapper types). I've also tried Float,
> which
> is no better.
>
> The big difference is that, using primitive types, I can't handle nulls...
>
> Anyone got any ideas whhat I'm doing wrong?
Derby maps a SQL INTEGER to Java int (a primitive) and passing SQL NULLs
isn't supported for primitive types. There's an FAQ on this at
http://db.apache.org/derby/faq.html#null_args that also points to the
mail list topic that fed the FAQ.
I hope this helps,
-jean