DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RNK_SHD

Source


1 Package Body pqh_rnk_shd as
2 /* $Header: pqrnkrhi.pkb 120.1 2005/06/23 13:27 nsanghal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package constant varchar2(33) := '  pqh_rnk_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc constant       varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PQH_RANK_PROCESSES_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_rank_process_id                      in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        rank_process_id
50       ,pgm_id
51       ,pl_id
52       ,oipl_id
53       ,process_cd
54       ,process_date
55       ,benefit_action_id
56       ,person_id
57       ,assignment_id
58       ,total_score
59       ,object_version_number
60       ,request_id
61       ,business_group_id
62       ,per_in_ler_id
63     from        pqh_rank_processes
64     where       rank_process_id = p_rank_process_id;
65   --
66   l_fct_ret     boolean;
67   --
68 Begin
69   --
70   If (p_rank_process_id is null and
71       p_object_version_number is null
72      ) Then
73     --
74     -- One of the primary key arguments is null therefore we must
75     -- set the returning function value to false
76     --
77     l_fct_ret := false;
78   Else
79     If (p_rank_process_id
80         = pqh_rnk_shd.g_old_rec.rank_process_id and
81         p_object_version_number
82         = pqh_rnk_shd.g_old_rec.object_version_number
83        ) Then
84       --
85       -- The g_old_rec is current therefore we must
86       -- set the returning function to true
87       --
88       l_fct_ret := true;
89     Else
90       --
91       -- Select the current row into g_old_rec
92       --
93       Open C_Sel1;
94       Fetch C_Sel1 Into pqh_rnk_shd.g_old_rec;
95       If C_Sel1%notfound Then
96         Close C_Sel1;
97         --
98         -- The primary key is invalid therefore we must error
99         --
100         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
101         fnd_message.raise_error;
102       End If;
103       Close C_Sel1;
104       If (p_object_version_number
105           <> pqh_rnk_shd.g_old_rec.object_version_number) Then
106         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
107         fnd_message.raise_error;
108       End If;
109       l_fct_ret := true;
110     End If;
111   End If;
112   Return (l_fct_ret);
113 --
114 End api_updating;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |---------------------------------< lck >----------------------------------|
118 -- ----------------------------------------------------------------------------
119 Procedure lck
120   (p_rank_process_id                      in     number
124 -- Cursor selects the 'current' row from the HR Schema
121   ,p_object_version_number                in     number
122   ) is
123 --
125 --
126   Cursor C_Sel1 is
127     select
128        rank_process_id
129       ,pgm_id
130       ,pl_id
131       ,oipl_id
132       ,process_cd
133       ,process_date
134       ,benefit_action_id
135       ,person_id
136       ,assignment_id
137       ,total_score
138       ,object_version_number
139       ,request_id
140       ,business_group_id
141       ,per_in_ler_id
142     from        pqh_rank_processes
143     where       rank_process_id = p_rank_process_id
144     for update nowait;
145 --
146   l_proc constant      varchar2(72) := g_package||'lck';
147 --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'RANK_PROCESS_ID'
154     ,p_argument_value     => p_rank_process_id
155     );
156   hr_utility.set_location(l_proc,6);
157   hr_api.mandatory_arg_error
158     (p_api_name           => l_proc
159     ,p_argument           => 'OBJECT_VERSION_NUMBER'
160     ,p_argument_value     => p_object_version_number
161     );
162   --
163   Open  C_Sel1;
164   Fetch C_Sel1 Into pqh_rnk_shd.g_old_rec;
165   If C_Sel1%notfound then
166     Close C_Sel1;
167     --
168     -- The primary key is invalid therefore we must error
169     --
170     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
171     fnd_message.raise_error;
172   End If;
173   Close C_Sel1;
174   If (p_object_version_number
175       <> pqh_rnk_shd.g_old_rec.object_version_number) Then
176         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
177         fnd_message.raise_error;
178   End If;
179   --
180   hr_utility.set_location(' Leaving:'||l_proc, 10);
181   --
182   -- We need to trap the ORA LOCK exception
183   --
184 Exception
185   When HR_Api.Object_Locked then
186     --
187     -- The object is locked therefore we need to supply a meaningful
188     -- error message.
189     --
190     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
191     fnd_message.set_token('TABLE_NAME', 'pqh_rank_processes');
192     fnd_message.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199   (p_rank_process_id                in number
200   ,p_pgm_id                         in number
201   ,p_pl_id                          in number
202   ,p_oipl_id                        in number
203   ,p_process_cd                     in varchar2
204   ,p_process_date                   in date
205   ,p_benefit_action_id              in number
206   ,p_person_id                      in number
207   ,p_assignment_id                  in number
208   ,p_total_score                    in number
209   ,p_object_version_number          in number
210   ,p_request_id                     in number
211   ,p_business_group_id              in number
212   ,p_per_in_ler_id                  in number
213   )
214   Return g_rec_type is
215 --
216   l_rec   g_rec_type;
217 --
218 Begin
219   --
220   -- Convert arguments into local l_rec structure.
221   --
222   l_rec.rank_process_id                  := p_rank_process_id;
223   l_rec.pgm_id                           := p_pgm_id;
224   l_rec.pl_id                            := p_pl_id;
225   l_rec.oipl_id                          := p_oipl_id;
226   l_rec.process_cd                       := p_process_cd;
227   l_rec.process_date                     := p_process_date;
228   l_rec.benefit_action_id                := p_benefit_action_id;
229   l_rec.person_id                        := p_person_id;
230   l_rec.assignment_id                    := p_assignment_id;
231   l_rec.total_score                      := p_total_score;
232   l_rec.object_version_number            := p_object_version_number;
233   l_rec.request_id                       := p_request_id;
234   l_rec.business_group_id                := p_business_group_id;
235   l_rec.per_in_ler_id                    := p_per_in_ler_id;
236   --
237   -- Return the plsql record structure.
238   --
239   Return(l_rec);
240 --
241 End convert_args;
242 --
243 end pqh_rnk_shd;