--
declare
--
cursor cur_eit_details
is
select per.person_id
,'EIT_VALUE' eit_val
,to_char(sysdate,'YYYY/MM/DD HH24:MI:SS') begin_date
,null end_date
from per_all_people_f per
where per.employee_number = '123456'
and trunc(sysdate) between per.effective_start_date and per.effective_end_date
;
lc_information_type varchar2(20) := 'XXAK_TEST_EIT';
lc_information_cat varchar2(20) := 'XXAK_TEST_EIT';
ln_per_extra_info_id number;
ln_ovn_pei number;
--
begin
--
-- Please use your own business logic, this is a basic case
for rec_eit_details in cur_eit_details loop
--
begin
--
select ppei.person_extra_info_id
,ppei.object_version_number
into ln_per_extra_info_id
,ln_ovn_pei
from per_people_extra_info ppei
where ppei.person_id = rec_eit_details.person_id
and ppei.information_type = lc_information_type
and ppei.pei_information_category = lc_information_cat
;
--
begin
-- UPDATE
hr_person_extra_info_api.update_person_extra_info
( p_validate => false
, p_person_extra_info_id => ln_per_extra_info_id
-- In / Out
, p_object_version_number => ln_ovn_pei
-- In
, p_pei_information_category => lc_information_cat
, p_pei_information1 => rec_eit_details.eit_val
, p_pei_information2 => rec_eit_details.begin_date
, p_pei_information3 => rec_eit_details.end_date
);
dbms_output.put_line('EIT Updated ');
commit;
--
exception
when others then
dbms_output.put_line('Update Failed '||sqlerrm);
rollback;
end;
--
exception
when no_data_found then
--
begin
-- CREATE
ln_per_extra_info_id := null;
ln_ovn_pei := null;
--
hr_person_extra_info_api.create_person_extra_info
( p_validate => false
, p_person_id => rec_eit_details.person_id
, p_information_type => lc_information_type
, p_pei_information_category => lc_information_cat
, p_pei_information1 => rec_eit_details.eit_val
, p_pei_information2 => rec_eit_details.begin_date
, p_pei_information3 => rec_eit_details.end_date
-- Out
, p_person_extra_info_id => ln_per_extra_info_id
, p_object_version_number => ln_ovn_pei
);
--
dbms_output.put_line('EIT Created '||ln_per_extra_info_id);
commit;
--
exception
when others then
dbms_output.put_line('Creation Failed '||sqlerrm);
rollback;
--
end;
--
when others then
dbms_output.put_line('Error: Selecting Person Extra Info '||sqlerrm);
end;
--
end loop;
--
dbms_output.put_line('Done!');
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
--
declare
--
cursor cur_eit_details
is
select per.person_id
,'EIT_VALUE' eit_val
,to_char(sysdate,'YYYY/MM/DD HH24:MI:SS') begin_date
,null end_date
from per_all_people_f per
where per.employee_number = '123456'
and trunc(sysdate) between per.effective_start_date and per.effective_end_date
;
lc_information_type varchar2(20) := 'XXAK_TEST_EIT';
lc_information_cat varchar2(20) := 'XXAK_TEST_EIT';
ln_per_extra_info_id number;
ln_ovn_pei number;
--
begin
--
-- Please use your own business logic, this is a basic case
for rec_eit_details in cur_eit_details loop
--
begin
--
select ppei.person_extra_info_id
,ppei.object_version_number
into ln_per_extra_info_id
,ln_ovn_pei
from per_people_extra_info ppei
where ppei.person_id = rec_eit_details.person_id
and ppei.information_type = lc_information_type
and ppei.pei_information_category = lc_information_cat
;
--
begin
-- UPDATE
hr_person_extra_info_api.update_person_extra_info
( p_validate => false
, p_person_extra_info_id => ln_per_extra_info_id
-- In / Out
, p_object_version_number => ln_ovn_pei
-- In
, p_pei_information_category => lc_information_cat
, p_pei_information1 => rec_eit_details.eit_val
, p_pei_information2 => rec_eit_details.begin_date
, p_pei_information3 => rec_eit_details.end_date
);
dbms_output.put_line('EIT Updated ');
commit;
--
exception
when others then
dbms_output.put_line('Update Failed '||sqlerrm);
rollback;
end;
--
exception
when no_data_found then
--
begin
-- CREATE
ln_per_extra_info_id := null;
ln_ovn_pei := null;
--
hr_person_extra_info_api.create_person_extra_info
( p_validate => false
, p_person_id => rec_eit_details.person_id
, p_information_type => lc_information_type
, p_pei_information_category => lc_information_cat
, p_pei_information1 => rec_eit_details.eit_val
, p_pei_information2 => rec_eit_details.begin_date
, p_pei_information3 => rec_eit_details.end_date
-- Out
, p_person_extra_info_id => ln_per_extra_info_id
, p_object_version_number => ln_ovn_pei
);
--
dbms_output.put_line('EIT Created '||ln_per_extra_info_id);
commit;
--
exception
when others then
dbms_output.put_line('Creation Failed '||sqlerrm);
rollback;
--
end;
--
when others then
dbms_output.put_line('Error: Selecting Person Extra Info '||sqlerrm);
end;
--
end loop;
--
dbms_output.put_line('Done!');
--
exception
when others then
dbms_output.put_line('Error: '||sqlerrm);
rollback;
end;
--
after applying it i get [Error] Execution (29: 5): ORA-01841: (full) year must be between -4713 and +9999, and not be 0
ReplyDeleteORA-06512: at "APPS.HR_PERSON_EXTRA_INFO_API", line 675
ORA-06512: at line 21
date format to be passed to the api should be : To_Char(V_Date,'YYYY-MM-DD HH:MM:SS')
ReplyDelete