您好,欢迎来到智榕旅游。
搜索
您的当前位置:首页不使用游标,多张表的多条记录更新

不使用游标,多张表的多条记录更新

来源:智榕旅游

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;

Copyright © 2019- zrrp.cn 版权所有 赣ICP备2024042808号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务