Thursday, June 11, 2015

Payroll Update Employee Email / Attributes

DECLARE
   l_employee_number             per_people_f.employee_number%TYPE;
   l_person_id                   per_people_f.person_id%TYPE;
   l_per_object_version_number   per_people_f.object_version_number%TYPE;
   v_effective_start_date        date;
   v_effective_end_date          date;
   v_full_name                   varchar2 (100);
   v_comment_id                  number;
   v_name_combination_warning    boolean;
   v_assign_payroll_warning      boolean;
   v_orig_hire_warning           boolean;
   Cursor update_flag is select * from xyka_update_email ;
BEGIN
 
   FOR rec IN UPDATE_FLAG
   Loop


   SELECT   max(object_version_number), employee_number , person_id
     INTO   l_per_object_version_number, l_employee_number , l_person_id
     FROM   per_people_f
    WHERE   EMPLOYEE_NUMBER = rec.EMP_NO
     AND SYSDATE BETWEEN effective_start_date and effective_end_date
     Group by object_version_number , employee_number , person_id;
    --person_id = l_person_id;

   hr_person_api.update_person (
      p_validate                   => FALSE,
      p_effective_date             => TO_DATE ('01-JUN-2015', 'DD-MON-YYYY'),
      p_datetrack_update_mode      => 'CORRECTION',
      p_person_id                  => l_person_id,
      p_object_version_number      => l_per_object_version_number,
      p_employee_number            => l_employee_number,
      p_email_address              => rec.EMAIL,
      p_attribute6                 => 'Y',
      p_effective_start_date       => v_effective_start_date,
      p_effective_end_date         => v_effective_end_date,
      p_full_name                  => v_full_name,
      p_comment_id                 => v_comment_id,
      p_name_combination_warning   => v_name_combination_warning,
      p_assign_payroll_warning     => v_assign_payroll_warning,
      p_orig_hire_warning          => v_orig_hire_warning
   );
 
   COMMIT;

end loop;

  -- COMMIT;
END;
/






select attribute6 from per_all_people_f
where ATTRIBUTE6 is not null
and LAST_UPDATE_DATE is SYSDATE

No comments:

Post a Comment