SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-228
UPDATE Statement
value of the update source expression (or NULL). The data type of each target
column must be compatible with the data type of its source value.
If you include a rowset search condition in the WHERE clause, you can use a
rowset expression in set-clause, but it is not required. If the rowset sizes are
different in the SET and WHERE clause, the smaller of the two sizes is used, and
the remaining entries in the larger rowset are ignored. The rows selected by the
nth condition in the rowset search condition are updated by the nth expression in
the rowset expression in set-clause. See Rowset Search Condition on
page 6-104.
column-name
names a column in table to update. You cannot qualify or repeat a column
name. You cannot update the value of a column that is part of the primary key.
expression
is an SQL value expression that specifies a value for the column. The
expression cannot contain an aggregate function defined on a column. The
data type of expression must be compatible with the data type of
column-name. A scalar subquery in expression cannot refer to the table
being updated.
If expression refers to columns being updated, NonStop SQL/MX uses the
original values to evaluate the expression and determine the new value.
See Expressions on page 6-37.
rowset-expression
is an array of SQL value expressions that specifies values for the column. A
rowset-expression can appear in the SET clause only when a
rowset-search-condition is present in the WHERE clause. When you
use a rowset-search-condition, there are two alternatives for the
set-clause expression:
Scalar host variables only. In this case, all rows in the result table are
updated with identical values, obtained by evaluating the scalar
expression.
Some array host variables. In this case, if the size of the array does not
match the size of arrays used in the WHERE clause search-
condition., the smaller value is used. All rows returned as a result of the
first element in the search-condition array are updated using the value
obtained by evaluating the first element in the set-clause array. All rows
in the result table returned as a result of the second element in the
search-condition array are updated using the second element in the
set-clause array, and so on.
For details on using host variables and rowsets, see the SQL/MX Programming
Manual for C and COBOL.
Embed
Embed