Name
MERGE
Synopsis
MERGE INTOtable_name[alias] USING {table_name|viewname|subquery} ON (condition) WHEN MATCHED THENmerge_update_clauseWHEN NOT MATCHED THENmerge_insert_clause
Selects rows from a table for update of or insert into another table. This statement is used to avoid multiple INSERT and UPDATE statements. New with Oracle9i Release 2.
Keywords
- INTO
Specifies the name of the target table, that is, the table that will be updated or have rows inserted.
- USING
Specifies the name of the table, view, or subquery from which rows are to be selected.
- ON (condition)
Specifies a condition that will evaluate to either TRUE or FALSE. This is a SQL clause, and is typically a test for equality.
- merge_update_clause
Specifies a SQL DML statement to be performed if condition is TRUE. This is normally an UPDATE statement.
- merge_insert_clause
Specifies a SQL DML statement to be performed if condition is not TRUE. This is normally an INSERT statement.
Common keywords and clauses: alias, table_name.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access