Oracle: OCA-047-question and Experiment

Source: Internet
Author: User
Oracle: OCA-047-solution and experiment, the MERGE statement is a new syntax for Oracle9i to merge update and INSERT statements. Use the MERGE statement to query a table or subquery

Oracle: OCA-047-solution and experiment, the MERGE statement is a new syntax for Oracle9i to merge update and INSERT statements. Use the MERGE statement to query a table or subquery

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. Use the MERGE statement to query another table based on the connection conditions of one table or subquery, and UPDATE the matching connection conditions. 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.

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.