DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CEO_SHD

Source


1 Package Body per_ceo_shd as
2 /* $Header: peceorhi.pkb 120.1.12000000.2 2007/04/16 11:05:48 arumukhe ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ceo_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'PER_COMP_ELEMENT_OUTCOMES_PK') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'PER_COMP_ELEMENT_OUTCOMES_FK1') Then
38     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'PER_COMP_ELEMENT_OUTCOMES_FK2') Then
43     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
46     fnd_message.raise_error;
47   Else
48     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51     fnd_message.raise_error;
52   End If;
53   --
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (p_comp_element_outcome_id              in     number
61   ,p_object_version_number                in     number
62   )
63   Return Boolean Is
64   --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70        comp_element_outcome_id
71       ,competence_element_id
72       ,outcome_id
73       ,date_from
74       ,date_to
75       ,attribute_category
76       ,attribute1
77       ,attribute2
78       ,attribute3
79       ,attribute4
80       ,attribute5
81       ,attribute6
82       ,attribute7
83       ,attribute8
84       ,attribute9
85       ,attribute10
86       ,attribute11
87       ,attribute12
88       ,attribute13
89       ,attribute14
90       ,attribute15
91       ,attribute16
92       ,attribute17
93       ,attribute18
94       ,attribute19
95       ,attribute20
96       ,information_category
97       ,information1
98       ,information2
99       ,information3
100       ,information4
101       ,information5
102       ,information6
103       ,information7
104       ,information8
105       ,information9
106       ,information10
107       ,information11
108       ,information12
109       ,information13
110       ,information14
111       ,information15
112       ,information16
113       ,information17
114       ,information18
115       ,information19
116       ,information20
117       ,object_version_number
118     from        per_comp_element_outcomes
119     where       comp_element_outcome_id = p_comp_element_outcome_id;
120   --
121   l_fct_ret     boolean;
122   --
123 Begin
124   --
125   If (p_comp_element_outcome_id is null and
126       p_object_version_number is null
127      ) Then
128     --
129     -- One of the primary key arguments is null therefore we must
130     -- set the returning function value to false
131     --
132     l_fct_ret := false;
133   Else
134     If (p_comp_element_outcome_id
135         = per_ceo_shd.g_old_rec.comp_element_outcome_id and
136         p_object_version_number
137         = per_ceo_shd.g_old_rec.object_version_number
138        ) Then
139       --
140       -- The g_old_rec is current therefore we must
141       -- set the returning function to true
142       --
143       l_fct_ret := true;
144     Else
145       --
146       -- Select the current row into g_old_rec
147       --
148       Open C_Sel1;
149       Fetch C_Sel1 Into per_ceo_shd.g_old_rec;
150       If C_Sel1%notfound Then
151         Close C_Sel1;
152         --
153         -- The primary key is invalid therefore we must error
154         --
155         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
156         fnd_message.raise_error;
157       End If;
158       Close C_Sel1;
159       If (p_object_version_number
160           <> per_ceo_shd.g_old_rec.object_version_number) Then
161         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
162         fnd_message.raise_error;
163       End If;
164       l_fct_ret := true;
165     End If;
166   End If;
167   Return (l_fct_ret);
168 --
169 End api_updating;
170 --
171 -- ----------------------------------------------------------------------------
172 -- |---------------------------------< lck >----------------------------------|
173 -- ----------------------------------------------------------------------------
174 Procedure lck
175   (p_comp_element_outcome_id          in     number
176   ,p_object_version_number            in     number
177   ) is
178 --
179 -- Cursor selects the 'current' row from the HR Schema
180 --
181   Cursor C_Sel1 is
182     select
183        comp_element_outcome_id
184       ,competence_element_id
185       ,outcome_id
186       ,date_from
187       ,date_to
188       ,attribute_category
189       ,attribute1
190       ,attribute2
191       ,attribute3
192       ,attribute4
193       ,attribute5
194       ,attribute6
195       ,attribute7
196       ,attribute8
197       ,attribute9
198       ,attribute10
199       ,attribute11
200       ,attribute12
201       ,attribute13
202       ,attribute14
203       ,attribute15
204       ,attribute16
205       ,attribute17
206       ,attribute18
207       ,attribute19
208       ,attribute20
209       ,information_category
210       ,information1
211       ,information2
212       ,information3
213       ,information4
214       ,information5
215       ,information6
216       ,information7
217       ,information8
218       ,information9
219       ,information10
220       ,information11
221       ,information12
222       ,information13
223       ,information14
224       ,information15
225       ,information16
226       ,information17
227       ,information18
228       ,information19
229       ,information20
230       ,object_version_number
231     from        per_comp_element_outcomes
232     where       comp_element_outcome_id = p_comp_element_outcome_id
233     for update nowait;
234 --
235   l_proc        varchar2(72) := g_package||'lck';
236 --
237 Begin
238   hr_utility.set_location('Entering:'||l_proc, 5);
239   --
240   hr_api.mandatory_arg_error
241     (p_api_name           => l_proc
242     ,p_argument           => 'COMP_ELEMENT_OUTCOME_ID'
243     ,p_argument_value     => p_comp_element_outcome_id
244     );
245   hr_utility.set_location(l_proc,6);
246   hr_api.mandatory_arg_error
247     (p_api_name           => l_proc
248     ,p_argument           => 'OBJECT_VERSION_NUMBER'
249     ,p_argument_value     => p_object_version_number
250     );
251   --
252   hr_utility.set_location(l_proc,7);
253   Open  C_Sel1;
254   Fetch C_Sel1 Into per_ceo_shd.g_old_rec;
255   If C_Sel1%notfound then
256     Close C_Sel1;
257   hr_utility.set_location(l_proc,8);
258     --
259     -- The primary key is invalid therefore we must error
260     --
261     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
262     fnd_message.raise_error;
263   End If;
264   Close C_Sel1;
265   If (p_object_version_number
266       <> per_ceo_shd.g_old_rec.object_version_number) Then
267   hr_utility.set_location(l_proc,9);
268         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
269         fnd_message.raise_error;
270   End If;
271   --
272   hr_utility.set_location(' Leaving:'||l_proc, 10);
273   --
274   -- We need to trap the ORA LOCK exception
275   --
276 Exception
277   When HR_Api.Object_Locked then
278     --
279     -- The object is locked therefore we need to supply a meaningful
280     -- error message.
281     --
282     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
283     fnd_message.set_token('TABLE_NAME', 'per_comp_element_outcomes');
284     fnd_message.raise_error;
285 End lck;
286 --
287 -- ----------------------------------------------------------------------------
288 -- |-----------------------------< convert_args >-----------------------------|
289 -- ----------------------------------------------------------------------------
290 Function convert_args
291   (p_comp_element_outcome_id        in number
292   ,p_competence_element_id          in number
293   ,p_outcome_id                     in number
294   ,p_date_from                      in date
295   ,p_date_to                        in date
296   ,p_attribute_category             in varchar2
297   ,p_attribute1                     in varchar2
298   ,p_attribute2                     in varchar2
299   ,p_attribute3                     in varchar2
300   ,p_attribute4                     in varchar2
301   ,p_attribute5                     in varchar2
302   ,p_attribute6                     in varchar2
303   ,p_attribute7                     in varchar2
304   ,p_attribute8                     in varchar2
305   ,p_attribute9                     in varchar2
306   ,p_attribute10                    in varchar2
307   ,p_attribute11                    in varchar2
308   ,p_attribute12                    in varchar2
309   ,p_attribute13                    in varchar2
310   ,p_attribute14                    in varchar2
311   ,p_attribute15                    in varchar2
312   ,p_attribute16                    in varchar2
313   ,p_attribute17                    in varchar2
314   ,p_attribute18                    in varchar2
315   ,p_attribute19                    in varchar2
316   ,p_attribute20                    in varchar2
317   ,p_information_category           in varchar2
318   ,p_information1                   in varchar2
319   ,p_information2                   in varchar2
320   ,p_information3                   in varchar2
321   ,p_information4                   in varchar2
322   ,p_information5                   in varchar2
323   ,p_information6                   in varchar2
324   ,p_information7                   in varchar2
325   ,p_information8                   in varchar2
326   ,p_information9                   in varchar2
327   ,p_information10                  in varchar2
328   ,p_information11                  in varchar2
329   ,p_information12                  in varchar2
330   ,p_information13                  in varchar2
331   ,p_information14                  in varchar2
332   ,p_information15                  in varchar2
333   ,p_information16                  in varchar2
334   ,p_information17                  in varchar2
335   ,p_information18                  in varchar2
336   ,p_information19                  in varchar2
337   ,p_information20                  in varchar2
338   ,p_object_version_number          in number
339   )
340   Return g_rec_type is
341 --
342   l_rec   g_rec_type;
343 --
344 Begin
345   --
346   -- Convert arguments into local l_rec structure.
347   --
348   l_rec.comp_element_outcome_id          := p_comp_element_outcome_id;
349   l_rec.competence_element_id            := p_competence_element_id;
350   l_rec.outcome_id                       := p_outcome_id;
351   l_rec.date_from                        := p_date_from;
352   l_rec.date_to                          := p_date_to;
353   l_rec.attribute_category               := p_attribute_category;
354   l_rec.attribute1                       := p_attribute1;
355   l_rec.attribute2                       := p_attribute2;
356   l_rec.attribute3                       := p_attribute3;
357   l_rec.attribute4                       := p_attribute4;
358   l_rec.attribute5                       := p_attribute5;
359   l_rec.attribute6                       := p_attribute6;
360   l_rec.attribute7                       := p_attribute7;
361   l_rec.attribute8                       := p_attribute8;
362   l_rec.attribute9                       := p_attribute9;
363   l_rec.attribute10                      := p_attribute10;
364   l_rec.attribute11                      := p_attribute11;
365   l_rec.attribute12                      := p_attribute12;
366   l_rec.attribute13                      := p_attribute13;
367   l_rec.attribute14                      := p_attribute14;
368   l_rec.attribute15                      := p_attribute15;
369   l_rec.attribute16                      := p_attribute16;
370   l_rec.attribute17                      := p_attribute17;
371   l_rec.attribute18                      := p_attribute18;
372   l_rec.attribute19                      := p_attribute19;
373   l_rec.attribute20                      := p_attribute20;
374   l_rec.information_category             := p_information_category;
375   l_rec.information1                     := p_information1;
376   l_rec.information2                     := p_information2;
377   l_rec.information3                     := p_information3;
378   l_rec.information4                     := p_information4;
379   l_rec.information5                     := p_information5;
380   l_rec.information6                     := p_information6;
381   l_rec.information7                     := p_information7;
382   l_rec.information8                     := p_information8;
383   l_rec.information9                     := p_information9;
384   l_rec.information10                    := p_information10;
385   l_rec.information11                    := p_information11;
386   l_rec.information12                    := p_information12;
387   l_rec.information13                    := p_information13;
388   l_rec.information14                    := p_information14;
389   l_rec.information15                    := p_information15;
390   l_rec.information16                    := p_information16;
391   l_rec.information17                    := p_information17;
392   l_rec.information18                    := p_information18;
393   l_rec.information19                    := p_information19;
394   l_rec.information20                    := p_information20;
395   l_rec.object_version_number            := p_object_version_number;
396   --
397   -- Return the plsql record structure.
398   --
399   Return(l_rec);
400 --
401 End convert_args;
402 --
403 end per_ceo_shd;