MySQL Forums
Forum List  »  General

Re: Help for fixing update failure due to lock in a outer join table
Posted by: Tian Deng
Date: June 04, 2020 05:30AM

Okay, I understand. Could you help me understand some detail about lock in MySQL?

Suppose there is a procedure like the following. According to MySQL's design, while table tblA being updated, will there be any kind of lock on table tmp_tbl1 ?

----

Create procedure clc_term_price ( in_key int)
begin
create temporary table IF NOT EXISTS tmp_tbl1
( column1 varchar(255), column2 int,
index tmp_tbl1_index1(column2) );

insert into temp_tbl1 as select * from original_tbl1;

update tblA
left outer join tmp_tbl1
on tmp_tbl1.column2 = tblA.column2
set tblA.column1=tmp_tbl1.column1
where tblA.id = in_key;

End

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.