DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ORG_UTILITY

Source


1 Package body hr_org_utility as
2 /* $Header: peorgutl.pkb 120.0 2006/06/13 12:55:32 hmehta noship $ */
3 
4 g_package  Varchar2(30) := 'hr_org_utility.';
5 g_debug boolean := hr_utility.debug_enabled;
6 
7 --
8 ---------------------------get_ccm_org-----------------------------
9 --
10    FUNCTION get_ccm_org
11      ( p_organization_id IN Number,
12        p_restricted_class in varchar2)
13      RETURN  varchar2 is
14      l_flag varchar2(1) := 'Y';
15      l_cnt  number;
16 
17      Cursor c1 is
18      select 1
19      from hr_organization_information org2,
20           hr_org_info_types_by_class oitbc
21      where org2.organization_id = p_organization_id
22      and org2.org_information_context||'' = 'CLASS'
23      and org2.org_information2 = 'Y'
24      and org2.org_information1 = nvl(p_restricted_class,org2.org_information1)
25      and org2.org_information1 = oitbc.org_classification
26      and oitbc.org_information_type = 'Organization Name Alias';
27 
28    BEGIN
29      select count(distinct org_information_context)
30      into l_cnt
31      from  hr_organization_information
32      where organization_id = p_organization_id
33      and   org_information_context in ('Organization Name Alias', 'CLASS');
34 
35      --Return if both classifications are not present.
36      if l_cnt < 2 then
37        return 'N';
38      else
39        l_cnt := 0;
40        Open  c1;
41        Fetch c1 into l_cnt;
42        close c1;
43        if l_cnt = 0 then --Conditions not met, return N.
44           return 'N';
45        else --Found...all conditions met, return Y
46           return 'Y';
47        end if;
48      end if;
49    EXCEPTION
50       WHEN others THEN
51           raise;
52    END get_ccm_org;
53 --
54 End hr_org_utility;
55