/* Formatted on 2016/12/02 16:44 (Formatter Plus v4.8.8) */
DECLARE
lv_lang VARCHAR2 (50) := NULL;
lv_job VARCHAR2 (2000) := NULL;
lv_new_job_name VARCHAR2 (200) := NULL;
ln_business_group_id NUMBER;
ln_job_group_id NUMBER;
ln_job_id NUMBER;
ln_object_version_number NUMBER;
ln_job_definition_id NUMBER;
lb_valid_grades_changed_warn BOOLEAN;
BEGIN
-- get job details
FOR r_jobs IN (SELECT job_id, job_definition_id, object_version_number,
NAME || '(XXX)' NAME
-- INTO ln_job_id, ln_job_definition_id, ln_object_version_number
FROM per_jobs j
WHERE SYSDATE BETWEEN date_from AND NVL (date_to, SYSDATE)
)
LOOP
ln_job_id := r_jobs.job_id;
ln_job_definition_id := r_jobs.job_definition_id;
ln_object_version_number := r_jobs.object_version_number;
lv_new_job_name := r_jobs.NAME;
hr_job_api.update_job
(p_validate => FALSE,
p_job_id => ln_job_id,
p_object_version_number => ln_object_version_number,
p_comments => 'FY2016 JOB Change',
p_concat_segments => lv_new_job_name,
p_language_code => lv_lang,
p_job_definition_id => ln_job_definition_id,
p_name => lv_job,
p_valid_grades_changed_warning => lb_valid_grades_changed_warn,
p_effective_date => SYSDATE
);
DBMS_OUTPUT.put_line ('JOB ID: ' || ln_job_id);
DBMS_OUTPUT.put_line ( 'OBJECT_VERSION_NUMBER: '
|| ln_object_version_number
);
DBMS_OUTPUT.put_line ('JOB_DEFINITION_ID: ' || ln_job_definition_id);
DBMS_OUTPUT.put_line ('JOB_NAME: ' || lv_job);
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Unable to create a job.Error:' || SQLERRM);
RAISE;
END;
/
No comments:
Post a Comment