UPDATE (Searched)

Syntax

>>--EXEC SQL--.-------------------.---------------------->
              +-FOR :host_integer-+ 

 >-----.-------------.------UPDATE------.-table_name-.---->
       +-AT db_name--+                  +-view_name--+

          +------ ,--------+
          V                |
 >---SET--column_expression--.-------------------------.-->
                             +-WHERE search_conditions-+

 >----END-EXEC---><

Parameters

:host_integer The maximum number of host array elements processed. Must be declared as PIC S9(4) COMP-5
db_name The name of a database that has been declared using DECLARE DATABASE.
table_name The table to be updated.
view_name The view to be updated.
column_expression A value for a particular column name. This value can be an expression or a null value.
search_conditions Any valid expression that can follow the standard SQL WHERE clause.

Purpose

UPDATE is a standard SQL statement which is passed directly to the ODBC driver. See the documentation supplied with your ODBC driver for the exact syntax.

If you do not specify a WHERE clause, all the rows in the named table are updated.

If one of the host variables used in the WHERE clause or SET clause is an array, they must all be arrays.

Example:

     EXEC SQL
        UPDATE staff
        SET first_name = 'Jonathan'
        WHERE staff_id = 1
     END-EXEC

     MOVE 'Phil' TO NewName
     MOVE 1 TO targetID

     EXEC SQL
        UPDATE staff
        SET first_name = :NewName
        WHERE staff_id  = :targetID
     END-EXEC