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:11:18 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;

Ok, I see now that you have three parameters here, missed that. Still an
OUT parameter does not map to the return of a Java method. Here is the
Java signature and code you need to match this procedure statement.

public static void TotalLeaveForType(String employee, int leaveTypeId,
int[] totalLeave)
{
   ....

   // replace 'return total' with
   totalLeave[0] = total;
}

A procedure can have any number of INOUT or OUT parameters, so there is
no natural mapping to the returned value of the method. I believe this
all matches the SQL Standard part 13, Java routines in SQL.

Sorry for the confusion,
Dan.


Mime
View raw message