Oracle update multiple rows

Source: Internet
Author: User

To update multiple rows:

There are many steps, but the efficiency is relatively high:
1. Create Table temporary table value (select a. ID, A. Name, B. Name,... from Table1 A, Table2 B where a. ID = B. ID)
2. delete records in Table 1. Do not drop
3. insert into Table1 select the field you need from the temporary table.

 

 

Select * From tb_ai03

Create Table tb_ai031 as select * From tb_ai03

Delete from tb_ai03 A where a. yymm in ('20140901', '20160901 ')

Insert into tb_ai03
Select a. Model, A. yysal/B. unitestrip as yysal, A. mmsal/B. unitestrip as mmsal,
A. yychu/B. unitestrip as yychu, A. mmchu/B. unitestrip as mmchu, A. yymm
From tb_ld04 B, tb_ai031
Where a. Model = B. Model (+) and A. yymm in ('20140901', '20140901 ')

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.