Database Reference
In-Depth Information
12.2 Update Operations
The
Update
statement is used for updating rows of a table. The update may be on a single
row or a set of rows, depending on the condition specified in the
Where-Clause
. The
abridged general formats of the
Update
statement are shown below (Figure
12-2
):
Note:
1.
A scalar expression is any combination of columns, arithmetic
operators and SQL functions that evaluates to a scalar value
(i.e. a number or an alphanumeric value). More will be said
about SQL functions later.
2.
The first form of the update statement is applicable when
the update values are to come from literals that the user
(programmer) will supply, or other columns of the table, or a
combination of columns and literals.
3.
The second form of the update statement is used in an
embedded-SQL scenario, or where execution time prompt is
desired.
4.
Whenever a sub-query is specified within an update
statement (the third form), it must provide values for the
attributes to be updated.
Figure 12-2.
Abridged Form of the Update Statement