2221 Cursor already open

Advantage Error Guide

Problem: An SQL script statement is attempting to open a cursor that is already opened.

Solution: Check the error message for the location of the error in the script. Make sure the OPEN statement at that location is not attempting to open a cursor that has been opened by a statement executed prior to this statement.