-501 Referenced cursor is not open
The cursor referenced has been declared, but is not open.
Open the cursor prior to cursor processing. If not explicitly closed (i.e., CLOSE request, COMMIT request, or an explicit ABORT/ROLLBACK request), verify that an implicit rollback did not occur. (An implicit rollback closes all open cursors associated with the current transaction.)