Consider the following overloaded Java methods called get_random in the UDFExample class:
public class UDFExample { ... public static int get_random( int some_value ) { ... } public static int get_random( java.sql.Date some_value ) { ... } ... }
The method names are the same, but the data type of the some_value parameter is distinct.
If the JAR file for the UDFExample class is called UDFExample.jar, the following statement registers UDFExample.jar and the UDFExample class with the database, and creates an SQL identifier called JarUDF for the JAR file:
CALL SQLJ.INSTALL_JAR('CJ!C:\udfsrc\UDFExample.jar','JarUDF',0);
Now consider the following function definitions that overload the scalar UDF name UDF_RAN:
CREATE FUNCTION UDF_RAN(SomeValue INTEGER) RETURNS INTEGER LANGUAGE JAVA NO SQL PARAMETER STYLE JAVA EXTERNAL NAME 'JarUDF:UDFExample.get_random(int)'; CREATE FUNCTION UDF_RAN(SomeValue DATE) RETURNS INTEGER LANGUAGE JAVA NO SQL PARAMETER STYLE JAVA EXTERNAL NAME 'JarUDF:UDFExample.get_random(java.sql.Date)';