Use the single-column format to pair one column with a single expression.
Single-Column Format: .-,--------------------------------------. V | |----column-- =--+-expression-------------+-+-------------------| +-(--singleton_select--)-+ +-NULL-------------------+ | (1) | '--------collection_var--'
Element | Description | Restrictions | Syntax |
---|---|---|---|
column | Column to be updated | Cannot be a serial data type | Identifier, p. 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, p. Expression |
singleton _select | Subquery that returns exactly one row | Returned subquery values must have a
1-to-1 correspondence with column list |
SELECT, p. SELECT |
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 (IDS). 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;Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]