Mar. 8, 2012
Oracle Update Statements
There are several methods in Oracle SQL to update records in one table based on the content of another table.
Here, I give some of those methods and some guidance on where they might be most appropriate.
The Basics
Oracle uses a ‘correlated subquery’ syntax which looks like this:
UPDATE target t
SET t.column = s.column
(SELECT
FROM source s
WHERE s.join_column = t.join_column)
The bracketed subquery joins the source and target tables and the target table is updated with values from the source column. I’ve shown a simple join between the two tables using one column from each, but the WHERE clause in the subquery can be as complex as required.