Note: Questions and Answers are from the Internet. This article only provides answers for users to learn!
Question:
Answer:
This topic describes the usage of merge. The concepts are as follows:
The MERGE statement is a new syntax of Oracle9i, used to merge update and INSERT statements. The MERGE statement is used to query another table based on the connection conditions of one table or subquery. The join condition matching is updated, and the INSERT statement cannot be executed. This syntax only requires one full table scan to complete all the work, and the execution efficiency is higher than INSERT + UPDATE.
- Usage:
- MERGE [INTO[Schema.]Table[T_alias]
- USING [Schema.] {Table|View| Subquery} [t_alias]
- ON(Condition)
- WHENMATCHEDTHENMerge_update_clause
- WHEN NOTMATCHEDTHENMerge_insert_clause;
In the question, when matched then: first update the row value, and THEN delete the NULL row. Therefore, the third row is deleted. Not matched then: the rows that do NOT meet the conditions are inserted directly, so you can determine the answer.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9 ..
- 12
- Next Page
|