SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
U-3
UPDATE Statement
UPDATE Statement
UPDATE is a DML statement that updates rows of a table or protection view.
name
is the name (or an equivalent DEFINE) of the table or protection view to update.
name cannot be the name of a catalog table.
col
is the name of the column to update. You cannot qualify the column name, repeat a
column name, or specify the column of a primary key or clustering key.
exp
is an SQL expression that specifies a value for the column. exp can be a literal,
the keyword NULL (which indicates a null value), a host variable (possibly with an
indicator variable to specify a null value), or a parameter, but its data type
(including character set, if any) must be the same as that associated with the
column.
exp cannot include a subquery or an aggregate function, but it can refer to any
column in the row, including the SYSKEY column. (If exp refers to the column
being updated, SQL uses the prior value to evaluate the expression and determine
the new value.)
WHERE search-cond
specifies a search condition for selecting rows to update. Subqueries within
search-cond cannot refer to the table or view being updated. For more
information, see Search Conditions on page S-5.
[ FOR ] { STABLE | REPEATABLE } ACCESS
specifies the degree of consistency required while rows are compared to the
search condition; affects the type of locks SQL uses in the execution plan for the
UPDATE and the degree of concurrency for other applications:
UPDATE { name } SET col = exp [, col = exp ] ...
[ [| WHERE search-cond |] ]
[ [| |] ]
[ [| [FOR] {STABLE } ACCESS |] ]
[ [| {REPEATABLE} |] ]
[ ]
[ WHERE CURRENT OF cursor ]
STABLE specifies stable consistency; SQL uses locks of short duration.
REPEATABLE specifies repeatable consistency; SQL uses locks of long
duration.