1

I have the following SQL Server stored procedure:

CREATE PROCEDURE MyProc
AS
BEGIN
    SELECT * FROM MyTable
END

When I run this procedure using SSMS it returns a result. However, when I call this stored procedure from Java code using CallableStatement it does not returning any result and throws the exception

Statement did not return any ResultSet

Update 1:

My Java code is

String sql = "{ call MyProc };";
CallableStatement cs = con.prepareCall(sql);
ResultSet rs = cs.executeQuery();
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
Mohammad Ashfaq
  • 1,333
  • 2
  • 14
  • 38

0 Answers0