When you are finished with the result set of a cursor, you can close it using:
close cursor_name
Closing a cursor does not change its definition. If you reopen a cursor, Adaptive Server creates a new cursor result set using the same query as before. For example:
close authors_crsr open authors_crsr
You can then fetch from authors_crsr, starting from the beginning of its cursor result set. Any conditions associated with that cursor (such as the number of rows fetched defined by set cursor rows) remain in effect.
To discard a cursor, you must deallocate it using:
deallocate cursor cursor_name
In Adaptive Server 15.0 and later, the word cursor is optional.
Deallocating a cursor frees any resources associated with the cursor, including the cursor name. You cannot reuse a cursor name until you deallocate it. If you deallocate an open cursor, Adaptive Server automatically closes it. Terminating a client connection to a server also closes and deallocates any open cursors.