我想根据我的外部表更新员工表,但出现 ORA-01427 错误,单行子查询返回多行
employee(emp_id, emp_name, job_history, city_code)
ext_table(emp_name, job_history, city_name)
city(city_code, city_name)
我的 ext_table 中的数据如下:
Sandy, waitress, los angeles
Sandy, restaurant manager, los angeles
John, store manager, phoenix
update employee em
set (em.emp_name, em.job_history, em.city_code) =
(select t.emp_name, t.job_history, t.city_code
from (select distinct(emp_name), job_history, c.city_code from
ext_table e, city c where e.city_name=c.city_name) t)
where em.emp_name=t.emp_name;
我非常感谢任何帮助