Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Programming » Application development using SQL

Cursor usage

When you execute a query in an application, the result set consists of several rows. In general, you do not know how many rows the application is going to receive before you execute the query.

Cursors provide a way of handling query result sets in applications. The way you use cursors and the kinds of cursors available to you depend on the programming interface you use.

Several system procedures are provided to help determine what cursors are in use for a connection, and what they contain:

  • sa_list_cursors system procedure
  • sa_describe_cursor system procedure
  • sa_copy_cursor_to_temp_table system procedure

With cursors, you can perform the following tasks within any programming interface:

  • Loop over the results of a query.

  • Perform inserts, updates, and deletes on the underlying data at any point within a result set.

In addition, some programming interfaces allow you to use special features to tune the way result sets return to your application, providing substantial performance benefits for your application.