Updates a DataTable either by using a standard SQL WHERE clause or by replacement via a host variable array.
Syntax, Format 1:
>>--EXEC ADO--.-------------------.---UPDATE—datatable_name--------->
+-USING dataset_name+
+----------- , -----------+
V |
>--SET---column_name = -+- :hvar-----+------------------------------>
-+- col_value-+
>-.------------------------------------.—.-------------------------.>
+-FOR-.-ADDED-------------.-DATAROWS-+ +-WHERE search_conditions-+
+-CURRENT-----------+
+-DELETED-----------+
+-MODIFIED CURRENT--+
+-MODIFIED ORIGINAL-+
+-ORIGINAL----------+
+-UNCHANGED---------+
>--END-EXEC-><
Syntax, Format 2:
>>--EXEC ADO--.-------------------.---FOR :host_integer UPDATE—------->
+-USING dataset_name+
+----------- , -----------+
V |
>-- datatable_name SET---column_name = -+- :hvar-----+----END-EXEC-><
Parameters:
dataset_name
|
The DataSet reference to be used. If you do not specify
dataset_name, the current DataSet is used.
|
datatable_name
|
The name of the DataTable to be updated.
|
column_name
|
The name of a column in a DataTable.
|
:hvar
|
Host variable that contains the column value.
|
col_value
|
The column value.
|
FOR DATAROWS
|
The row state of the DataRows to be updated.
|
search_condition
|
Any valid expression that can follow the standard SQL WHERE clause.
|
:host_integer
|
A host variable that specifies the maximum number of host array elements processed. Must be declared as PIC S9(4) COMP-5 or
PIC S9(9) COMP-5.
|
Example:
EXEC ADO
UPDATE Customers
SET
ContactName = 'Alan Jones',
ContactTitle = 'Managing Director',
City = 'Norwich'
WHERE CustomerID = 'ZZZZ2'
END-EXEC
Comments:
This statement is similar to the embedded EXEC SQL UPDATE (SEARCHED) statement.
After execution, SQLERRD(3) contains the number of elements processed. For UPDATE it is the total number of rows updated.