SAP Adaptive Server Enterprise Cursor statements

In embedded SQL, statements that retrieve data and statements that update data can both involve cursors.

Retrieval statements

The retrieval statements that involve cursors are:

  • DECLARE cursor_name CURSOR FOR ...

  • OPEN cursor_name

  • FETCH cursor_name INTO ...

  • CLOSE cursor_name

Update statements

The update statements that involve cursors are:

  • UPDATE ... WHERE CURRENT OF cursor_name

  • DELETE ... WHERE CURRENT OF cursor_name

Setting CursorUpdate to use updatable cursors

To use the UPDATE ... WHERE CURRENT OF or DELETE ... WHERE CURRENT OF statements, you must set the CursorUpdate DBParm parameter to 1 before declaring the cursor. (By default, CursorUpdate is set to 0.)

For example:

SQLCA.DBParm = "CursorUpdate = 1"

You can set the CursorUpdate parameter at any time before or after connecting to the database. You can also change its setting at any time.

See also

SAP Adaptive Server Enterprise Retrieval Using Cursors

SAP Adaptive Server Enterprise Closing the Cursor