--
declare
--
l_action varchar2(12) := 'CREATE'; --'UPDATE' 'DELETE'
--- DECLARE variables for HR_PHONE_API.create_or_update_phone
--- IN variables
l_ph_date_from date := trunc(sysdate);
l_ph_date_to date := hr_general.end_of_time;
--hr_lookup -- 'PHONE_TYPE'
l_phone_type per_phones.phone_type%type := 'M';
l_phone_number per_phones.phone_number%type := 078623492;
l_person_id per_phones.parent_id%type := 234156;
--- OUT variables
l_phone_id per_phones.phone_id%type := 12345;
l_object_version_number per_phones.object_version_number%type := 1;
--
l_phone_exp exception;
--
begin
if l_action = 'CREATE' then
--
l_phone_id := null;
l_object_version_number := null;
--
hr_phone_api.create_phone
(p_date_from => l_ph_date_from
,p_date_to => l_ph_date_to
,p_phone_type => l_phone_type
,p_phone_number => l_phone_number
,p_parent_id => l_person_id
,p_parent_table => 'PER_ALL_PEOPLE_F'
,p_validate => FALSE
,p_effective_date => sysdate
,p_attribute1 => 'Test Phone'
--Out
,p_phone_id => l_phone_id
,p_object_version_number => l_object_version_number
);
if l_phone_id is null then
raise l_phone_exp;
end if;
elsif l_action = 'UPDATE' then
hr_phone_api.update_phone
(p_phone_id => l_phone_id
,p_date_from => l_ph_date_from
,p_date_to => l_ph_date_to
--,p_phone_type => l_phone_type
,p_phone_number => l_phone_number
-- ,p_parent_id => l_person_id
--,p_parent_table => 'PER_ALL_PEOPLE_F'
,p_validate => FALSE
,p_effective_date => sysdate
,p_attribute1 => 'Test Phone2'
--In/OUT
,p_object_version_number => l_object_version_number
);
if l_object_version_number = 1 then --original version number
raise l_phone_exp;
end if;
elsif l_action = 'DELETE' then
hr_phone_api.delete_phone
(p_phone_id => l_phone_id
,p_object_version_number => l_object_version_number
,p_validate => FALSE
);
end if;
--
dbms_output.put_line('Phone '||l_action||'Successful');
commit;
--
exception
when l_phone_exp then
dbms_output.put_line('hr_phone_api API failed with error :'||sqlerrm);
rollback;
when others then
dbms_output.put_line('hr_phone_api API failed with error :'||sqlerrm);
rollback;
end;
--
declare
--
l_action varchar2(12) := 'CREATE'; --'UPDATE' 'DELETE'
--- DECLARE variables for HR_PHONE_API.create_or_update_phone
--- IN variables
l_ph_date_from date := trunc(sysdate);
l_ph_date_to date := hr_general.end_of_time;
--hr_lookup -- 'PHONE_TYPE'
l_phone_type per_phones.phone_type%type := 'M';
l_phone_number per_phones.phone_number%type := 078623492;
l_person_id per_phones.parent_id%type := 234156;
--- OUT variables
l_phone_id per_phones.phone_id%type := 12345;
l_object_version_number per_phones.object_version_number%type := 1;
--
l_phone_exp exception;
--
begin
if l_action = 'CREATE' then
--
l_phone_id := null;
l_object_version_number := null;
--
hr_phone_api.create_phone
(p_date_from => l_ph_date_from
,p_date_to => l_ph_date_to
,p_phone_type => l_phone_type
,p_phone_number => l_phone_number
,p_parent_id => l_person_id
,p_parent_table => 'PER_ALL_PEOPLE_F'
,p_validate => FALSE
,p_effective_date => sysdate
,p_attribute1 => 'Test Phone'
--Out
,p_phone_id => l_phone_id
,p_object_version_number => l_object_version_number
);
if l_phone_id is null then
raise l_phone_exp;
end if;
elsif l_action = 'UPDATE' then
hr_phone_api.update_phone
(p_phone_id => l_phone_id
,p_date_from => l_ph_date_from
,p_date_to => l_ph_date_to
--,p_phone_type => l_phone_type
,p_phone_number => l_phone_number
-- ,p_parent_id => l_person_id
--,p_parent_table => 'PER_ALL_PEOPLE_F'
,p_validate => FALSE
,p_effective_date => sysdate
,p_attribute1 => 'Test Phone2'
--In/OUT
,p_object_version_number => l_object_version_number
);
if l_object_version_number = 1 then --original version number
raise l_phone_exp;
end if;
elsif l_action = 'DELETE' then
hr_phone_api.delete_phone
(p_phone_id => l_phone_id
,p_object_version_number => l_object_version_number
,p_validate => FALSE
);
end if;
--
dbms_output.put_line('Phone '||l_action||'Successful');
commit;
--
exception
when l_phone_exp then
dbms_output.put_line('hr_phone_api API failed with error :'||sqlerrm);
rollback;
when others then
dbms_output.put_line('hr_phone_api API failed with error :'||sqlerrm);
rollback;
end;
--
Thanks for your blog!!.
ReplyDeleteJAVA Development Services
HR Pay Roll Software
SAP Software Services
Hotel Billing Software
Hospital Management Software
Web Design Company