• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling stored procedure

 
Donna Reschke
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I need to call a stored procedure with 6 input parameters and 6 output parameters, how would I do this? Would it look like this?...
cstmt = con.prepareCall("{?, ?, ?, ?, ?, ? = CALL MKTDS22B (?, ?, ?, ?, ?, ?)}");
or this?...
cstmt = con.prepareCall("(CALL MKTDS22B (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?))" );
Please help! Thanks!
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this:
assume that in your stored procedure that the first 6 parameters are out parameters and the last 6 are in parameters(note, use curly braces in your prepareCall string):

cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
cstmt.registerOutParameter(2, java.sql.Types.INTEGER);
...
cstmt.registerOutParameter(6, java.sql.Types.VARCHAR);
cstmt.setString(7, "some string");
cstmt.setInt(8, 200145);
...
cstmt.setString(12, "some string");
cstmt.execute();
//process the results.[/code]
Jamie
 
prabhatis
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, sorry for the late posting . i was busy.
here is the soln,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic