If a database stored procedure returns a result set, it must be closed when processing is complete.
Do you have to retrieve all the rows?
You do not have to retrieve all rows in a result set to close a request or procedure.
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.
The procedure remains open until you close it, execute a COMMIT or a ROLLBACK, or end the database connection.