DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_CANDIDATE_TEST

Source


1 package body IRC_CANDIDATE_TEST as
2 /* $Header: ircndtst.pkb 120.0 2005/07/26 14:59:58 mbocutt noship $ */
3 --Package Variables
4 --
5 g_package varchar2(33) := 'irc_candidate_test.';
6 --
7 -- -------------------------------------------------------------------------
8 -- |------------------------< is_person_a_candidate >----------------------|
9 -- -------------------------------------------------------------------------
10 --
11 function is_person_a_candidate
12 (p_person_id in number)
13 return boolean is
14 cursor c_party is
15 select per.party_id
16 from per_all_people_f per
17 where per.person_id=p_person_id
18 and sysdate between per.effective_start_date and per.effective_end_date;
19 l_party_id number;
20 --
21 cursor c_person is
22 select 1 from per_person_type_usages_f ptu
23 , per_person_types ppt
24 where  ptu.person_id=p_person_id
25 and ppt.person_type_id=ptu.person_type_id
26 and ppt.system_person_type='IRC_REG_USER'
27 and sysdate between ptu.effective_start_date and ptu.effective_end_date;
28 --
29 cursor c_person_party is
30 select 1 from per_person_type_usages_f ptu
31 , per_person_types ppt
32 ,per_all_people_f per
33 where  ptu.person_id=per.person_id
34 and ppt.person_type_id=ptu.person_type_id
35 and ppt.system_person_type='IRC_REG_USER'
36 and sysdate between ptu.effective_start_date and ptu.effective_end_date
37 and per.party_id=l_party_id
38 and sysdate between per.effective_start_date and per.effective_end_date;
39 --
40 l_dummy number;
41 l_candidate boolean :=false;
42 l_proc          varchar2(72) := g_package||'is_person_a_candidate';
43 begin
44   hr_utility.set_location(' Entering: '||l_proc, 10);
45   open c_party;
46   fetch c_party into l_party_id;
47   close c_party;
48   if l_party_id is null then
49     hr_utility.set_location(l_proc, 20);
50     open c_person;
51     fetch c_person into l_dummy;
52     if c_person%found then
53       close c_person;
54       l_candidate:=true;
55     else
56       close c_person;
57     end if;
58   else
59     hr_utility.set_location(l_proc, 30);
60     open c_person_party;
61     fetch c_person_party into l_dummy;
62     if c_person_party%found then
63       close c_person_party;
64       l_candidate:=true;
65     else
66       close c_person_party;
67     end if;
68   end if;
69   hr_utility.set_location(' Leaving: '||l_proc, 20);
70   return l_candidate;
71 end is_person_a_candidate;
72 end irc_candidate_test;