The Merege statement in Oracle uses

Source: Internet
Author: User

Analysis of the merge statement:

/**

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.

**/

The basic framework for the merge statement:

Merge into target table T1 using (SELECT * from additional table) T2

On (T1. Field name = T2. Field name)--associated condition

When matched and then-updates are made when the associated conditions are met

Update set T1. Specify Field name = T2. Specify field name--Update table data

When is not matched and then--does not conform to the association condition, inserts

Insert (T1. Specify field name)--can be multiple, separated by commas

VALUES (T2. Specify field names)--can be multiple, separated by commas, must correspond to field one by one of T1

The Merege statement in Oracle uses

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.