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

Oracle Payroll - SQL Queries

This SQL query finds an employee's net pay by joining tables related to payroll, assignments, people, and balances. It selects the assignment number, full name, payroll, payroll ID, balance name, effective date, and result value. The query filters for a specific assignment number and date range and finds the latest balances and assignments by comparing effective dates.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
805 views

Oracle Payroll - SQL Queries

This SQL query finds an employee's net pay by joining tables related to payroll, assignments, people, and balances. It selects the assignment number, full name, payroll, payroll ID, balance name, effective date, and result value. The query filters for a specific assignment number and date range and finds the latest balances and assignments by comparing effective dates.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ORACLE PAYROLL

SQL QUERY – NET PAY

To Find out Employee wise Organization

SELECT haou.name, papf.employee_number, papf.full_name


FROM per_all_people_f papf,
per_all_assignments_f paaf,
hr_all_organization_units haou
WHERE 1 = 1
AND papf.person_id = paaf.person_id
AND paaf.organization_id = haou.organization_id
AND TRUNC (SYSDATE) BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND TRUNC (SYSDATE) BETWEEN paaf.effective_start_date
AND paaf.effective_end_date
GROUP BY haou.name, papf.employee_number, papf.full_name

Single Latest Balance Table Upgrade:

The latest balances for an assignment or person are stored in the following three
tables:

 PAY_PERSON_LATEST_BALANCES
 PAY_ASSIGNMENT_LATEST_BALANCES
 PAY_BALANCE_CONTEXT_VALUES

To find out Net Pay


SELECT paf.assignment_number,
ppf.full_name,
paygr.payroll_name payroll,
paygr.payroll_id,
Element_name,
pbt.balance_name,
ppa.effective_date,
prv.result_value
FROM Pay_Element_Types_F PET,
Pay_Input_Values_F PIV,
Pay_Run_Result_Values PRV,
Pay_Run_Results PRR,
Pay_assignment_actions PAA,
Pay_payroll_actions PPA,
Pay_balance_types pbt,
Pay_balance_feeds_f pbff,
Per_people_f ppf,
Per_assignments_f paf,
Per_grades gr,
Pay_all_payrolls_f paygr
WHERE PRR.Element_Type_ID = PET.Element_Type_ID
AND PIV.Element_Type_ID = PET.Element_Type_ID
AND PRV.Input_Value_ID = PIV.Input_Value_ID
AND PRV.Run_Result_ID = PRR.Run_Result_ID
AND PRR.Assignment_Action_ID = PAA.Assignment_Action_ID
AND PAA.Payroll_Action_ID = PPA.Payroll_Action_ID
AND PBFF.balance_type_id = PBT.balance_type_id
AND PIV.input_value_id = PBFF.input_value_id
AND PPA.EFFECTIVE_DATE BETWEEN '01-Feb-2016' AND '29-Feb-2016'
AND PPF.PERSON_ID = PAF.PERSON_ID
AND SYSDATE BETWEEN ppf.effective_start_date
AND ppf.effective_end_date
AND paf.effective_start_date =
(SELECT MAX (effective_start_date)
FROM per_assignments_f paf1
WHERE paf.assignment_id = paf1.assignment_id)
AND PAA.ASSIGNMENT_ID = PAF.ASSIGNMENT_ID
AND GR.GRADE_ID = PAF.GRADE_ID
AND PAYGR.PAYROLL_ID = PAF.PAYROLL_ID
AND SYSDATE BETWEEN PAYGR.EFFECTIVE_START_DATE
AND PAYGR.EFFECTIVE_END_DATE
AND ASSIGNMENT_NUMBER = '117'

You might also like