[Script]Get Hierarchy of employee and supervisor hierarchy when a person id provided

SELECT PAAF.SUPERVISOR_ID MGR_ID,
PJ.JOB_ID ,
PAPF.FULL_NAME,
PJ.NAME,
PAPF.PERSON_ID PER_ID
FROM PER_PEOPLE_X PAPF,
PER_ASSIGNMENTS_X PAAF,
PER_JOBS PJ
WHERE PAPF.PERSON_ID = PAAF.PERSON_ID
AND PAAF.JOB_ID = PJ.JOB_ID
START WITH PAPF.PERSON_ID = 57--Smith,Jonathan(MFG)
CONNECT BY PRIOR PAAF.SUPERVISOR_ID = PAPF.PERSON_ID;


--Get user's employee id(person_id)
SELECT employee_id FROM fnd_user WHERE user_name = 'MFG';

--Get PERSON_ID base on full name
SELECT * FROM per_people_x WHERE full_name LIKE '%Smith%Jonathan%'

你可能感兴趣的:(script)