Does jdbi support in/out parameter in procedure(for Oracle)?
I have a procedure in Oracle like this:
procedure foo(v1 in number, v2 in char, v3 in out number );
and my java code is:
handle.bind("v1", 42)
.bind("v2", "Y")
.bind("v3", 99)
.registerOutParameter("v3", Types.INTEGER)
But when I get result for "v3", the value is always 0, and I follow the source code(not very carefully), I think jdbi will overwrite the parameter, when bind and registerOutParameter use the same name.
So is there any solution for invoking a procedure, when procedure has a paremeter is both in and out ?
I think you're right, this doesn't work right. Figuring out what's wrong is hampered by both the h2 and pg-jdbc drivers not fully supporting named callable parameters... I started hacking here https://github.com/jdbi/jdbi/tree/call-inout but no fix yet.
@stevenschlansker Maybe I can fork your branch and try to fix this bug?
Please feel free. I feel like it's close, but got distracted by other issues. I'll look more myself soon too.
@joshua-jin This generally happenes when you use select statement in stored procedure on db side to return a value, Try replacing your select with return statement if not already ??
@joshua-jin, changing the order of binds worked for me. Have a look here