原sql语句是
`update cmd_geo_area t set t.gis_x=(
select
d.gdx
from dept_coordinates d
where d.id=t.id and
d.id is not null
and rownum < 2
)`
但是回报错,提示单行数据返回多行
然后上网查资料说是需要再后面跟一个exists条件,保证给gix_x返回的是单行数据,最终sql是
update cmd_geo_area t set t.gis_x=(
select
d.gdx
from dept_coordinates d
where d.id=t.id and
d.id is not null
and rownum < 2
) where exists (select 1 from dept_coordinates d where d.id=t.id);