You are on page 1of 2

--SELECT *fROM DUAL

declare
l_validate_mode BOOLEAN := FALSE;
l_begin_date DATE := SYSDATE;
l_end_date DATE := hr_general.end_of_time;
l_business_group_id NUMBER := 81;
l_orgname hr_all_organization_units.name%TYPE := 'XXTEST_ORG';
l_intl_extl fnd_lookup_values.meaning%TYPE;
l_organization_id hr_all_organization_units.organization_id%TYPE;
l_object_version_number hr_all_organization_units.object_version_number%TYPE;
l_duplicate_org_warning BOOLEAN;
begin
apps.hr_organization_api.create_organization
(
p_validate => l_validate_mode
,p_effective_date => l_begin_date --Reference date for validating
lookup values
,p_business_group_id => l_business_group_id
,p_date_from => l_begin_date --Date the organization takes
effect
,p_name => l_orgname
,p_location_id => null
,p_date_to => l_end_date
,p_internal_external_flag => l_intl_extl--'INT' --Internal/External org flag
,p_internal_address_line => null
,p_type => null --Org type -- Lookup Type ORG_TYPE
,p_comments => null
,p_attribute_category => null
,p_attribute1 => null
,p_attribute2 => NULL
,p_attribute3 => null
,p_attribute4 => null
,p_attribute5 => null
--Out Variables
,p_organization_id => l_organization_id
,p_object_version_number => l_object_version_number
,p_duplicate_org_warning => l_duplicate_org_warning
);

if l_organization_id is null or l_object_version_number is null then


dbms_output.put_line('hr_organization_api.update_organization API Error: '||
sqlerrm);
rollback;
elsif l_duplicate_org_warning then
dbms_output.put_line('Warning: Duplicate Organization');
rollback;
else
commit;

dbms_output.put_line('Organization created' ||l_organization_id);


end if;
--
exception
when others then
dbms_output.put_line('hr_organization_api.create_organization API failed with
error :'||sqlerrm);
rollback;
end;
select *from hr_all_organization_units where name like 'XX%'

You might also like