Single-Column Format
Use the single-column format to pair one column with a single expression.
Element | Description | Restrictions | Syntax |
---|---|---|---|
column | Column to be updated | Cannot be a serial data type | Identifier |
collection_var | Host or program variable | Must be declared as a collection data type | Language specific |
expression | Returns a value for column | Cannot contain aggregate functions | Expression |
singleton _select | Subquery that returns exactly one row | Returned subquery values must have a 1-to-1 correspondence with column list | SELECT statement |
You can use this syntax to update a column that has a ROW data type.
You can include any number of "single column = single expression" terms. The expression can be an SQL subquery (enclosed between parentheses) that returns a single row, provided that the corresponding column is of a data type that can store the value (or the set of values) from the row that the subquery returns.
To specify values of a ROW-type column in a SET clause, see Updating ROW-Type Columns. The following examples
illustrate the single-column format of the SET clause.
UPDATE customer SET address1 = '1111 Alder Court', city = 'Palo Alto', zipcode = '94301' WHERE customer_num = 103; UPDATE stock SET unit_price = unit_price * 1.07;