不使用游标,多张表的多条记录更新
来源:懂视网
责编:小采
时间:2020-11-09 07:33:43
不使用游标,多张表的多条记录更新
不使用游标,多张表的多条记录更新:BEGINFOR c IN (select distinct t2.name,t1.idfrom table1 t1,table2 t2where t1.id = t2.id)LOOPupdate table1 set name = c.name where id = c.id;END LOOP;END; BEGIN FOR c IN ( select distinct t2.name,t1.id from table1 t1, table2 t2 where t1.id
导读不使用游标,多张表的多条记录更新:BEGINFOR c IN (select distinct t2.name,t1.idfrom table1 t1,table2 t2where t1.id = t2.id)LOOPupdate table1 set name = c.name where id = c.id;END LOOP;END; BEGIN FOR c IN ( select distinct t2.name,t1.id from table1 t1, table2 t2 where t1.id
BEGINFOR c IN (select distinct t2.name,t1.idfrom table1 t1,table2 t2where t1.id = t2.id)LOOPupdate table1 set name = c.name where id = c.id;END LOOP;END;
BEGIN
FOR c IN
(
select distinct t2.name,t1.id
from table1 t1,
table2 t2
where t1.id = t2.id
)
LOOP
update table1 set name = c.name
where id = c.id;
END LOOP;
END;
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
不使用游标,多张表的多条记录更新
不使用游标,多张表的多条记录更新:BEGINFOR c IN (select distinct t2.name,t1.idfrom table1 t1,table2 t2where t1.id = t2.id)LOOPupdate table1 set name = c.name where id = c.id;END LOOP;END; BEGIN FOR c IN ( select distinct t2.name,t1.id from table1 t1, table2 t2 where t1.id