UPDATE Statement

The UPDATE statement allows modifying the value of certain attributes in all tuples of a view that verify a certain condition, directly updating the underlying data source.

Syntax of the UPDATE statement
UPDATE <view identifier>
    SET ( <field name>[, <field name>]* ) = ( <value>[, <value>]* )
    [ WHERE <condition> ]
    [ CONTEXT ( <context information> [, <context information>]* ) ]
    [ TRACE ]
UPDATE <view identifier>
    SET <field name> = <value> [, <field name> = <value>]*
    [ WHERE <condition> ]
    [ CONTEXT ( <context information> [, <context information>]* ) ]
    [ TRACE ]

<field name> ::= <identifier>[.<identifier>]

<value> ::=
    NULL
  | <number>
  | <boolean>
  | <literal>
  | <field name>
  | <function>

<condition> ::=
    <condition> AND <condition>
  | <condition> OR <condition>
  | NOT <condition>
  | ( <condition> )
  | <value> <binary operator> <value> [ , <value> ]*
  | <value> <unary operator>

For example, the following statement updates the tuples of the internet_inc view whose value of iinc_id is 6, setting to 10 its value for the attributes specific_field1 and specific_field2:

UPDATE internet_inc
SET (specific_field1, specific_field2) = ('10', '10')
WHERE iinc_id = 6

As a result of executing this statement, the corresponding tuples in the source database will be altered in the table associated with the

internet_inc view.

It is also possible to use the alternative syntax:

UPDATE internet_inc
SET specific_field1 = '10', specific_field2 = '10'
WHERE iinc_id = 6