db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dudgeon <tdudg...@informaticsmatters.com>
Subject varargs with functions
Date Thu, 19 Dec 2013 11:29:17 GMT
I'm struggling with getting a function working that uses a Java static 
method that uses varargs.
I understand this should work with 10.10.1.1?

I create function like this:

CREATE FUNCTION FORMAT_CPD_CODE
( FORMAT VARCHAR(100), VAL INT ... )
RETURNS VARCHAR(20)
PARAMETER STYLE DERBY
NO SQL LANGUAGE JAVA
EXTERNAL NAME 'java.lang.String.format'

and use it like this:

values(FORMAT_CPD_CODE('XYZ%08d', 123))


But I get error:

java.sql.SQLSyntaxErrorException: No method was found that matched the 
method call java.lang.String.format(java.lang.String, int...), tried all 
combinations of object and primitive types and any possible type 
conversion for any  parameters the method call may have. The method 
might exist but it is not public and/or static, or the parameter types 
are not method invocation convertible.

Any suggestions on how to get this working?

Thanks.

Tim


Mime
View raw message