Upward:
SELECT ORGANIZATION_ID_PARENT
FROM ( SELECT LEVEL LEVEL_ID, ORGANIZATION_ID_PARENT
FROM per_org_structure_elements org
WHERE ORGANIZATION_ID_PARENT <> 81
START WITH ORGANIZATION_ID_CHILD = :p_org_id
CONNECT BY PRIOR ORGANIZATION_ID_PARENT = ORGANIZATION_ID_CHILD)
WHERE LEVEL_ID =
(SELECT MAX (LEVEL_ID)
FROM ( SELECT LEVEL LEVEL_ID, ORGANIZATION_ID_PARENT
FROM per_org_structure_elements org
WHERE ORGANIZATION_ID_PARENT <> 81
START WITH ORGANIZATION_ID_CHILD = :p_org_id
CONNECT BY PRIOR ORGANIZATION_ID_PARENT =
ORGANIZATION_ID_CHILD))
No comments:
Post a Comment