DECLARE
l_effective_start_date DATE := NULL;
l_effective_end_date DATE := NULL;
l_position_definition_id NUMBER := NULL;
l_valid_grades_changed_warning BOOLEAN;
l_name VARCHAR2 (500) := NULL;
l_position_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
BEGIN
BEGIN
SELECT hapf.position_definition_id,
hapf.name,
hapf.object_version_number,
hapf.position_id
INTO l_position_definition_id,
l_name,
l_object_version_number,
l_position_id
FROM hr_all_positions_f hapf
WHERE TRUNC (SYSDATE) BETWEEN hapf.effective_start_date
AND hapf.effective_end_date
AND hapf.availability_status_id = 1
AND hapf.name =
'SR MRI TECHNOLOGIST.P.666 M\.R\.I\. SERVICES (Unit) - F.09';
EXCEPTION
WHEN OTHERS
THEN
l_position_definition_id := NULL;
l_name := NULL;
l_object_version_number := NULL;
l_position_id := NULL;
END;
IF l_position_id IS NOT NULL
THEN
hr_position_api.update_position (
p_validate => FALSE,
p_position_id => l_position_id,
p_effective_start_date => l_effective_start_date,
p_effective_end_date => l_effective_end_date,
p_position_definition_id => l_position_definition_id,
p_valid_grades_changed_warning => l_valid_grades_changed_warning,
p_name => l_name,
p_availability_status_id => 5,
p_language_code => NULL,
p_comments => 'Position Eliminated via API',
p_object_version_number => l_object_version_number,
p_effective_date => SYSDATE,
p_datetrack_mode => 'UPDATE'
);
-- commit;
DBMS_OUTPUT.put_line ('Successfully Updated');
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
END;
No comments:
Post a Comment