Daniel John Debrunner wrote: > Jean T. Anderson wrote: >> ... >>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. > > > That FAQ is a bit out of date (I think, I can't see it now, get timeouts > connecting to the site). > > There are two options for a function: > > 1) Declare the function RETURNS NULL ON NULL INPUT, this means that if > any parameter is NULL the result is NULL and the Java method is never > called. There are a couple of bugs outstanding on this which will be > fixed in 10.2. > http://issues.apache.org/jira/browse/DERBY-479 > http://issues.apache.org/jira/browse/DERBY-1030 > > CREATE FUNCTION DoubleFormat (value FLOAT, > places INTEGER) > RETURNS FLOAT > PARAMETER STYLE Java > LANGUAGE Java > RETURNS NULL ON NULL INPUT > EXTERNAL NAME 'utils.Utils.derbyDouble' > > 2) In the external name clause define the Java method signature, e.g. > > CREATE FUNCTION DoubleFormat (value FLOAT, > places INTEGER) > RETURNS FLOAT > PARAMETER STYLE Java > LANGUAGE Java > EXTERNAL NAME > 'utils.Utils.derbyDouble(java.lang.Float,java.lang.Integer)' > > This will then resolve to the method with that signature (assuming it > exists). > > Method signature support was added in 10.1.
thanks! I'll update the FAQ. -jean
