DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PGH_SHD

Source


1 Package Body per_pgh_shd as
2 /* $Header: pepghrhi.pkb 120.0 2005/05/31 14:05:56 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pgh_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 	varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PER_GEN_HIERARCHY_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   ElsIf (p_constraint_name = 'PER_GEN_HIERARCHY_UK1') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
37   --
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_hierarchy_id                         in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48 --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        hierarchy_id
55       ,business_group_id
56       ,name
57       ,type
58       ,request_id
59       ,program_application_id
60       ,program_id
61       ,program_update_date
62       ,object_version_number
63       ,attribute_category
64       ,attribute1
65       ,attribute2
66       ,attribute3
67       ,attribute4
68       ,attribute5
69       ,attribute6
70       ,attribute7
71       ,attribute8
72       ,attribute9
73       ,attribute10
74       ,attribute11
75       ,attribute12
76       ,attribute13
77       ,attribute14
78       ,attribute15
79       ,attribute16
80       ,attribute17
81       ,attribute18
82       ,attribute19
83       ,attribute20
84       ,attribute21
85       ,attribute22
86       ,attribute23
87       ,attribute24
88       ,attribute25
89       ,attribute26
90       ,attribute27
91       ,attribute28
92       ,attribute29
93       ,attribute30
94       ,information_category
95       ,information1
96       ,information2
97       ,information3
98       ,information4
99       ,information5
100       ,information6
101       ,information7
102       ,information8
103       ,information9
104       ,information10
105       ,information11
106       ,information12
107       ,information13
108       ,information14
109       ,information15
110       ,information16
111       ,information17
112       ,information18
113       ,information19
114       ,information20
115       ,information21
116       ,information22
117       ,information23
118       ,information24
119       ,information25
120       ,information26
121       ,information27
122       ,information28
123       ,information29
124       ,information30
125     from	per_gen_hierarchy
126     where	hierarchy_id = p_hierarchy_id;
127 --
128   l_fct_ret	boolean;
129 --
130 Begin
131   --
132   If (p_hierarchy_id is null and
133       p_object_version_number is null
134      ) Then
135     --
136     -- One of the primary key arguments is null therefore we must
137     -- set the returning function value to false
138     --
139     l_fct_ret := false;
140   Else
141     If (p_hierarchy_id
142         = per_pgh_shd.g_old_rec.hierarchy_id and
143         p_object_version_number
144         = per_pgh_shd.g_old_rec.object_version_number
145        ) Then
146       --
147       -- The g_old_rec is current therefore we must
148       -- set the returning function to true
149       --
150       l_fct_ret := true;
151     Else
152       --
153       -- Select the current row into g_old_rec
154       --
155       Open C_Sel1;
156       Fetch C_Sel1 Into per_pgh_shd.g_old_rec;
157       If C_Sel1%notfound Then
158         Close C_Sel1;
159         --
160         -- The primary key is invalid therefore we must error
161         --
162         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
163         fnd_message.raise_error;
164       End If;
165       Close C_Sel1;
166       If (p_object_version_number
167           <> per_pgh_shd.g_old_rec.object_version_number) Then
168         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
169         fnd_message.raise_error;
170       End If;
171       l_fct_ret := true;
172     End If;
173   End If;
174   Return (l_fct_ret);
175 --
176 End api_updating;
177 --
178 -- ----------------------------------------------------------------------------
179 -- |---------------------------------< lck >----------------------------------|
180 -- ----------------------------------------------------------------------------
181 Procedure lck
182   (p_hierarchy_id                         in     number
183   ,p_object_version_number                in     number
184   ) is
185 --
186 -- Cursor selects the 'current' row from the HR Schema
187 --
188   Cursor C_Sel1 is
189     select
190        hierarchy_id
191       ,business_group_id
192       ,name
193       ,type
194       ,request_id
195       ,program_application_id
196       ,program_id
197       ,program_update_date
198       ,object_version_number
199       ,attribute_category
200       ,attribute1
201       ,attribute2
202       ,attribute3
203       ,attribute4
204       ,attribute5
205       ,attribute6
206       ,attribute7
207       ,attribute8
208       ,attribute9
209       ,attribute10
213       ,attribute14
210       ,attribute11
211       ,attribute12
212       ,attribute13
214       ,attribute15
215       ,attribute16
216       ,attribute17
217       ,attribute18
218       ,attribute19
219       ,attribute20
220       ,attribute21
221       ,attribute22
222       ,attribute23
223       ,attribute24
224       ,attribute25
225       ,attribute26
226       ,attribute27
227       ,attribute28
228       ,attribute29
229       ,attribute30
230       ,information_category
231       ,information1
232       ,information2
233       ,information3
234       ,information4
235       ,information5
236       ,information6
237       ,information7
238       ,information8
239       ,information9
240       ,information10
241       ,information11
242       ,information12
243       ,information13
244       ,information14
245       ,information15
246       ,information16
247       ,information17
248       ,information18
249       ,information19
250       ,information20
251       ,information21
252       ,information22
253       ,information23
254       ,information24
255       ,information25
256       ,information26
257       ,information27
258       ,information28
259       ,information29
260       ,information30
261     from	per_gen_hierarchy
262     where	hierarchy_id = p_hierarchy_id
263     for	update nowait;
264 --
265   l_proc	varchar2(72) := g_package||'lck';
266 --
267 Begin
268   hr_utility.set_location('Entering:'||l_proc, 5);
269   --
270   hr_api.mandatory_arg_error
271     (p_api_name           => l_proc
272     ,p_argument           => 'HIERARCHY_ID'
273     ,p_argument_value     => p_hierarchy_id
274     );
275   --
276   Open  C_Sel1;
277   Fetch C_Sel1 Into per_pgh_shd.g_old_rec;
278   If C_Sel1%notfound then
279     Close C_Sel1;
280     --
281     -- The primary key is invalid therefore we must error
282     --
283     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
284     fnd_message.raise_error;
285   End If;
286   Close C_Sel1;
287   If (p_object_version_number
288       <> per_pgh_shd.g_old_rec.object_version_number) Then
289         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
290         fnd_message.raise_error;
291   End If;
292   --
293   hr_utility.set_location(' Leaving:'||l_proc, 10);
294   --
295   -- We need to trap the ORA LOCK exception
296   --
297 Exception
298   When HR_Api.Object_Locked then
299     --
300     -- The object is locked therefore we need to supply a meaningful
301     -- error message.
302     --
303     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
304     fnd_message.set_token('TABLE_NAME', 'per_gen_hierarchy');
305     fnd_message.raise_error;
306 End lck;
307 --
308 -- ----------------------------------------------------------------------------
309 -- |-----------------------------< convert_args >-----------------------------|
310 -- ----------------------------------------------------------------------------
311 Function convert_args
312   (p_hierarchy_id                   in number
313   ,p_business_group_id              in number
314   ,p_name                           in varchar2
315   ,p_type                           in varchar2
316   ,p_request_id                     in number
317   ,p_program_application_id         in number
318   ,p_program_id                     in number
319   ,p_program_update_date            in date
320   ,p_object_version_number          in number
321   ,p_attribute_category             in varchar2
322   ,p_attribute1                     in varchar2
323   ,p_attribute2                     in varchar2
324   ,p_attribute3                     in varchar2
325   ,p_attribute4                     in varchar2
326   ,p_attribute5                     in varchar2
327   ,p_attribute6                     in varchar2
328   ,p_attribute7                     in varchar2
329   ,p_attribute8                     in varchar2
330   ,p_attribute9                     in varchar2
331   ,p_attribute10                    in varchar2
332   ,p_attribute11                    in varchar2
333   ,p_attribute12                    in varchar2
334   ,p_attribute13                    in varchar2
335   ,p_attribute14                    in varchar2
336   ,p_attribute15                    in varchar2
337   ,p_attribute16                    in varchar2
338   ,p_attribute17                    in varchar2
339   ,p_attribute18                    in varchar2
340   ,p_attribute19                    in varchar2
341   ,p_attribute20                    in varchar2
342   ,p_attribute21                    in varchar2
343   ,p_attribute22                    in varchar2
344   ,p_attribute23                    in varchar2
345   ,p_attribute24                    in varchar2
346   ,p_attribute25                    in varchar2
347   ,p_attribute26                    in varchar2
348   ,p_attribute27                    in varchar2
349   ,p_attribute28                    in varchar2
350   ,p_attribute29                    in varchar2
351   ,p_attribute30                    in varchar2
352   ,p_information_category           in varchar2
353   ,p_information1                   in varchar2
354   ,p_information2                   in varchar2
355   ,p_information3                   in varchar2
359   ,p_information7                   in varchar2
356   ,p_information4                   in varchar2
357   ,p_information5                   in varchar2
358   ,p_information6                   in varchar2
360   ,p_information8                   in varchar2
361   ,p_information9                   in varchar2
362   ,p_information10                  in varchar2
363   ,p_information11                  in varchar2
364   ,p_information12                  in varchar2
365   ,p_information13                  in varchar2
366   ,p_information14                  in varchar2
367   ,p_information15                  in varchar2
368   ,p_information16                  in varchar2
369   ,p_information17                  in varchar2
370   ,p_information18                  in varchar2
371   ,p_information19                  in varchar2
372   ,p_information20                  in varchar2
373   ,p_information21                  in varchar2
374   ,p_information22                  in varchar2
375   ,p_information23                  in varchar2
376   ,p_information24                  in varchar2
377   ,p_information25                  in varchar2
378   ,p_information26                  in varchar2
379   ,p_information27                  in varchar2
380   ,p_information28                  in varchar2
381   ,p_information29                  in varchar2
382   ,p_information30                  in varchar2
383   )
384   Return g_rec_type is
385 --
386   l_rec   g_rec_type;
387 --
388 Begin
389   --
390   -- Convert arguments into local l_rec structure.
391   --
392   l_rec.hierarchy_id                     := p_hierarchy_id;
393   l_rec.business_group_id                := p_business_group_id;
394   l_rec.name                             := p_name;
395   l_rec.type                             := p_type;
396   l_rec.request_id                       := p_request_id;
397   l_rec.program_application_id           := p_program_application_id;
398   l_rec.program_id                       := p_program_id;
399   l_rec.program_update_date              := p_program_update_date;
400   l_rec.object_version_number            := p_object_version_number;
401   l_rec.attribute_category               := p_attribute_category;
402   l_rec.attribute1                       := p_attribute1;
403   l_rec.attribute2                       := p_attribute2;
404   l_rec.attribute3                       := p_attribute3;
405   l_rec.attribute4                       := p_attribute4;
406   l_rec.attribute5                       := p_attribute5;
407   l_rec.attribute6                       := p_attribute6;
408   l_rec.attribute7                       := p_attribute7;
409   l_rec.attribute8                       := p_attribute8;
410   l_rec.attribute9                       := p_attribute9;
411   l_rec.attribute10                      := p_attribute10;
412   l_rec.attribute11                      := p_attribute11;
413   l_rec.attribute12                      := p_attribute12;
414   l_rec.attribute13                      := p_attribute13;
415   l_rec.attribute14                      := p_attribute14;
416   l_rec.attribute15                      := p_attribute15;
417   l_rec.attribute16                      := p_attribute16;
418   l_rec.attribute17                      := p_attribute17;
419   l_rec.attribute18                      := p_attribute18;
420   l_rec.attribute19                      := p_attribute19;
421   l_rec.attribute20                      := p_attribute20;
422   l_rec.attribute21                      := p_attribute21;
423   l_rec.attribute22                      := p_attribute22;
424   l_rec.attribute23                      := p_attribute23;
425   l_rec.attribute24                      := p_attribute24;
426   l_rec.attribute25                      := p_attribute25;
427   l_rec.attribute26                      := p_attribute26;
428   l_rec.attribute27                      := p_attribute27;
429   l_rec.attribute28                      := p_attribute28;
430   l_rec.attribute29                      := p_attribute29;
431   l_rec.attribute30                      := p_attribute30;
432   l_rec.information_category             := p_information_category;
433   l_rec.information1                     := p_information1;
434   l_rec.information2                     := p_information2;
435   l_rec.information3                     := p_information3;
436   l_rec.information4                     := p_information4;
437   l_rec.information5                     := p_information5;
438   l_rec.information6                     := p_information6;
439   l_rec.information7                     := p_information7;
440   l_rec.information8                     := p_information8;
441   l_rec.information9                     := p_information9;
442   l_rec.information10                    := p_information10;
443   l_rec.information11                    := p_information11;
444   l_rec.information12                    := p_information12;
445   l_rec.information13                    := p_information13;
446   l_rec.information14                    := p_information14;
447   l_rec.information15                    := p_information15;
448   l_rec.information16                    := p_information16;
449   l_rec.information17                    := p_information17;
450   l_rec.information18                    := p_information18;
451   l_rec.information19                    := p_information19;
452   l_rec.information20                    := p_information20;
453   l_rec.information21                    := p_information21;
454   l_rec.information22                    := p_information22;
455   l_rec.information23                    := p_information23;
456   l_rec.information24                    := p_information24;
457   l_rec.information25                    := p_information25;
458   l_rec.information26                    := p_information26;
459   l_rec.information27                    := p_information27;
460   l_rec.information28                    := p_information28;
461   l_rec.information29                    := p_information29;
462   l_rec.information30                    := p_information30;
463   --
464   -- Return the plsql record structure.
465   --
466   Return(l_rec);
467 --
468 End convert_args;
469 --
470 end per_pgh_shd;