Here you go

Showing posts with label delete employee. Show all posts
Showing posts with label delete employee. Show all posts

Wednesday, April 20, 2016

Purge Employees from Oracle EBS


You can use following code/API to purge the employees from oracle EBS:


Following code will remove the data from per_all_people_f.


DECLARE
l_warning VARCHAR2(1000);

cursor cur is
select person_id from  cust_delete_me where status <> 'P';

BEGIN

     FOR emp in cur LOOP
       
        begin
       
        hr_person_api.delete_person
        (p_validate => FALSE,
        p_effective_date => SYSDATE,
        p_person_id => EMP.PERSON_ID,
        p_perform_predel_validation => FALSE,
        p_person_org_manager_warning => l_warning
        );
       
        exception when others then
       
        l_warning :='Error';
       
        end;
       
        IF l_warning is null then
       
        update cust_delete_me set status ='P' , description ='Success' where person_id = emp.person_id;
       
        else
       
        update cust_delete_me set status ='E' , description ='Error' where person_id = emp.person_id;
       
        end if;
       
        COMMIT;

     END LOOP;

     
        dbms_output.put_line(' Procedure Completed.' );

END;