db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oystein Grovlen - Sun Norway <Oystein.Grov...@Sun.COM>
Subject Re: unable to execute procedure
Date Wed, 05 Apr 2006 07:04:15 GMT
Daniel John Debrunner 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;
>>
>> 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.

The current behavior does not seem very user friendly.  Many compilers 
will in such situations give a message indicating that there are 
function(s) with this name, but the signature(s) does not match.  I 
think something like that would be very helpful in identifying the cause 
of the problem.

-- 
Øystein

Mime
View raw message