Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
297 views

Fusion SQL

This SQL query retrieves employee data from various database tables, including employee ID, name, department, nationality, date of birth, grade, salary and other attributes. It joins tables like per_all_people_f, pay_element_entries_f, hr_all_positions to gather information from different sources on an employee matching a given person ID. The query filters on date ranges and other criteria to return relevant current employee records for analysis or reporting purposes.

Uploaded by

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

Fusion SQL

This SQL query retrieves employee data from various database tables, including employee ID, name, department, nationality, date of birth, grade, salary and other attributes. It joins tables like per_all_people_f, pay_element_entries_f, hr_all_positions to gather information from different sources on an employee matching a given person ID. The query filters on date ranges and other criteria to return relevant current employee records for analysis or reporting purposes.

Uploaded by

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

Fusion SQL

SELECT papf.person_number, -- 01 -- Employee ID


emp.full_name, -- 02 -- Employee Name
emp.department, -- 03 -- Employee Department
emp.business_unit, -- 05 -- Employee Region
emp.nationality, -- 09 -- Employee Nationality
emp.date_of_birth, -- 10 -- Date Of Birth
emp.grade_name, -- 06 -- Employee Grade
emp.marital_status, -- 12 -- Marital Status
emp.religion, -- 14 -- Religion
emp.basic_salary,
emp.hire_date, -- 11 -- Date of Join
emp.segment_of_work, -- 04 -- Employee Segment
emp.position, -- 08 -- Employee Position
emp.gender -- 13 -- Gender
from per_all_people_f papf
, pay_element_entries_f peef
, pay_element_entry_values_f peev
, pay_element_types_vl petv
, pay_element_types_f petf
, pay_input_values_vl pivt
, per_all_assignments_f asg_act
, per_people_groups ppg
---- emp table
,(SELECT papf.person_id,
papf.person_number person_number,
name_g.full_name full_name,
name_g.first_name,
name_g.middle_names,
name_g.last_name,
hr_org.name department,
bu_unit.name business_unit,
(SELECT MAX (fl.meaning)
FROM fnd_lookup_values_tl fl
WHERE fl.lookup_type = 'NATIONALITY'
AND fl.lookup_code(+) = pcz.legislation_code
AND fl.language = USERENV ('LANG'))
nationality,
TO_CHAR (per.date_of_birth, 'DD-MM-YYYY') date_of_birth,
pg.name grade_name,
(SELECT MAX (fl.meaning)
FROM hr_lookups fl
WHERE fl.lookup_type = 'MAR_STATUS'
AND fl.lookup_code = pplf.marital_status)
marital_status,
(SELECT MAX (fl.meaning)
FROM fnd_lookup_values_tl fl
WHERE fl.lookup_type = 'PER_RELIGION'
AND fl.lookup_code(+) = pr.religion
AND fl.language = USERENV ('LANG'))
religion,
sal.salary_amount basic_salary,
DECODE (pplf.sex, 'M', 'Male', 'F', 'Female', pplf.sex)
gender,
TO_CHAR (ppos.date_start, 'DD-MM-YYYY') hire_date,
asg_act.ass_attribute1 segment_of_work,
hap.name position,
hap.position_code
FROM per_all_people_f papf,
per_person_names_f name_g,
per_religions pr,
hr_organization_units hr_org,
hr_organization_units bu_unit,
per_all_assignments_f asg_act,
per_grades pg,
per_citizenships pcz,
per_periods_of_service ppos,
cmp_salary sal,
per_people_legislative_f pplf,
hr_all_positions hap,
per_persons per
WHERE :p_from_date > NVL (papf.effective_start_date, SYSDATE) AND :p_to_date < NVL
(papf.effective_end_date, SYSDATE)
AND name_g.person_id(+) = papf.person_id
AND per.person_id(+) = papf.person_id
AND pplf.person_id(+) = papf.person_id
AND ppos.person_id(+) = asg_act.person_id
AND pr.person_id(+) = papf.person_id
AND ppos.period_of_service_id(+) =
asg_act.period_of_service_id
AND :p_from_date > NVL (pplf.effective_start_date(+), SYSDATE) AND :p_to_date < NVL
(pplf.effective_end_date(+), SYSDATE)
AND :p_from_date > NVL (name_g.effective_start_date, SYSDATE) AND :p_to_date < NVL
(name_g.effective_end_date, SYSDATE)
AND UPPER (name_g.name_type) = UPPER ('GLOBAL')
AND asg_act.person_id = papf.person_id
AND UPPER (asg_act.primary_flag(+)) = UPPER ('Y')
AND :p_from_date > NVL (asg_act.effective_start_date(+), SYSDATE) AND :p_to_date < NVL
(asg_act.effective_end_date(+), SYSDATE)
AND asg_act.effective_latest_change = 'Y'
AND hr_org.organization_id(+) = asg_act.organization_id
AND bu_unit.organization_id(+) = asg_act.business_unit_id
AND sal.assignment_id = asg_act.assignment_id
AND :p_from_date > NVL (sal.date_from, SYSDATE) AND :p_to_date < NVL (sal.date_to,
SYSDATE)
AND pg.grade_id(+) = asg_act.grade_id
AND pcz.person_id(+) = papf.person_id
AND hap.position_id(+) = asg_act.position_id
) emp
---- emp table
----
--, anc_absence_types_f_tl aatf
--, anc_per_abs_entries pae
, ANC_PER_ABS_ENTRIES pa
-- , per_absence_type pat
----
where papf.person_id = peef.person_id(+)
and peef.element_entry_id = peev.element_entry_id
and upper (papf.person_number) not like upper ('T%')
and :p_from_date > trunc (papf.effective_start_date) and :p_to_date < trunc
(papf.effective_end_date)
and papf.person_number = '14000455'
and petv.element_type_id = peef.element_type_id
and petf.element_type_id = peef.element_type_id
and pivt.element_type_id = peef.element_type_id
and asg_act.person_id = papf.person_id
and :p_from_date > nvl (asg_act.effective_start_date(+), sysdate) and :p_to_date < nvl
(asg_act.effective_end_date(+), sysdate)
and ppg.people_group_id(+) = asg_act.people_group_id
and ppg.business_group_id(+) = asg_act.business_group_id
and upper (asg_act.primary_flag(+)) = upper ('y')
and upper (asg_act.effective_latest_change) = upper ('y')
and upper (asg_act.assignment_status_type) = upper ('active')
and :p_from_date > trunc (petv.effective_start_date) and :p_to_date < trunc
(petv.effective_end_date)
and :p_from_date > trunc (peef.effective_start_date) and :p_to_date < trunc
(peef.effective_end_date)
and :p_from_date > trunc (peev.effective_start_date) and :p_to_date < trunc
(peev.effective_end_date)
and :p_from_date > trunc (petf.effective_start_date) and :p_to_date < trunc
(petf.effective_end_date)
and regexp_like (trim (peev.screen_entry_value), '[0-9]')
and papf.person_id = emp.person_id(+)
--
-- and aatf.language = userenv ('LANG')
--and aatf.absence_type_id = pae.absence_type_id(+)
--and emp.person_id = pae.person_id(+)
-- and :p_from_date > trunc (pae.start_date) and :p_to_date < trunc (pae.end_date)
and pa.type_id =pat.type_id
and papf.person_id = pa.person_id
--
Group by
papf.person_number,
emp.full_name,
emp.department,
emp.business_unit,
emp.nationality,
emp.date_of_birth,
emp.grade_name,
emp.marital_status,
emp.religion,
emp.basic_salary,
emp.hire_date,
emp.segment_of_work,
emp.position,
emp.gender

WHERE
AND papf.person_id = payment_details.person_id(+)
AND papf.person_id = emp.person_id(+)
AND papf.person_id = basic.person_id(+)
AND papf.person_id = housing.person_id(+)
AND papf.person_id = ticket_mco.person_id(+)

AND peev.input_value_id = pivt.input_value_id


-- '14000002'

You might also like