If a database stored procedure returns a result set, it must be closed when processing is complete.
Closing a procedure looks the same as closing a cursor:
CLOSE emp_proc;
As with cursors, if a procedure executes successfully and returns at least one result set and is not closed, a result set is pending and no SQL commands other than the FETCH can be executed. Procedures with result sets should be closed as soon as possible.
You do not have to retrieve all the rows in a result set to close a request or procedure.