3. Statements : OpenROAD SQL Statements : Update Statement
 
Share this page                  
Update Statement
This statement updates the values of the columns in a database table.
This statement has the following syntax:
Non-cursor version:
[repeated] update tablename [corrname]
     [from fromclause]
     set columnname = dbexpression {, columnname =
               dbexpression}
     [where searchcondition];
Cursor version:
update tablename set columnname = dbexpression
     {, columnname = dbexpression} where current of
          
cursor_variable;
where fromclause has the following alternative syntaxes:
from tablename [corrname]{, tablename [corrname]}
from :fromvariable
The update statement modifies the values in columns in a database table.
The tablename identifies the table that you want to update and must match the table name specified in the open statement for the specified cursor.
Each column that you include in the update statement must also have been specified in the for update clause of the open statement that opened the cursor.
The optional corrname defines a correlation name for the table. Correlation names provide a shorthand way to refer to tables in a query.
The optional repeated keyword directs the DBMS to encode and save the query execution plan for the statement. This is a performance enhancement if you intend to execute this statement more than once.
Note:  Do not use the repeated keyword if you place the entire where clause, searchcondition, in a single variable or if a table name or column name is represented by a dynamic name.