wood burning stoves 2.0*
The moose likes JDBC and the fly likes Can I call CallableStatement .getObject(int) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can I call CallableStatement .getObject(int)" Watch "Can I call CallableStatement .getObject(int)" New topic

Can I call CallableStatement .getObject(int)

Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
I caught an "SQLException: Invalid column index" from the following code and was wondering whether someone would know can I call CallableStatement.getObject(int) in the first place? (the javadocs don't say anything about not being allowed to call that)

The stack trace looks like this:

Have I understood the meaning of CallableStatement.getObject(int) wrong? Is it supposed to return the parameter set with the corresponding setXXX(int) method or is it supposed to return one of the return values of the stored procedure? If it's the latter, then is there any other way of getting the parameters out of the CallableStatement once they've been set?

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
you need to do a registerOutputParameter() first. Post the header of your pl/sql proceedure if that doesn't work (I imagine in/out might be the problem if you already do that).
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Thanks Simon. Unfortunately I can't use the registerOutParameter(...) method so I'll have to resort to some other means...
I agree. Here's the link: http://aspose.com/file-tools
subject: Can I call CallableStatement .getObject(int)
Similar Threads
problem using hibernate and stored procedures for reading portion of data from database
Passing Array as a parameter to Stored procedures
calling stored function
Determine the Callable Statements Parameters at runtime
Internal Error:Invalid index for data access