CURSOR_TYPE= Data Set Option

Specifies the cursor type for read only and updatable cursors.

Valid in: DATA and PROC steps (when accessing DBMS data using SAS/ACCESS software)
Category: Data Set Control
Alias: CURSOR= [Impala, SAP IQ]
Default: LIBNAME option value
Data source: Amazon Redshift, DB2 under UNIX and PC Hosts, Impala, Microsoft SQL Server, ODBC, OLE DB, PostgreSQL, SAP IQ
See: COMMAND_TIMEOUT= LIBNAME option, CURSOR_TYPE= LIBNAME option, KEYSET_SIZE= data set option [Microsoft SQL Server and ODBC]

Table of Contents

Syntax

Syntax Description

DYNAMIC

specifies that the cursor reflects all changes that are made to the rows in a result set as you move the cursor. The data values and the membership of rows in the cursor can change dynamically on each fetch.

Note: This value is not valid for Impala.

FORWARD_ONLY

specifies that the cursor functions like a DYNAMIC cursor except that it supports only sequential fetching of rows.

Note: This value is not valid for OLE DB.

KEYSET_DRIVEN

specifies that the cursor determines which rows belong to the result set when the cursor is opened. However, changes that are made to these rows are reflected as you move the cursor.

Note: This value is not valid for Impala.

STATIC

specifies that the cursor builds the complete result set when the cursor is opened. No changes made to the rows in the result set after the cursor is opened are reflected in the cursor. Static cursors are read-only.

Details

Not all drivers support all cursor types. An error is returned if the specified cursor type is not supported. The driver is allowed to modify the default without an error. See your database documentation for more information.

When no options have been specified yet, here are the initial DBMS-specific default values.

DBMS-Specific Defaults for CURSOR_TYPE=

DB2 for UNIX and PC

Microsoft SQL Server

ODBC

OLE DB

Amazon Redshift

PostgreSQL

SAP IQ

KEYSET_DRIVEN

DYNAMIC

FORWARD_ONLY

FORWARD_ONLY

DYNAMIC

Here are the operation-specific defaults.

Operation-Specific Defaults for CURSOR_TYPE=

Operation

DB2 for UNIX and PC

Microsoft SQL Server

ODBC, SAP IQ

OLE DB

insert

(UPDATE_SQL=NO)

KEYSET_DRIVEN

DYNAMIC

KEYSET_DRIVEN

FORWARD_ONLY

read

(such as PROC PRINT)

driver default

driver default

(FORWARD_ONLY)

update

(UPDATE_SQL=NO)

KEYSET_DRIVEN

DYNAMIC

KEYSET_DRIVEN

FORWARD_ONLY

CONNECTION=GLOBAL

CONNECTION=SHARED

DYNAMIC

DYNAMIC

OLE DB: Here are the OLE DB properties that are applied to an open rowset. For details, see your OLE DB programmer reference documentation.

OLE DB Properties for Rowsets

CURSOR_TYPE=

OLE DB Properties Applied

FORWARD_ONLY or DYNAMIC (see “Details”)

DBPROP_OTHERINSERT=TRUE, DBPROP_OTHERUPDATEDELETE=TRUE

KEYSET_DRIVEN

DBPROP_OTHERINSERT=FALSE, DBPROP_OTHERUPDATEDELETE=TRUE

STATIC

DBPROP_OTHERINSERT=FALSE, DBPROP_OTHERUPDATEDELETE=FALSE

Last updated: February 3, 2026