You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Jim McNamara <3r...@verizon.net> on 2006/10/03 00:53:33 UTC

calling a function

hi-
 
I set up this function in squirellSQL.
 
CREATE FUNCTION DISTRIBTOTALAMOUNT() RETURNS DOUBLE PARAMETER STYLE JAVA

READS SQL DATA LANGUAGE JAVA EXTERNAL NAME
'bcalc.DistGetTotalAmount.getTotal'
 
if I try to call it in squirrelSQL like this call DISTRIBTOTALAMOUNT() I
get not
recognized as a function or a procedure.
 
but if I try to create it with the same syntax it tells me it exists.
 
also I don't see where it is viewable in the tree. maybe I am not
looking in the right place.
 
I tried it outside the squirrels realm and have the exact same results
for errors.
 
this is overkill as all I am doing is summing a couple of rows in a
table but I could
have done something interesting like java proc|function related instead
of reads sql data.  I am just trying it
out.  maybe I could move some more code outside of the GUI event
handlers using this trick.
 
Any help is appreciated!
thanks very much,
jim

RE: calling a function

Posted by Jim McNamara <3r...@verizon.net>.

-----Original Message-----
From: Dan J Debrunner [mailto:ddebrunner@sbcglobal.net] 
Sent: Monday, October 02, 2006 8:15 PM
To: Derby Discussion
Subject: Re: calling a function


Thanks Dan!
I think it will work now. 
Have a great week,
jim


--- Jim McNamara <3r...@verizon.net> wrote:

CALL is used for procedures, not functions.

You can use VALUES to execute a function like this:

VALUES DISTRIBTOTALAMOUNT()

This page might also help:

http://wiki.apache.org/db-derby/DerbySQLroutines

Dan.


Re: calling a function

Posted by Dan J Debrunner <dd...@sbcglobal.net>.

--- Jim McNamara <3r...@verizon.net> wrote:

> hi-
>  
> I set up this function in squirellSQL.
>  
> CREATE FUNCTION DISTRIBTOTALAMOUNT() RETURNS DOUBLE
> PARAMETER STYLE JAVA
> 
> READS SQL DATA LANGUAGE JAVA EXTERNAL NAME
> 'bcalc.DistGetTotalAmount.getTotal'
>  
> if I try to call it in squirrelSQL like this call
> DISTRIBTOTALAMOUNT() I
> get not
> recognized as a function or a procedure.

CALL is used for procedures, not functions.

You can use VALUES to execute a function like this:

VALUES DISTRIBTOTALAMOUNT()

This page might also help:

http://wiki.apache.org/db-derby/DerbySQLroutines

Dan.