Why does the request below not work in oracle?
select * from ENTITY_OWNERSHIP EO
where
(select count (*)
from (
select USER_ID
from ENTITY_OWNERSHIP
where ENTITY_OWNERSHIP.ENTITY_ID = EO.ENTITY_ID
)
) > 0
He produces "ORA-00904:" EO. " ENTITY_ID ": invalid identifier". However, when I replace EO.ENTITY_ID with an exact value, for example, 10181, then it works.
UPDATE: The full query looks like this:
select * from ENTITY_OWNERSHIP EO
where
(select count (*)
from (
select USER_ID
from ENTITY_OWNERSHIP
where ENTITY_OWNERSHIP.ENTITY_ID = EO.ENTITY_ID
intersect
select distinct group_id
from USERS.GROUPS
start with GROUP_ID in (select GROUP_ID from USERS.LK_GROUPS where USER_ID=10001)
connect by prior PARENTGROUP_ID=GROUP_ID
)
) > 0
source
share