This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am trying to execute a stored procedure in a database using the prepareCall method. This is how I use it to call a procedure passing two paramters. connect.prepareCall("call procedure[(?,?)]}"); How do I change this if my procedure does not pass in any parameters but returns two parameters. I want to also go through a loop and assign what is returned to variables. THe first thing returned is a string, and the second argument returned is a float. Thank you.
no change. The only change is to declare the out parameters of the stored procedure ( different than return vals, but since you can only return one value, I assume you meant out parameters )
Chanpreet Julka
Ranch Hand
Joined: Nov 09, 2001
Posts: 40
posted
0
thank you
Chanpreet Julka
Ranch Hand
Joined: Nov 09, 2001
Posts: 40
posted
0
Here is the error I am getting java.sql.SQLException: JZ0SA: Prepared Statement: Input parameter not set, ind ex: 2. And here is the code.. CallableStatement cstmt = con.prepareCall("{ ? = call RET_ANT_NAME_UP_BY_MAX_VERSION[(?,?)]}"); cstmt.registerOutParameter ( 1, java.sql.Types.VARCHAR ); cstmt.registerOutParameter ( 2, java.sql.Types.FLOAT ); cstmt.execute(); String outParam1 = cstmt.getString( 1 ); float outParam2 = cstmt.getFloat( 2 ); I want to return two arguments from the stored procedure, and do not want to pass any inputs in to the procedure as parameters. Help please? Thanks