UPSERT INTO table [[AS] alias] (column,...) VALUES (value,...)
UPSERT (MERGE) command
The UPSERT
(or MERGE
) command is used to add or update records.
The non-ANSI version of UPSERT
that is implemented in Teiid is a modified INSERT statement
that requires that the target table has a primary key, and that the target columns cover the primary key.
Before it performs an INSERT
, the UPSERT
operation checks whether a row exists,
and if it does, UPSERT
updates the current row rather than inserting a new one.
Example syntax
UPSERT INTO table (column,...) query
Note
|
UPSERT pushdown
If an UPSERT statement is not pushed to the source, it is broken down into the respective INSERT and UPDATE operations.
The target database system must support extended architecture (XA) to guarantee transaction atomicity.
|