Restrictions for using fetch.
Before you can use fetch, you must declare the cursor and open it.
You can use fetch with an archive database.
The cursor_name cannot be a Transact-SQL parameter or local variable.
For nonscrollable cursors, you cannot fetch a row that has already been fetched. There is no way to backtrack through the result set, but you can close and reopen the cursor to create the cursor result set again and start from the beginning.
The SAP ASE server expects a one-to-one correspondence between the variables in the fetch_target_list and the target list expressions specified by the select statement that defines the cursor. The datatypes of the variables or parameters must be compatible with the datatypes of the columns in the cursor result set.
When you set chained transaction mode, the SAP ASE server implicitly begins a transaction with the fetch statement if no transaction is currently active. However, this situation occurs only when you set the close on endtran option and the cursor remains open after the end of the transaction that initially opened it, since the open statement also automatically begins a transaction.