"cursor" must be created with SELECT ... INTO TABLE (Error 1815)
You have tried to use a repackaged cursor as a source for another SELECT statement.
Some cursors cannot be used in successive queries.
Use the INTO TABLE clause of the SELECT - SQL statement instead.