Oracle batch bit batch update and multi-column batch update

Source: Internet
Author: User

In general, we only update a single record, but there are few batch updates. Currently, we provide three methods for batch update:

 

1. Batch update

Update test a set a. dept_no = (select B. dept_no from test1 B where a. emp_no = B. emp_no)

 

 

2. Batch update with multiple columns

Update test a set (A. emp_no, A. dept_no, A. id_no, A. ic_no, A. Status) =
(Select B. emp_no, B. dept_no, B. id_no, B. ic_no, B. status from test1 B where a. emp_no = B. emp_no)

 

 

3. Use the merge method to update data

-- Use the merge method to update data

Merge into tb_realtimedatavalue
Using tb_pointconfig B
On (A. FID = B. factoryid and A. uploadid = B. uploadid)
When matched then
Update set a. pointid = B. ID
Where a. FID = 13

This merge update method comes from

Http://www.cnblogs.com/GeneralXU/archive/2009/03/25/1421175.html

 

The above are my personal summary of the batch update method, of course, we can usually use triggers, stored procedures, etc. to update data, however, sometimes triggers and stored procedures do not necessarily meet our requirements. This method is the fastest and most effective update method.

There are thousands of methods, the fastest and most effective is the best, is the preferred method.

There is no end to learning, and the knowledge is constantly updated. The blog will be constantly updated to share your learning experience with you!

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.