Oracle9i New Feature Series: MERGE Statement - Insert or Update ("Upsert")
MERGE is a new SQL statement introduced in Oracle9i to
update or insert rows selected from one table to another based on a condition.
This avoids writing multiple DML statements to satisfy a conditional update or
insert. The syntax is:
- MERGE [hint] INTO
[schema .] table [t_alias] USING [schema .]
- { table | view | subquery } [t_alias] ON
( condition )
- WHEN MATCHED THEN UPDATE SET
column = { expr | DEFAULT } [, column = { expr | DEFAULT
}]...
- WHEN NOT MATCHED THEN INSERT (
column [, column]... ) VALUES ( expr [, expr]... )
Read more at:
OTN 9i Daily
Feature – April 30
Oracle9i
Documentation – SQL Reference – MERGE Statement
Biju Thomas is Oracle7.3 OCP, Oracle8 OCP,
Oracle8i OCP and Oracle9i OCA/OCP Certified DBA |
Questions/Comments? Write to webmaster@bijoos.com.
© The scripts, tips and articles appearing on BijooS.com cannot be reproduced
elsewhere without the prior permission from the webmaster.
|
|