UPDATE

 

Function

The UPDATE statement modifies the data contained in a particular row or set of rows. There are two forms, positioned UPDATE and searched UPDATE.

 

Syntax

update.bmp
 

 

table_specification

A qualified or unqualified identifier which refers to the table to be amended. The table must be defined at this statement's compilation time. If the table specification is a view reference this view must be updatable. See Common Elements, section Table Specification for more details.  

correlation_identifier

Allows the table to be referenced by another identifier. See Common Elements , section Correlation Identifier for more details.  

expression

Specifies the new values to which the columns in the row(s) under consideration will be assigned. See Common Elements, section Row Amendment Expression for more details.

WHERE CURRENT OF cursor identifier

Indicates that the UPDATE is positioned. The cursor identifier refers to a cursor which is currently open and pointing to a row.

WHERE_search_condition

Indicates that the UPDATE statement is searched. Omission of the WHERE clause equates to a special case of a searched UPDATE statement.   See Search Condition.

Description

Limitations

ANSI Specifics

CONNX Specifics

Example

The following example updates all prices in the cruise table by adding 100 to the original cost.

 

UPDATE cruise

    SET cruise_price = cruise_price + 100 ;

 

The following example decreases customer 816 amount to pay by 100.

 

UPDATE contract

    SET amount_payment = amount_payment - 100

        WHERE id_customer = 816;