Previous Topic: Searched UPDATENext Topic: Processing


Description

table-name or view-name

Specify the name of the table or view you want to update. You must name a table or view described in the Datadictionary, but not a Datadictionary table, a view of a Datadictionary table, or a read-only view.

correlation-name

You can specify a 1- to 18-byte correlation-name (correlation-name) to be used within the search-condition to designate the table or view.

SET

Introduces a list of column names and values.

column-name

Specify the names of the columns you want to update. The names must be separated by commas. You must name a column of the table or view you specified. Do not specify the name of the same column more than once and do not specify a column of any of the following types:

expression

Tells the new value of the column. The expression cannot include a function. See the CA Datacom/DB SQL User Guide for the expression's syntax diagram.

A column-name in an expression must name a column of the named table or view. For each row that is updated, the value of the column in the expression is the value of the column in the row before the row is updated. The following table shows a SET clause, the value of the columns in the row (before) and the resulting value (after) for each column:

SET clause

Value of X Before

Value of Y Before

Value of X After

Value of Y After

SET X = 10, Y = X + 1

1 3

1 5

1 10

1 4

NULL

Use the NULL keyword to specify that the value for the column is to be set to a null value.

WHERE

Introduces a condition that tells what rows are updated. You can omit the clause, give a search condition, or name a cursor. If you omit the clause, all rows of the table or view are updated.

search-condition

The search-condition is applied to each row of the table or view and the updated rows are those for which the result of the search-condition is true. the CA Datacom/DB SQL User Guide for the search-condition syntax diagram.

Each column-name in the search condition must name a column of the table or view, and the table or view must not be referenced in the FROM clause of any subselect in the search condition.

If the search condition contains a subquery, the subquery can be thought of as being executed each time the search condition is applied to a row, and the results used in applying the search condition. In actuality, the subquery is executed for each row only if it contains a correlated reference to a column of the table or view.