Sunday, April 16, 2017
API to create JOBS
declare
l_business_group_id number;
l_job_group_id number;
l_job_id number;
l_object_version_number number;
l_job_definition_id number;
l_job_name varchar2(200);
l_group_name; varchar2(200) :='test';
begin
-- get group id and business group id
begin
select business_group_id,
job_group_id
into l_business_group_id,
l_job_group_id
from per_job_groups
where displayed_name = l_group_name;
exception
when others then
dbms_output.put_line('Unable to get the job group details.Error:'||sqlerrm);
raise;
end;
--- loop values from temporary table
for i in (
select
name,
date_from,
vacation_days
from temp_jobs
)
loop
HR_JOB_API .CREATE_JOB
(p_validate => FALSE
,p_business_group_id => l_business_group_id
,p_date_from =>i.date_from
,p_comments => 'test for nar'
,p_date_to => NULL
,p_job_group_id => l_job_group_id
,p_concat_segments => i.name
--output
,p_job_id => l_job_id
,p_object_version_number => l_object_version_number
,p_job_definition_id => l_job_definition_id
,p_name => l_job_name
,p_attribute11 => i.vacation_days-- annual vacation days
);
commit;
end loop;
DBMS_OUTPUT.PUT_LINE('job id: '||l_job_id);
DBMS_OUTPUT.PUT_LINE('object_version_number: '||l_object_version_number);
DBMS_OUTPUT.PUT_LINE('job_definition_id: '||l_job_definition_id);
DBMS_OUTPUT.PUT_LINE('job_name: '||l_job_name);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('unable to create a job.error:'||SQLERRM);
rollback;
RAISE;
END;
Subscribe to:
Post Comments (Atom)
This comment has been removed by a blog administrator.
ReplyDeleteI wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. HR consultants
ReplyDelete