CursorType

Description

Supports the scrollable cursor feature introduced in Adaptive Server Enterprise 15.0, including directional scrolling (forwards and backwards) and sensitivity towards independent changes to table.

Applies to

Syntax

CursorType='value'

Parameter

Description

value

A string that specifies whether database cursors are scrollable and whether they are sensitive to modifications in data. Values are:

Default

CursorType='NonScrollable'

Usage

Adaptive Server Enterprise 15.0 allows both scrollable and nonscrollable cursors, which can be either semi-sensitive or insensitive. “Scrollable” means that you can scroll through the cursor result set by fetching any, or many, rows, rather than one row at a time; you can also scan the result set repeatedly. A scrollable cursor allows you to set the position of the cursor anywhere in the cursor result set for as long as the cursor is open.To use a scrollable cursor, you must use a DECLARE CursorName CURSOR SQL statement to declare it with a suitable SELECT statement, such as the PowerBuilder Dynamic SQL Format 3 and Dynamic SQL Format 4 statements, and you must have the query engine provided in Adaptive Server 15.0 or later.

For sensitive scrolling to work correctly, the table must have a clustered index or a clustered unique constraint, such as a clustered primary key.

All scrollable cursors are read-only and can only be used when the value of the CursorUpdate database parameter is 0 (the default). If you need an updatable cursor, set the CursorUpdate parameter to 1. When CursorUpdate is set to 1, the value of CursorType is ignored. All update cursors are nonscrollable.

If a scrollable cursor is moved to a position before the first row or after the last row, SQLCA.SQLCode returns 100 and no data is returned. However, users can continue to fetch data by using a suitable FETCH statement after receiving this SQLCode value.

Both client and server must be Adaptive Server 15.0 or higher.

Examples

Example 1

To specify support for semi-sensitive scrollable cursors (data modifications are presented when scrolling forwards):

See also

CursorUpdate