***************Delete all the Adjustment Elements**************************************
Declare
Cursor c1 Is select * from pay_element_entries_f where element_type_id in(
select element_type_id from pay_element_types_f where element_name like 'Staff Health Insurance%' )
and entry_type='B' and assignment_id=62;
begin
For v_rec in c1 loop
pay_balance_adjustment_api.DELETE_ADJUSTMENT(
p_validate =>false,
p_effective_date=>'01-Apr-2013',
p_element_entry_id=>v_rec.element_entry_id);
dbms_output.put_line('Done');
end loop;
Exception
When Others then
dbms_output.put_line('Error='||SQLERRM);
end;
Delete Element Entry after delting the Adjustment
**************************************************************************
Declare
l_element_entry_id NUMBER ;
l_ovn NUMBER ;
l_effstart_date DATE ;
v_count_succ NUMBER := 0;
v_count_err NUMBER := 0;
P_EFFECTIVE_START_DATE DATE ;
P_EFFECTIVE_END_DATE DATE ;
P_DELETE_WARNING BOOLEAN ;
CURSOR C1
IS
SELECT ent.element_entry_id,ent.object_version_number,ent.effective_start_date
--INTO l_element_entry_id ,l_ovn,l_effstart_date
FROM pay_element_entries_f ENT, pay_element_types_f ELE
WhERE ELE.business_group_id=81
AND ELE.element_type_id=ENT.element_type_id
AND ELE.element_name='Staff Health Insurance'
--AND ENT.ASSIGNMENT_ID in (123,154) ------need to be commented
AND trunc(sysdate) between ele.effective_start_date AND ele.effective_end_date
and ent.entry_type='E' and ent.assignment_id=62;
BEGIN
DBMS_OUTPUT.PUT_LINE('l_effstart_date For element entry=1'||l_effstart_date);
FOR i IN C1
LOOP
BEGIN
pay_element_entry_api.DELETE_ELEMENT_ENTRY (P_VALIDATE => FALSE
,P_DATETRACK_DELETE_MODE => 'ZAP'
,P_EFFECTIVE_DATE => i.effective_start_date
,P_ELEMENT_ENTRY_ID => i.element_entry_id
,P_OBJECT_VERSION_NUMBER => i.object_version_number
,P_EFFECTIVE_START_DATE => P_EFFECTIVE_START_DATE
,P_EFFECTIVE_END_DATE => P_EFFECTIVE_END_DATE
,P_DELETE_WARNING => P_DELETE_WARNING
);
v_count_succ := v_count_succ+1;
DBMS_OUTPUT.PUT_LINE('Successful Count For element entry'||v_count_succ);
DBMS_OUTPUT.PUT_LINE('Successful Count For element entry'||l_element_entry_id);
EXCEPTION
WHEN OTHERS
THEN
v_count_err := v_count_err +1;
DBMS_OUTPUT.PUT_LINE('l_effstart_date For element entry'||l_effstart_date);
DBMS_OUTPUT.PUT_LINE('Unsuccessful CountFor element entry'||v_count_err);
DBMS_OUTPUT.PUT_LINE('Error For element entry'||l_element_entry_id);
DBMS_OUTPUT.PUT_LINE(dbms_utility.format_error_backtrace||'Exception : '||SQLERRM);
END;
END LOOP;
COMMIT;
END;
I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle AME , kindly contact us http://www.maxmunus.com/contactMaxMunus Offer World Class Virtual Instructor led training on Oracle AME . We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
ReplyDeleteFor Demo Contact us.
Nitesh Kumar
MaxMunus
E-mail: nitesh@maxmunus.com
Skype id: nitesh_maxmunus
Ph:(+91) 8553912023
http://www.maxmunus.com/