Search This Blog

Sunday, July 20, 2014

Salary Change Query in Oracle HRMS/Payroll

select papf.employee_number,     
       papf.full_name,
       ppp_old.proposed_salary_n old_sal,
       ppp_new.proposed_salary_n new_sal,
       ppp_new.change_date
--,ppp_old.last_change_date,ppp_new.last_change_date
  from apps.per_all_people_f      papf,
       apps.per_all_assignments_f paaf,
       apps.per_pay_proposals     ppp_old,
       apps.per_pay_proposals     ppp_new
where 1 = 1
   and papf.person_id = paaf.person_id
   and paaf.assignment_type = 'E'
   and paaf.primary_flag = 'Y'
   and paaf.assignment_id = ppp_old.assignment_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
      --and ppp_new.change_date between trunc(sysdate) - 60 and trunc(sysdate)
      --and ppp_new.approved = 'Y'
   and ppp_new.assignment_id = paaf.assignment_id
   and ppp_new.last_change_date = ppp_old.change_date
   and ppp_new.change_date =
       (select max(x.change_date)
          from per_pay_proposals x
         where x.assignment_id = paaf.assignment_id)

   and paaf.assignment_id = 282416

No comments:

Post a Comment