oracle批量更新

子查询返回多条,应该在外边的查询加where限制
update a set a.s_station = (select b.n_name from b where b.n_name = a.s_station) where a.s_station in (select b.n_name from b)

 

 

update a
set  a.s_station='S' || b.n_num || '-' || a.s_hb
from A a ,B b
where a.s_station=b.n_name;

 

UPDATE A x
SET x.s_station = (SELECT 'S' || b.n_num || '-' || a.s_hb  FROM  A a, B b WHERE a.s_station=b.n_name and a.s_id=x.s_id)
where exists(select * from B d where x.s_station=d.n_name);

你可能感兴趣的:(oracle)