QUEL Reference Guide > QUEL Reference Guide > QUEL and EQUEL Statements > REPLACE CURSOR--Update Column Values in a Table Row
Was this helpful?
REPLACE CURSOR--Update Column Values in a Table Row
Valid in: EQUEL
Updates values of columns in a single row in a table.
This statement has the following format:
## replace cursor cursor_name (target_list)
The replace cursor statement updates the values in the row currently pointed to by cursor_name. If the cursor is not pointing to a row, (for example, after an open cursor or a delete cursor statement), the DBMS Server displays an error message. If the row the cursor is pointing to has been deleted from the underlying database table (as the result of a non-cursor delete, for example), no row is updated. Replace cursor does not advance the cursor.
There are two update modes:
Deferred mode
Updates take effect when the cursor is closed. There can be only one cursor open in deferred mode at a time.
Direct mode
Updates are performed immediately. If you are using direct mode, avoid performing updates or deletes that change the order of rows because the sequence in which the cursor returns rows is affected.
If your application issues two cursor replace statements without advancing the cursor before the second (using retrieve cursor):
A direct update mode cursor updates the same row twice
A deferred update mode cursor does not perform the second update; an error message is issued
The cursor specified in the replace cursor must be open. The columns in the target list must have been declared for update and must be updatable. For example, you cannot update derived columns. See DECLARE CURSOR--Declare a Cursor.
If your host language supports the param version of the target list, see the Embedded QUEL Companion Guide for details.
Last modified date: 11/28/2023