sagarswathi / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

FunctionAlias error when calling stored procedure where OUT parameter is not first #604

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Define a stored proc in oracle where the OUT parameter is listed last rather 
than first.
2. Define procedure in java using javax.persistence.NamedStoredProcedureQuery 
annotation
3. Create a H2 function alias for the stored proc
4. Call the procedure via jdbc while running against h2 implementation

What is the expected output? What do you see instead?
expected: function alias returns successfully
actual: Parameter Index error

Please use labels and text to provide additional information.

My stored proc takes 10 IN parameters and has 1 OUT param.
The error is being thrown by the checkIndexBounds validation in 
JDBCCallableStatement, line 1601, because parameterIndex is 11 and 
maxOutParameters is 1 

private void checkIndexBounds(int parameterIndex) {
        checkClosed();
        if (parameterIndex < 1 || parameterIndex > maxOutParameters) {
            throw DbException.getInvalidValueException("parameterIndex", parameterIndex);
        }
    }

I can call my aliased function successfully if I change the OUT parameter to be 
first in the NamedStoredProcedureQuery

Original issue reported on code.google.com by simonwielens@gmail.com on 3 Mar 2015 at 1:57

GoogleCodeExporter commented 8 years ago
If I step through the code in eclipse and change the value of 
maxOutputParameters to be greater than parameterIndex, the function returns 
correctly as well.

Original comment by simonwielens@gmail.com on 3 Mar 2015 at 2:21

GoogleCodeExporter commented 8 years ago
Sorry, javax.persistence.NamedStoredProcedureQuery is not supported, and there 
are no plans to support it on my side.

Original comment by thomas.t...@gmail.com on 12 Mar 2015 at 6:52

GoogleCodeExporter commented 8 years ago

Original comment by thomas.t...@gmail.com on 12 Mar 2015 at 6:53