Updates the current row indicated by a cursor.
The current row addressed by the cursor is updated by assigning new values to the columns as specified in the SET clause.
See ALLOCATE CURSOR for a description of extended cursors.
If an extended cursor is used in an
UPDATE CURRENTstatement, the cursor is represented following these rules:
- If the
UPDATE CURRENTstatement is executed with static SQL, i.e. using
EXEC SQL, the extended cursor is represented by the host variable containing the cursor.
- If the
UPDATE CURRENTstatement is executed with dynamic SQL, the extended cursor must be represented by the cursor value contained in the host variable.
Values to be assigned to columns may be specified either as expressions or by using the keywords
DEFAULT. Expressions must have a data type compatible with the definition of the column to which they are assigned.
If column names are used in expressions, they must refer to columns in the table or view addressed in the
UPDATE CURRENTclause. The value specified by a column name in an expression is the value for the column in the row concerned before the update operation is performed.
expression, see Expressions.
search-condition, see Search Conditions.
UPDATEaccess to the appropriate columns in the table or view identified by the table name is required when the cursor used for the
UPDATE CURRENTstatement is opened. If
UPDATEaccess is not held, the cursor may be opened but
UPDATE CURRENTstatements will fail. Direct access to the base table is not required for an update operation on a view.
UPDATE CURRENTstatement is used on a primary key column of a table, the table must be stored in a databank with the
In a procedural usage context,
extended-cursor-namecannot be used to identify the cursor.
In a procedural usage context, the
UPDATE CURRENTstatement is only permitted if the procedure
MODIFIES SQL DATA, see CREATE PROCEDURE.
A row indicated by a
WITH HOLDcursor must have been fetched in the same transaction.
Column names on the left-hand side of the assignment operator in the
SETclause may not be qualified by the table name.
Columns may not be specified more than once on the left-hand side of the assignment operator in the
SETclause in a single
Expressions used in the
SETclause cannot refer to set functions.
UNIQUEconstraints in the table being updated may not be violated.
If columns are listed in the
FOR UPDATE OFclause of the cursor definition (described under
SELECT) they must match.
The table name specified in the
UPDATE CURRENTclause must be exactly the same as that in the
FROMclause of the
SELECTstatement used to declare the cursor. If a synonym is used in one of the statements, the same synonym must also be used in the other.
If the table name specified in the
UPDATEstatement is subject to any referential constraint, the values in the row to be updated must conform to that constraint. If a view defined
WITH CHECK OPTIONis to be updated, the values assigned to the columns must conform to the view definition.
UPDATE CURRENTstatement may not be used for read-only cursors.
Example... FETCH C1 INTO I_CHARGE_CODE,I_AMOUNT; IF I_CHARGE_CODE = '270' AND ... THEN UPDATE BILL SET AMOUNT = AMOUNT * 1.10 WHERE CURRENT OF C1; ...
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40