Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle two tables are associated with batch updating of data from one of the tables

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Method 1 (recommended):

UPDATE Table 2 SET Table 2.C = (SELECT B FROM Table 1 WHERE Table 1.A = Table 2.A) WHERE EXISTS (SELECT 1 FROM Table 1 WHERE Table 1.A = Table 2.A)

It is particularly important to pay particular attention to the last outer where condition, which is to lock the scope of its batch update data.

Method 2:

MERGE INTO Table 2 USING Table 1 ON (Table 2.A = Table 1.A)-- if An is the same WHEN MATCHEDTHEN UPDATE SET Table 2.C = Table 1.B-when matching, update

The above is the Oracle two tables introduced by the editor to update the data of one of the tables in batches. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report