• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calling stored procedure

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am calling a stored procedure(Oracle 9.2.04) from Java. My offshore team tested this code using stmt.registerOutParameter and it worked for them. Now at client site, it did not work. I changed it by setInt and it worked. Please let me know if it is a known bug.
============================================================
CallableStatement stmt=null;
try {
stmt= conn.prepareCall("call MoveToTemp(?)");
//stmt.registerOutParameter(1, Types.INTEGER, aiApplicationId);
stmt.setInt(1, aiApplicationId);
stmt.execute();
stmt.close();
} catch (Exception ex) {
ex.printStackTrace();
}
============================================================
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sanjeev,
It's difficult to say without seeing the stored procedure's signature, but there are a couple of things you can check.
The registerOutParameter() method is used to capture parameters that are defined as OUT parameters in the stored procedure. See if the procedure has an OUT parameter as the first parameter.
Also, I would guess if there is a OUT parameter, they would try to use the out parameter...check down in the code a little ways..do you see any calls that look like: int <varname> = stmt.getInt(1); ?
The code you commented out:
stmt.registerOutParameter(1, Types.INTEGER, aiApplicationId);
will compile but will fail at runtime if there isn't an OUT param in the proc @ position 1. This code tells the statement that there is an Out param in position 1 of type integer and with a scale of whatever aiApplicationId equates to.
Hope that helps.
Regards,
Matt
[ April 20, 2004: Message edited by: M Givney ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic