Language cursors

On Adaptive Server, a language cursor is declared with the declare cursor statement, opened with an open statement, and fetched from using fetch statements. See the Sybase Adaptive Server Enterprise Reference Manual for descriptions of these commands. A Client-Library program can send all of these statements as normal language commands.

Once a language cursor has been declared and opened, each fetch language command returns a set of regular rows (ct_results result_type is CS_ROW_RESULT) and can be handled just like the results of a select command (see “Processing regular row results”). As with any other language command, the results of each command must be processed with ct_results (and ct_fetch, if necessary) before another command can be sent on the connection.

When declared within a language command sent by a client connection, a language cursor has scope limited to that connection. In other words, only language commands sent over the same connection can reference the cursor.

Language cursors provide the following advantage over Client-Library cursors:

The Adaptive Server Enterprise Reference Manual contains more detailed information on language cursors.