Your browser does not support JavaScript. This help page requires JavaScript to render correctly. About the UPDATE Statement
Skip Headers
Previous
Previous
 
Next
Next

About the UPDATE Statement

The UPDATE statement updates (changes the values of) a set of existing table rows.

A simple form of the UPDATE statement has this syntax:

UPDATE table_name
SET column_name = value [, column_name = value]...
[ WHERE condition ];

Each value must be valid for its column_name. Therefore, before you update a column, you must know what its valid values are. To get this information using SQL Developer, see Tutorial: Viewing EMPLOYEES Table Properties and Data. To get this information using SQL*Plus, use this statement:

DESCRIBE table_name;

If you include the WHERE clause, the statement updates column values only in rows that satisfy condition.

The UPDATE statement in the following example updates the value of the SALARY column in the row that was inserted into the EMPLOYEES table in About the INSERT Statement, before the salary of the employee was known.

Using the UPDATE Statement to Add Data

UPDATE EMPLOYEES
SET SALARY = 8500
WHERE LAST_NAME = 'Keats';

Result:

1 row updated.

The UPDATE statement in the following example updates the commission percentage for every employee in department 80.

Using the UPDATE Statement to Update Multiple Rows

UPDATE EMPLOYEES
SET COMMISSION_PCT = COMMISSION_PCT + 0.05
WHERE DEPARTMENT_ID = 80;

Result:

36 rows updated.

Related Topics

Oracle Database SQL Language Reference for information about the UPDATE statement

Oracle Database SQL Language Reference for information about data types

Tutorial: Changing Data in Tables in the Data Pane

About Data Manipulation Language (DML) Statements