Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does jdbi support in/out parameter in procedure(for Oracle)? #1606

Open
joshua-jin opened this issue Sep 17, 2019 · 5 comments
Open

Does jdbi support in/out parameter in procedure(for Oracle)? #1606

joshua-jin opened this issue Sep 17, 2019 · 5 comments
Labels

Comments

@joshua-jin
Copy link

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 ?

@stevenschlansker
Copy link
Member

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.

@joshua-jin
Copy link
Author

joshua-jin commented Sep 29, 2019

@stevenschlansker Maybe I can fork your branch and try to fix this bug?

@stevenschlansker
Copy link
Member

Please feel free. I feel like it's close, but got distracted by other issues. I'll look more myself soon too.

@manish7-thakur
Copy link

manish7-thakur commented Jan 27, 2020

@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 ??

@schrieveslaach
Copy link

@joshua-jin, changing the order of binds worked for me. Have a look here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants