Update and Select statements in one Stored Procedure

When there are multiple update statements or delete statements in a stored procedure with a select statement at the end. If we execute this type of procedure, being a select statement at the end we expect a result set. Instead it will throw an SQLException : The statement did not return a result set.

This is because the update statements in the proecedure and it will return the number of rows updated, so it throws that exception.

Solution : In your procedure use SET NOCOUNT ON, it will remove the messages when rows were updated and you will get result set.