wood burning stoves*
The moose likes JDBC and the fly likes how to access an IN OUT parameter ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to access an IN OUT parameter ?" Watch "how to access an IN OUT parameter ?" New topic
Author

how to access an IN OUT parameter ?

Dilip Maddi
Greenhorn

Joined: Nov 17, 2003
Posts: 3
Through a CallableStatment i had invoked a database procedure accepting a parameter of IN OUT type.
CallableStatement cs = conn.prepareCall("{call PROC(?1)}");
I had passes an BigDecimal for an IN OUT parameter of number type

BigDecimal bd = new BigDecimal(20);
cs.setBigDecimal(1,bd);
cs.execute();
System.out.println(" update value "+bd);

After executing the callable statement I had printed the big-decimal value
Sadly it had printed me the old value instead of new value.


Can anyone of you help with an example ?
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
I believe that all you need to do is add: cs.registerOutParameter(1, java.sql.Types.BIGINT); (or whatever java type is appropriate for your database) before you do the "cs.execute()". You still need the cs.setBigDecimal() call. In other words you do both since it's both an input and output parameter.
 
jQuery in Action, 2nd edition
 
subject: how to access an IN OUT parameter ?
 
Similar Threads
Convert String to BigDecimal
Class cast on Object Array
BigDecimal issue
Rounding using BigDecimal
converting float hex to int