Use hr_grade_rate_value_api API to create/update/delete grade rate values
Ex: Update grade rate
--
DECLARE
CURSOR get_details
IS
select pgr.effective_start_date
,pgr.effective_end_date
,pgr.object_version_number
,pgr.value
,pgr.maximum
,pgr.mid_value
,pgr.minimum
,pgr.sequence
,pgr.grade_rule_id
,pgr.currency_code
from per_grades pg,
pay_grade_rules_f pgr
where pg.name = 'AK General|12|Standard XX'
and pgr.grade_or_spinal_point_id = pg.grade_id
and trunc(sysdate) between pgr.effective_start_date and pgr.effective_end_date
;
l_effective_start_date DATE := NULL;
l_effective_end_date DATE := NULL;
l_grade_rule_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_err_msg VARCHAR2 (500) := NULL;
l_value NUMBER;
l_mid_value NUMBER;
l_max_vlaue NUMBER;
l_mim_value NUMBER;
BEGIN
FOR i IN get_details LOOP
--
l_object_version_number := i.object_version_number;
l_max_vlaue := 40000;
l_mim_value := 30000;
l_mid_value := 35000;
l_value := 35000;
--
BEGIN
hr_grade_rate_value_api.update_grade_rate_value (
p_validate => FALSE,
p_grade_rule_id => i.grade_rule_id,
p_effective_date => TO_DATE ('10-MAY-2014', 'DD-MON-YYYY'),
p_datetrack_update_mode => 'UPDATE',--'CORRECTION',
p_currency_code => i.currency_code,
p_maximum => l_max_vlaue,
p_mid_value => l_mid_value,
p_minimum => l_mim_value,
p_value => l_value,
p_sequence => i.sequence,
p_object_version_number => l_object_version_number,
p_effective_start_date => l_effective_start_date,
p_effective_end_date => l_effective_end_date
);
COMMIT;
DBMS_OUTPUT.put_line ('Grate Rate has been Updated: ' || i.grade_rule_id );
EXCEPTION
WHEN OTHERS THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Inner Exception: ' || l_err_msg);
END;
END LOOP;
--
EXCEPTION
WHEN OTHERS THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;
--
Ref: My Experience/Oracle Metalink/User Guides/Different other blogs available/Colleagues
Ex: Update grade rate
--
DECLARE
CURSOR get_details
IS
select pgr.effective_start_date
,pgr.effective_end_date
,pgr.object_version_number
,pgr.value
,pgr.maximum
,pgr.mid_value
,pgr.minimum
,pgr.sequence
,pgr.grade_rule_id
,pgr.currency_code
from per_grades pg,
pay_grade_rules_f pgr
where pg.name = 'AK General|12|Standard XX'
and pgr.grade_or_spinal_point_id = pg.grade_id
and trunc(sysdate) between pgr.effective_start_date and pgr.effective_end_date
;
l_effective_start_date DATE := NULL;
l_effective_end_date DATE := NULL;
l_grade_rule_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_err_msg VARCHAR2 (500) := NULL;
l_value NUMBER;
l_mid_value NUMBER;
l_max_vlaue NUMBER;
l_mim_value NUMBER;
BEGIN
FOR i IN get_details LOOP
--
l_object_version_number := i.object_version_number;
l_max_vlaue := 40000;
l_mim_value := 30000;
l_mid_value := 35000;
l_value := 35000;
--
BEGIN
hr_grade_rate_value_api.update_grade_rate_value (
p_validate => FALSE,
p_grade_rule_id => i.grade_rule_id,
p_effective_date => TO_DATE ('10-MAY-2014', 'DD-MON-YYYY'),
p_datetrack_update_mode => 'UPDATE',--'CORRECTION',
p_currency_code => i.currency_code,
p_maximum => l_max_vlaue,
p_mid_value => l_mid_value,
p_minimum => l_mim_value,
p_value => l_value,
p_sequence => i.sequence,
p_object_version_number => l_object_version_number,
p_effective_start_date => l_effective_start_date,
p_effective_end_date => l_effective_end_date
);
COMMIT;
DBMS_OUTPUT.put_line ('Grate Rate has been Updated: ' || i.grade_rule_id );
EXCEPTION
WHEN OTHERS THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Inner Exception: ' || l_err_msg);
END;
END LOOP;
--
EXCEPTION
WHEN OTHERS THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;
--
Ref: My Experience/Oracle Metalink/User Guides/Different other blogs available/Colleagues
No comments:
Post a Comment