DECLARE
CURSOR get_details
IS
SELECT pg.grade_id, pgr11.*
FROM per_grades@dblink@xxx11 pg11,
per_grades pg,
pay_grade_rules_f@dblink@xxx11 pgr11
WHERE pg.name = pg11.name
AND pgr11.grade_or_spinal_point_id = pg11.grade_id;
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_rate_id NUMBER := NULL;
BEGIN
-- Block to Get Rate ID
BEGIN
SELECT pr.rate_id
INTO l_rate_id
FROM pay_rates pr
WHERE UPPER (pr.name) = 'GRADE RATE';
EXCEPTION
WHEN OTHERS
THEN
l_rate_id := NULL;
END;
IF l_rate_id IS NOT NULL
THEN
FOR i IN get_details
LOOP
BEGIN
hr_grade_rate_value_api.create_grade_rate_value (
p_validate => FALSE,
p_effective_date => TO_DATE ('01-JAN-1950', 'DD-MON-YYYY'),
p_rate_id => l_rate_id,
p_grade_id => i.grade_id,
p_currency_code => i.currency_code,
p_maximum => i.maximum,
p_mid_value => i.mid_value,
p_minimum => i.minimum,
p_grade_rule_id => l_grade_rule_id,
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 Created: ' || i.grade_rule_id
);
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Inner Exception: ' || l_err_msg);
END;
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS
THEN
l_err_msg := SQLERRM;
DBMS_OUTPUT.put_line ('Main Exception: ' || l_err_msg);
END;
No comments:
Post a Comment