db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: cant' get user defined function to work
Date Mon, 26 Sep 2005 16:08:15 GMT
Erik.Bengtson@intl.westernunion.com wrote:

> Deepa,
> 
> 
>>If you define a function using 'CREATE FUNCTION ...' and call it using
>>CALL {function} statement, you get the same error as above. To call a
>>function in Derby, either VALUES or SELECT has to be used.
>>e.g: VALUES JPOX_ASCII('a');
> 
> 
> 
> I use 
> SELECT 1 FROM TABLE WHERE JPOX_ASCII('a') = 55

ij> CREATE FUNCTION JPOX_ASCII(C CHAR(1)) RETURNS INTEGER

EXTERNAL NAME 'org.jpox.store.rdbms.adapter.Function.ascii'

CALLED ON NULL INPUT

LANGUAGE JAVA PARAMETER STYLE JAVA;
0 rows inserted/updated/deleted
ij> create table t (i int);
0 rows inserted/updated/deleted
ij> insert into t values(1);
1 row inserted/updated/deleted
ij> SELECT 1 FROM T WHERE JPOX_ASCII('a') = 55;
ERROR 42X51: The class 'org.jpox.store.rdbms.adapter.Function' does not
exist or
 is inaccessible. This can happen if the class is not public.
ERROR XJ001: Java exception: 'org.jpox.store.rdbms.adapter.Function:
java.lang.C
lassNotFoundException'.



So that works for me, I didn't put your java code in my classpath but
the error you are reporting (42Y03) is because the function defintion
cannot be found, it hasn't even started looking for the Java class at
that point.

Now if I change schema, I get the error you are reporting:

ij> create schema xxx;
0 rows inserted/updated/deleted
ij> set schema xxx;
0 rows inserted/updated/deleted
ij> SELECT 1 FROM app.T WHERE JPOX_ASCII('a') = 55;
ERROR 42Y03: 'JPOX_ASCII' is not recognized as a function or procedure.

That's why your problem looks like a schema issue.
Dan.


Mime
View raw message