--
declare
--
l_validate boolean := false;
--
l_person_id per_all_people_f.person_id%type := 123456;
l_primary_flag per_addresses.primary_flag%type := 'Y';
l_address_style per_addresses.style%type := 'GB';
l_begin_date date := trunc(sysdate);
l_end_date date := hr_general.end_of_time;
l_address_type per_addresses.address_type%type := 'PHCA';
l_address_line1 per_addresses.address_line1%type := 'Line 1';
l_address_line2 per_addresses.address_line2%type := 'Line 2';
l_address_line3 per_addresses.address_line3%type := 'Line 3';
l_city per_addresses.town_or_city%type := 'Cumnock';
l_region_code per_addresses.region_1%type := 'WA';
l_post_code per_addresses.postal_code%type := 'FK7 8BY';
l_country_code per_addresses.country%type := 'GB';
--- OUT variables
l_address_id per_addresses.address_id%type;
l_add_obj_version_number per_addresses.object_version_number%type;
--
begin
if l_address_style != 'GB' then --'SP_INT'
hr_person_address_api.create_person_address
(p_validate => l_validate
,p_effective_date => trunc(sysdate)
,p_person_id => l_person_id
,p_primary_flag => l_primary_flag
,p_style => l_address_style
,p_date_from => l_begin_date
,p_date_to => l_end_date
,p_address_type => l_address_type
,p_address_line1 => l_address_line1
,p_address_line2 => l_address_line2
,p_address_line3 => l_address_line3
,p_town_or_city => l_city
,p_region_1 => l_region_code
,p_postal_code => l_post_code
,p_country => l_country_code
--
,p_address_id => l_address_id
,p_object_version_number => l_add_obj_version_number
);
else -- address style is GB
hr_person_address_api.create_gb_person_address
(p_validate => l_validate
,p_effective_date => trunc(sysdate)
,p_person_id => l_person_id
,p_primary_flag => l_primary_flag
,p_date_from => l_begin_date
,p_date_to => l_end_date
,p_address_type => l_address_type
,p_address_line1 => l_address_line1
,p_address_line2 => l_address_line2
,p_address_line3 => l_address_line3
,p_town => l_city
,p_county => l_region_code
,p_postcode => l_post_code
,p_country => l_country_code
--
,p_address_id => l_address_id
,p_object_version_number => l_add_obj_version_number
);
end if;
--
if l_address_id is null or l_add_obj_version_number is null then
dbms_output.put_line('Error : '||sqlerrm);
rollback;
else
dbms_output.put_line('Address created');
commit;
end if;
--
exception
when others then
dbms_output.put_line('hr_person_address_api API failed with error :'||sqlerrm);
rollback;
end;
--
declare
--
l_validate boolean := false;
--
l_person_id per_all_people_f.person_id%type := 123456;
l_primary_flag per_addresses.primary_flag%type := 'Y';
l_address_style per_addresses.style%type := 'GB';
l_begin_date date := trunc(sysdate);
l_end_date date := hr_general.end_of_time;
l_address_type per_addresses.address_type%type := 'PHCA';
l_address_line1 per_addresses.address_line1%type := 'Line 1';
l_address_line2 per_addresses.address_line2%type := 'Line 2';
l_address_line3 per_addresses.address_line3%type := 'Line 3';
l_city per_addresses.town_or_city%type := 'Cumnock';
l_region_code per_addresses.region_1%type := 'WA';
l_post_code per_addresses.postal_code%type := 'FK7 8BY';
l_country_code per_addresses.country%type := 'GB';
--- OUT variables
l_address_id per_addresses.address_id%type;
l_add_obj_version_number per_addresses.object_version_number%type;
--
begin
if l_address_style != 'GB' then --'SP_INT'
hr_person_address_api.create_person_address
(p_validate => l_validate
,p_effective_date => trunc(sysdate)
,p_person_id => l_person_id
,p_primary_flag => l_primary_flag
,p_style => l_address_style
,p_date_from => l_begin_date
,p_date_to => l_end_date
,p_address_type => l_address_type
,p_address_line1 => l_address_line1
,p_address_line2 => l_address_line2
,p_address_line3 => l_address_line3
,p_town_or_city => l_city
,p_region_1 => l_region_code
,p_postal_code => l_post_code
,p_country => l_country_code
--
,p_address_id => l_address_id
,p_object_version_number => l_add_obj_version_number
);
else -- address style is GB
hr_person_address_api.create_gb_person_address
(p_validate => l_validate
,p_effective_date => trunc(sysdate)
,p_person_id => l_person_id
,p_primary_flag => l_primary_flag
,p_date_from => l_begin_date
,p_date_to => l_end_date
,p_address_type => l_address_type
,p_address_line1 => l_address_line1
,p_address_line2 => l_address_line2
,p_address_line3 => l_address_line3
,p_town => l_city
,p_county => l_region_code
,p_postcode => l_post_code
,p_country => l_country_code
--
,p_address_id => l_address_id
,p_object_version_number => l_add_obj_version_number
);
end if;
--
if l_address_id is null or l_add_obj_version_number is null then
dbms_output.put_line('Error : '||sqlerrm);
rollback;
else
dbms_output.put_line('Address created');
commit;
end if;
--
exception
when others then
dbms_output.put_line('hr_person_address_api API failed with error :'||sqlerrm);
rollback;
end;
--
No comments:
Post a Comment