Thanks Dan.

I overloaded the static method to match for the Procedure call and it seems to work just fine.

I think it would be nice-to-have a feature to add the jar file added by SQLJ.install_jar(..) automagically to the derby.database.classpath.

Regards
Anthos

On 4/5/06, Daniel John Debrunner <djd@apache.org> wrote:
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.




--
Anil Samuel <anil.samuel@oracle.com>
Senior Technical Member
Product Development
Oracle Corporation