DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_INST_TYPE_PKG

Source


1 package body pqh_inst_type_pkg as
2 /* $Header: pqhipedin.pkb 115.1 2002/10/18 00:31:16 rthiagar noship $ */
3 
4 function get_inst_type( p_org_id number)
5 return varchar2
6 is
7 
8   cursor c1(cp_org_id number)
9   is
10 
11    select distinct 1
12    from hr_organization_information org
13    where org.organization_id = cp_org_id
14    and not exists (select org1.org_information_context
15    from hr_organization_information org1
16    where org1.org_information_context = 'IPEDS_INSTITUTION_TYPE'
17    and org1.organization_id = cp_org_id);
18 
19   cursor c2(cp_org_id number)
20   is
21 
22    select org.org_information1
23    from hr_organization_information org
24    where org.organization_id = cp_org_id
25    and org.org_information_context = 'IPEDS_INSTITUTION_TYPE';
26 
27    l_inst_not_exists varchar2(5);
28    l_inst_type varchar2(10);
29 
30 begin
31 
32    open c1(p_org_id);
33 
34    fetch c1 into l_inst_not_exists;
35 
36    close c1;
37 
38    if (l_inst_not_exists = 1) then
39        l_inst_type := 'NON-MED';
40    else
41        open c2(p_org_id);
42        fetch c2 into l_inst_type;
43        close c2;
44    end if;
45 
46    return l_inst_type;
47 end;
48 
49 end;