1.通过存储过程
循环 传值
create or replace procedure p_u is
begin
for rs in (select distinct (rks) from rkbz)
loop
update osm_t_arc_customers t
set t.population = rs.rks + 4
where t.code in
(select code
from osm_t_arc_customers
where code in (select rscode from rkbz where rks = rs.rks));
end loop;
end p_u;
2.通过case when then else end
-------更新c1表中rks 当rks=1时 set rks为5 rks=2时 set rks为6 其余的为4
update c1
set rks = (case
when rks = 1 then
5
when rks = 2 then
6
else
4
end);
时间: 2024-10-27 15:03:01