The batch update between two table fields is to replace A1 in Table A with B2 in Table B with a1 = b1, and A1 and B1 are unique.

Source: Internet
Author: User

To achieve this, replace A1 in Table A with B2 in Table B. The condition is a1 = b1, and A1 and B1 are unique.

 

Update a set a. A1 = (select B2 from a, B where a. A1 = B. B1)
Where a. A1 = (select B1 from a, B where a. A1 = B. B1)

 

 

Select * from
Select * from B

-- Create Table
Create Table A
(
A1 varchar2 (10),
A2 varchar2 (10 ),
A3 varchar2 (10)
)
tablespace fwzcgl
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Create Table
Create Table B
(
B1 varchar2 (10),
B2 varchar2 (10 ),
B3 varchar2 (10)
)
tablespace fwzcgl
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);

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.