Update rows

Use the UPDATE statement to change the contents of one or more existing rows of a table, according to the specifications of the SET clause. This statement takes two fundamentally different forms. One lets you assign specific values to columns by name; the other lets you assign a list of values (that might be returned by a SELECT statement) to a list of columns. In either case, if you are updating rows, and some of the columns have data integrity constraints, the data that you change must conform to the constraints placed on those columns. For more information, refer to Data integrity.

Note: An alternative to the UPDATE statement is the MERGE statement, which can use the same SET clause syntax as the UPDATE statement to modify one or more values in existing rows of a table. The MERGE statement performs an outer join of a source table and a target table, and then updates rows in the target table with values from the result set of the join for which the join predicate evaluates to TRUE. Values in the source table are unchanged by the MERGE statement. Besides updating rows, the MERGE statement can optionally combine both UPDATE and INSERT operations, or can combine both DELETE and INSERT operations without updating any rows. For more information about the syntax and the restrictions on Update merges, Delete merges, and Insert merges, see the description of the MERGE statement in the HCL OneDB™ Guide to SQL: Syntax.