Oracle updates another table with data from one of the tables

Source: Internet
Author: User

Set val = (exists (where tab1.id = tab2.id) 

In this way, the TAB2 part will not be updated to TAB1, but if the TAB2 is not the value of the part, TAB1 should be empty, then the last sentence removed, changed to

Set val = (where tab1.id = tab2.id)

Whether or not to remove the last sentence, once there is repetition, will be an error

A big guy's solution is to use the merge syntax

I still have a way to do this.

Set val = (exists (where tab1.id = tab2.id) 

If there are more than one also to replace, the values of the multiple should be the same (not surprisingly different to replace the case ...). , then it doesn't matter which one you use.

(By the way, what data types can be Max's)

If you don't need to be replaced, just remove the conditions.

Oracle updates another table with data from one of the tables

Related Article

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.