This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Registering IN OUT parameter

 
pioneer
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All -

I searched couple of books and searched on net but couldn't find the syntax I'm looking for. Hope you guys can help. I'm calling a oracle proc in my java app. The proc returns a cursor. Can you please guide to how to define the IN OUT parameter. Thanks






[ January 25, 2006: Message edited by: Dilip kumar ]
 
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to get the results from a stored procedure call, you must register any OUT or IN OUT
parameters before executing the CallableStatement. To do this, call the
CallableStatement object's registerOutParameter( ) method, passing it the position of
the placeholder character in the callable-statement string starting at 1 and moving from left to
right, just as you do for the other accessor methods, and a java.sql.Types constant to specify
the SQL data type that will be returned. There are two applicable signatures for the
registerOutParameter( ) method. For VARCHAR2 and DATE parameters, use the
following signature:
registerOutParameter(
int parameterIndex,
int sqlType)
throws SQLException

(Java Programming with Oracle JDBC ISBN: 0-596-00088-x, 496 pages)
 
Dilip kumar
pioneer
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response.

Looks like still something is wrong in my code. I'm getting error message
PLS-00306: wrong number or types of arguments in call to getValues

 
pioneer
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I notice that your OUT param 'TYPE lineCurs IS REF CURSOR RETURN lineItemRec' is of type REF CURSOR.
For Oracle, the param for registerOutParameter() is oracle.jdbc.driver.OracleTypes.CURSOR.
Check the driver JAR file for the apt type code.
 
Dilip kumar
pioneer
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much.

It worked when I used
csmt.registerOutParameter(14, OracleTypes.CURSOR);
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!