Using Cursor................
declare
l_organization_id number ;
l_object_version_number number;
l_object_version_number2 number;
l_org_information_id number;
cursor c1 is
select a org_name, b location_id,c type
from testa
;
begin
for i in c1 loop
apps.hr_organization_api.create_organization
(p_validate => NULL,
p_effective_date => sysdate,
p_language_code => apps.hr_api.userenv_lang,
p_business_group_id => 80,
p_date_from => TO_DATE ('01-JAN-1950', 'DD-MON-YYYY'),
p_name => i.org_name,
p_location_id => i.location_id,
--p_date_to => sysdate,
p_internal_external_flag => 'INT',
--p_internal_external_flag => NULL,
p_internal_address_line => NULL,
p_type => i.type,
p_comments => NULL,
p_attribute_category => NULL,
p_attribute1 => NULL,
p_organization_id => l_organization_id,
p_object_version_number => l_object_version_number
);
dbms_output.put_line(l_organization_id);
commit;
begin
apps.hr_organization_api.create_org_classification
(p_validate => NULL,
p_effective_date => sysdate,
p_organization_id => l_organization_id,
p_org_classif_code =>'HR_ORG',
p_org_information_id => l_org_information_id,
p_object_version_number => l_object_version_number2
);
exception when others then
dbms_output.put_line(sqlerrm);
end;
end loop;
exception when others then
dbms_output.put_line(sqlerrm);
end;
Create single organization, assigning classification.
declare
ln_business_group_id number := 81;
l_organization_name varchar2(200):='TestAfzal_API' ;
l_organization_id number ;
l_object_version_number number;
l_org_type number := 60;
ln_location_id number := 142;
begin
apps.hr_organization_api.create_organization
(p_validate => NULL,
p_effective_date => sysdate,
p_language_code => apps.hr_api.userenv_lang,
p_business_group_id => 81,
p_date_from => TO_DATE ('01-JAN-1950', 'DD-MON-YYYY'),
p_name => l_organization_name,
p_location_id => ln_location_id,
--p_date_to => sysdate,
p_internal_external_flag => 'INT',
--p_internal_external_flag => NULL,
p_internal_address_line => NULL,
p_type => l_org_type,
p_comments => NULL,
p_attribute_category => NULL,
p_attribute1 => NULL,
p_organization_id => l_organization_id,
p_object_version_number => l_object_version_number
);
dbms_output.put_line(l_organization_id);
exception when others then
dbms_output.put_line(sqlerrm);
end;
declare
l_organization_id number := 2031;
l_org_information_id number:= 88302;
l_org_classif_code varchar2(20) := 'HR_ORG';
l_object_version_number number;
begin
apps.hr_organization_api.create_org_classification
(p_validate => NULL,
p_effective_date => sysdate,
p_organization_id => l_organization_id,
p_org_classif_code =>l_org_classif_code,
p_org_information_id => l_org_information_id,
p_object_version_number => l_object_version_number
);
exception when others then
dbms_output.put_line(sqlerrm);
end;
select * from HR_ORGANIZATION_INFORMATION_V
where organization_id in(2030,2031)
select * from hr_all_organization_units
where organization_id in(2030,2031)
No comments:
Post a Comment