/*merge into detailed introduction
The merge statement is a new syntax for merging the UPDATE and INSERT statements oracle9i.
With the merge statement, another table is queried based on the join criteria of one table or subquery,
The connection condition matches the execution insert on the update that cannot be matched.
This syntax only needs a full table scan to complete the whole work, the execution efficiency is higher than insert+update.
*/
/* Syntax:
MERGE [into [Schema.] table [T_alias]
USING [schema.] {Table | view | subquery} [T_alias]
On (condition)
When matched then Merge_update_clause
When isn't matched then merge_insert_clause;
*/
1MERGE intot_product T2 USING t_product_temp u3 on(u.id=t.id)4 whenMatched Then5 UPDATE SETT.name=U.name,t.orderid=U.orderid,6T.descr=U.DESCR7 --Delete where u.id=18 when notMatched Then 9 INSERT(ID, name, OrderID, DESCR)VALUES(U.id, U.name,u.orderid, U.DESCR)Ten --When not matched by U and t.id=u.id Then One --Delete;
Features of the new feature, faster replication of table data performance, one-time read, can quickly copy data to the target table, where the DELETE statement is also supported in the update
You can filter some data that does not need to be updated. The speed is still very good.
Oracle uses the merge into statement to update data