0% found this document useful (0 votes)
37 views

Aor HCM

This SQL query selects data from various tables related to employee responsibilities, including the employee number, name, assignment name, responsibility type, and joins additional tables to retrieve fields like business unit, legal entity, department, location, position, job, grade, payroll, and legislative data group for each responsibility. It filters for active responsibilities where the effective dates of the associated records overlap with the current date. The results are ordered by employee number.

Uploaded by

Faz Subhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Aor HCM

This SQL query selects data from various tables related to employee responsibilities, including the employee number, name, assignment name, responsibility type, and joins additional tables to retrieve fields like business unit, legal entity, department, location, position, job, grade, payroll, and legislative data group for each responsibility. It filters for active responsibilities where the effective dates of the associated records overlap with the current date. The results are ordered by employee number.

Uploaded by

Faz Subhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

select RepDetailEO.

person_number,
RepNameDPEO.display_name,
AssignmentDPEO.assignment_name,
HcmLookupPeo.meaning as Representative_Type,
RespEO.*
from per_asg_responsibilities RespEO,
per_all_people_f RepDetailEO,
per_all_assignments_m AssignmentDPEO,
per_person_names_f_v RepNameDPEO,
HCM_LOOKUPS HcmLookupPEO
where RespEO.person_id = RepDetailEO.person_id
and RespEO.assignment_id = AssignmentDPEO.assignment_id
and RespEO.person_id = RepNameDPEO.person_id
AND RespEO.responsibility_type = HcmLookupPeo.lookup_code
AND HcmLookupPeo.lookup_type = 'PER_RESPONSIBILITY_TYPES'
and RespEO.status = 'Active'
AND trunc(SYSDATE) BETWEEN AssignmentDPEO.effective_start_date AND
AssignmentDPEO.effective_end_date
AND trunc(SYSDATE) BETWEEN RepNameDPEO.effective_start_date AND
RepNameDPEO.effective_end_date
AND trunc(SYSDATE) BETWEEN RepDetailEO.effective_start_date AND
RepDetailEO.effective_end_date
AND trunc(SYSDATE) BETWEEN RespEO.start_date and NVL(RespEO.end_date,to_date('31-
12-4712','DD-MM-YYYY'))
order by RepDetailEO.person_number;

SELECT (
SELECT DISTINCT PERSON_NUMBER
FROM PER_ALL_PEOPLE_F PER
WHERE PER.PERSON_ID = AOR.PERSON_ID
) PERSON_NUMBER,
(
SELECT DISTINCT FULL_NAME
FROM PER_PERSON_NAMES_F PER
WHERE PER.PERSON_ID = AOR.PERSON_ID
AND NAME_TYPE = 'GLOBAL'
) PERSON_NAME,
AOR.RESPONSIBILITY_NAME,
TO_CHAR(AOR.START_DATE, 'DD-MON-YYYY', 'NLS_DATE_LANGUAGE = AMERICAN')
START_DATE,
TO_CHAR(AOR.END_DATE, 'DD-MON-YYYY', 'NLS_DATE_LANGUAGE = AMERICAN')
END_DATE,
AOR.RESPONSIBILITY_TYPE,
AOR.STATUS,
(
SELECT NAME
FROM HR_ALL_ORGANIZATION_UNITS HOU
WHERE HOU.ORGANIZATION_ID = AOR.BUSINESS_UNIT_ID
) BUSINESS_UNIT,
(
SELECT NAME
FROM HR_ALL_ORGANIZATION_UNITS HOU
WHERE HOU.ORGANIZATION_ID = AOR.LEGAL_ENTITY_ID
) LEGAL_ENTITY,
(
SELECT NAME
FROM HR_ALL_ORGANIZATION_UNITS HOU
WHERE HOU.ORGANIZATION_ID = AOR.ORGANIZATION_ID
) DEPARTMENT,
(
SELECT LOCATION_NAME
FROM HR_LOCATIONS HL
WHERE HL.LOCATION_ID = AOR.LOCATION_ID
) LOCATION,
(
SELECT DISTINCT NAME
FROM HR_ALL_POSITIONS_F_VL PP
WHERE PP.POSITION_ID = AOR.POSITION_ID
) POSITION,
(
SELECT DISTINCT NAME
FROM PER_JOBS_F_TL PJ
WHERE PJ.JOB_ID = AOR.JOB_ID
) JOB,
(
SELECT DISTINCT NAME
FROM PER_GRADES_F_TL PG
WHERE PG.GRADE_ID = AOR.GRADE_ID
) GRADE,
AOR.ASSIGNMENT_CATEGORY,
(
SELECT PAY.PAYROLL_NAME
FROM PAY_ALL_PAYROLLS_F PAY
WHERE PAY.PAYROLL_ID = AOR.PAYROLL_ID
AND TRUNC(SYSDATE) BETWEEN PAY.EFFECTIVE_START_DATE
AND PAY.EFFECTIVE_END_DATE
) PAYROLL,
(
SELECT NAME
FROM PER_LEGISLATIVE_DATA_GROUPS_VL PLD
WHERE PLD.LEGISLATIVE_DATA_GROUP_ID = AOR.LEGISLATIVE_DATA_GROUP_ID
) LEGISLATIVE_DATA_GROUP
FROM PER_ASG_RESPONSIBILITIES AOR

You might also like