ORA-00904:“S”。“EMPLID”:标识符无效

时间:2013-05-24 18:24:14

标签: ora-00904

update dkc_hsp_pi a
set a.UaID = (select uid from 
(
select uid,
emplid,
max(EFFDT) 
from sysadm.ps_ua_eds_data
group by uid,
emplid ) s)
where s.emplid = a.emplid;

1 个答案:

答案 0 :(得分:0)

别名“s”无法从您使用它的地方访问:尝试将WHERE子句移动到这样的级别:

update dkc_hsp_pi a
set a.UaID = 
(
select uid from 
  (
    select uid,
           emplid,
           max(EFFDT) 
    from sysadm.ps_ua_eds_data
    group by uid, emplid 
  ) s
  where s.emplid = a.emplid
)
;

如果子查询返回多个结果,则需要将第一个"="更改为"IN",或者相应地调整子查询(通过在row_number上过滤返回单行)。 / p>