SELECT PERSON_ID,
EMPLOYEE_NAME,
SUPERVISOR_ID,
SUPERVISOR_NAME,
(SELECT NAME
FROM APPS.PER_JOBS
WHERE JOB_ID = TL.JOB_ID)
EMP_JOB_NAME,
TL.JOB_ID,
LEVEL LVL
FROM (SELECT PAFE.PERSON_ID PERSON_ID,
PAFE.SUPERVISOR_ID SUPERVISOR_ID,
(SELECT PPFS2.FULL_NAME
FROM PER_ALL_PEOPLE_F PPFS2
WHERE PPFS2.PERSON_ID = PAFE.SUPERVISOR_ID
AND SYSDATE BETWEEN PPFS2.EFFECTIVE_START_DATE
AND PPFS2.EFFECTIVE_END_DATE)
SUPERVISOR_NAME,
PAFE.JOB_ID,
PPFS.FULL_NAME EMPLOYEE_NAME
FROM PER_ALL_ASSIGNMENTS_F PAFE,
PER_ALL_PEOPLE_F PPFS,
PER_PERSON_TYPES_V PPTS,
PER_PERSON_TYPE_USAGES_F PPTU
WHERE 1 = 1
-- PAFE.BUSINESS_GROUP_ID = 0
AND TRUNC (SYSDATE) BETWEEN PAFE.EFFECTIVE_START_DATE
AND PAFE.EFFECTIVE_END_DATE
AND PAFE.PRIMARY_FLAG = 'Y'
AND PAFE.ASSIGNMENT_TYPE IN ('E', 'C')
AND PPFS.PERSON_ID = PAFE.PERSON_ID
AND TRUNC (SYSDATE) BETWEEN PPFS.EFFECTIVE_START_DATE
AND PPFS.EFFECTIVE_END_DATE
AND PPTU.PERSON_ID = PPFS.PERSON_ID
AND PPTS.PERSON_TYPE_ID = PPTU.PERSON_TYPE_ID
AND PPTS.SYSTEM_PERSON_TYPE IN ('EMP', 'EMP_APL', 'CWK'))
TL
CONNECT BY TL.PERSON_ID = PRIOR TL.SUPERVISOR_ID
START WITH TL.PERSON_ID = (SELECT EMPLOYEE_ID
FROM APPS.FND_USER
WHERE USER_NAME = 'ELANGO');
Query was very helpful and served my purpose.
ReplyDeleteThanks a lot.
sir i need the same query in oracle fusion hcm bi reports
ReplyDelete