SQL查询中的标识符无效

时间:2017-04-10 07:19:55

标签: sql oracle oracle-apps

此查询引发错误ORA-00904: invalid identifier,任何人都可以告诉我原因吗?

select papf.person_id, papf.person_number, ppnf.DISPLAY_NAME
from per_people_f papf, PER_PERSON_NAMES_F ppnf
where
papf.person_id=ppnf.person_id
and papf.person_id not in (select cs.person_id from cmp_salary cs where cs.person_id is not null and cs.ASSIGNMENT_ID is null )
and papf.person_id not in (select cse.person_id from cmp_salary_export cs where cse.person_id is not null and cse.ASSIGNMENT_ID is null )
and ppnf.name_type='US'
order by papf.person_id

1 个答案:

答案 0 :(得分:1)

这是一个错字。在第二个子查询中,您为所有列引用cse.设置了别名,但您对表cs设置了别名。

(select cse.person_id
 from cmp_salary_export cs 
 where cse.person_id is not null 
 and cse.ASSIGNMENT_ID is null )

使用适当的缩进来布置代码不仅仅是迂腐:使其更易于阅读,使其更容易调试。