update-clause

The FOR UPDATE clause identifies the columns that can be targets in an assignment clause in a subsequent positioned UPDATE statement. Each column-name must be unqualified and must identify a column of the table or view identified in the first FROM clause of the fullselect.

Read syntax diagramSkip visual syntax diagramFOR UPDATEOF,column-name

If a FOR UPDATE clause is specified with a column-name list, and extended indicator variables are not enabled, then column-name must be an updatable column (SQLSTATE 42808).

If a FOR UPDATE clause is specified without a column-name list, then the implicit column-name list is determined as follows:
  • If extended indicator variables are enabled, all of the columns of the table or view identified in the first FROM clause of the fullselect are included.
  • If extended indicator variables are not enabled, all of the updatable columns of the table or view identified in the first FROM clause of the fullselect are included.
The FOR UPDATE clause cannot be used if one of the following conditions is true:
  • The cursor associated with the select-statement is not deletable .
  • One of the selected columns is a non-updatable column of a catalog table and the FOR UPDATE clause has not been used to exclude that column.

If the list of columns to be updated includes the partition key of a partitioned tabled, then all the qualifying rows are locked with a U-lock to avoid modifying the same row twice.