db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: unable to execute procedure
Date Wed, 05 Apr 2006 01:06:33 GMT
Anil Samuel wrote:

>>
>>So you can't use CALL for a function. I sent the examples of a function
>>use earlier, using the VALUES or SELECT statements.
>>
>>Dan.
> 
> 
> 
> I created a PROCEDURE using
> CREATE PROCEDURE dtp.TOTAL_LEAVE_FOR_TYPE (
>   EMPLOYEE CHAR(80),
>   LEAVE_TYPE_ID INT,
>   OUT TOTAL_LEAVE INT)
>         LANGUAGE JAVA
>         EXTERNAL NAME 'oracle.dtp.derby.sample.LeaveHelper.TotalLeaveForType'
>         PARAMETER STYLE JAVA;
> 
> not a FUNCTION.

I think it's because the second parameter is an OUT parameter and you
are passing a value in. To call a procedure with an INOUT or OUT
parameter you need to use a CallableStatement from a JDBC program, not ij.

However, this procedure definition does not match the Java code you
supplied, which is why I assumed you needed a CREATE FUNCTION. Your java
code takes in two (IN) parameters and returns a value.

A procedure needs to have a void return type, and OUT/INOUT parameters
are passed using a one element array of the required type.

>From what you are trying to to, it looks like a FUNCTION is what you need.

Dan.


Mime
View raw message