1

I have quite complex stored procedure in MSSQL database that returns no value (just default integer code) and has select statement that produces single string ('OK' or error message).

I can see this result in Management Studio's Results tab executing procedure with exec my_procedure 'param1', 'param2'. However, when I try to execute this query with jdbc boolean resultExist = preparedStatement.execute(sqlString), I get my resultExist variable set to false and no result set is available.

Is there any way to obtain result produced by stored procedure without changing it?

2
  • have you tried debugging your code to see what result is returned after execution of stored procedure? Commented May 28, 2015 at 10:05
  • @AbubakkarRangara Yes, I have, and initial ResultSet is always null. Commented May 28, 2015 at 11:14

1 Answer 1

1

Stored procedures can return multiple ResultSets. See here for sample code to access all ResultSets.

Sign up to request clarification or add additional context in comments.

3 Comments

What's your sproc look like? Does it have output parameters? If so you might need to use CallableStatement.registerOutParameter(...)
no, it doesn't have any output parameters, just the statement select @MSG as [result], which is considered as a result tuple by MS Server, but not by JDBC.
Can squlrrel sql see the resultset? If so, it can be accessed via jdbc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.