DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PGH_INS

Source


1 Package Body per_pgh_ins 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_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic. The processing of
17 --   this procedure are as follows:
18 --   1) Initialise the object_version_number to 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To insert the row into the schema.
23 --   4) To trap any constraint violations that may have occurred.
24 --   5) To raise any other errors.
25 --
26 -- Prerequisites:
27 --   This is an internal private procedure which must be called from the ins
28 --   procedure and must have all mandatory attributes set (except the
29 --   object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 --   On the insert dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   None.
47 --
48 -- Access Status:
49 --   Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml
54   (p_rec in out nocopy per_pgh_shd.g_rec_type
55   ) is
56 --
57   l_proc  varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60   hr_utility.set_location('Entering:'||l_proc, 5);
61   p_rec.object_version_number := 1;  -- Initialise the object version
62   --
63   --
64   --
65   -- Insert the row into: per_gen_hierarchy
66   --
67   insert into per_gen_hierarchy
68       (hierarchy_id
69       ,business_group_id
70       ,name
71       ,type
72       ,request_id
73       ,program_application_id
74       ,program_id
75       ,program_update_date
76       ,object_version_number
77       ,attribute_category
78       ,attribute1
79       ,attribute2
80       ,attribute3
81       ,attribute4
82       ,attribute5
83       ,attribute6
84       ,attribute7
85       ,attribute8
86       ,attribute9
87       ,attribute10
88       ,attribute11
89       ,attribute12
90       ,attribute13
91       ,attribute14
92       ,attribute15
93       ,attribute16
94       ,attribute17
95       ,attribute18
96       ,attribute19
97       ,attribute20
98       ,attribute21
99       ,attribute22
100       ,attribute23
101       ,attribute24
102       ,attribute25
103       ,attribute26
104       ,attribute27
105       ,attribute28
106       ,attribute29
107       ,attribute30
108       ,information_category
109       ,information1
110       ,information2
111       ,information3
112       ,information4
113       ,information5
114       ,information6
115       ,information7
116       ,information8
117       ,information9
118       ,information10
119       ,information11
120       ,information12
121       ,information13
122       ,information14
123       ,information15
124       ,information16
125       ,information17
126       ,information18
127       ,information19
128       ,information20
129       ,information21
130       ,information22
131       ,information23
132       ,information24
133       ,information25
134       ,information26
135       ,information27
136       ,information28
137       ,information29
138       ,information30
139       )
140   Values
141     (p_rec.hierarchy_id
142     ,p_rec.business_group_id
143     ,p_rec.name
144     ,p_rec.type
145     ,p_rec.request_id
146     ,p_rec.program_application_id
147     ,p_rec.program_id
148     ,p_rec.program_update_date
149     ,p_rec.object_version_number
150     ,p_rec.attribute_category
151     ,p_rec.attribute1
152     ,p_rec.attribute2
153     ,p_rec.attribute3
154     ,p_rec.attribute4
155     ,p_rec.attribute5
156     ,p_rec.attribute6
157     ,p_rec.attribute7
158     ,p_rec.attribute8
159     ,p_rec.attribute9
160     ,p_rec.attribute10
161     ,p_rec.attribute11
162     ,p_rec.attribute12
163     ,p_rec.attribute13
164     ,p_rec.attribute14
165     ,p_rec.attribute15
166     ,p_rec.attribute16
167     ,p_rec.attribute17
168     ,p_rec.attribute18
169     ,p_rec.attribute19
170     ,p_rec.attribute20
171     ,p_rec.attribute21
172     ,p_rec.attribute22
173     ,p_rec.attribute23
174     ,p_rec.attribute24
175     ,p_rec.attribute25
176     ,p_rec.attribute26
177     ,p_rec.attribute27
178     ,p_rec.attribute28
179     ,p_rec.attribute29
180     ,p_rec.attribute30
181     ,p_rec.information_category
182     ,p_rec.information1
183     ,p_rec.information2
184     ,p_rec.information3
185     ,p_rec.information4
186     ,p_rec.information5
187     ,p_rec.information6
188     ,p_rec.information7
189     ,p_rec.information8
190     ,p_rec.information9
191     ,p_rec.information10
192     ,p_rec.information11
193     ,p_rec.information12
194     ,p_rec.information13
195     ,p_rec.information14
196     ,p_rec.information15
197     ,p_rec.information16
198     ,p_rec.information17
199     ,p_rec.information18
200     ,p_rec.information19
201     ,p_rec.information20
202     ,p_rec.information21
203     ,p_rec.information22
204     ,p_rec.information23
205     ,p_rec.information24
206     ,p_rec.information25
207     ,p_rec.information26
208     ,p_rec.information27
209     ,p_rec.information28
210     ,p_rec.information29
211     ,p_rec.information30
212     );
213   --
214   --
215   --
216   hr_utility.set_location(' Leaving:'||l_proc, 10);
217 Exception
218   When hr_api.check_integrity_violated Then
219     -- A check constraint has been violated
220     --
221     per_pgh_shd.constraint_error
222       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
223   When hr_api.parent_integrity_violated Then
224     -- Parent integrity has been violated
225     --
226     per_pgh_shd.constraint_error
227       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
228   When hr_api.unique_integrity_violated Then
229     -- Unique integrity has been violated
230     --
231     per_pgh_shd.constraint_error
232       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
233   When Others Then
234     --
235     Raise;
236 End insert_dml;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |------------------------------< pre_insert >------------------------------|
240 -- ----------------------------------------------------------------------------
241 -- {Start Of Comments}
242 --
243 -- Description:
244 --   This private procedure contains any processing which is required before
245 --   the insert dml. Presently, if the entity has a corresponding primary
246 --   key which is maintained by an associating sequence, the primary key for
247 --   the entity will be populated with the next sequence value in
248 --   preparation for the insert dml.
249 --
250 -- Prerequisites:
251 --   This is an internal procedure which is called from the ins procedure.
252 --
253 -- In Parameters:
254 --   A Pl/Sql record structre.
255 --
256 -- Post Success:
257 --   Processing continues.
258 --
259 -- Post Failure:
260 --   If an error has occurred, an error message and exception will be raised
261 --   but not handled.
262 --
263 -- Developer Implementation Notes:
264 --   Any pre-processing required before the insert dml is issued should be
265 --   coded within this procedure. As stated above, a good example is the
266 --   generation of a primary key number via a corresponding sequence.
267 --   It is important to note that any 3rd party maintenance should be reviewed
268 --   before placing in this procedure.
269 --
270 -- Access Status:
271 --   Internal Row Handler Use Only.
272 --
273 -- {End Of Comments}
274 -- ----------------------------------------------------------------------------
275 Procedure pre_insert
276   (p_rec  in out nocopy per_pgh_shd.g_rec_type
277   ) is
278 --
279   l_proc  varchar2(72) := g_package||'pre_insert';
280 --
281   Cursor C_Sel1 is select per_gen_hierarchy_s.nextval from sys.dual;
282 --
283 Begin
284   hr_utility.set_location('Entering:'||l_proc, 5);
285   --
286   --
287   -- Select the next sequence number
288   --
289   Open C_Sel1;
290   Fetch C_Sel1 Into p_rec.hierarchy_id;
291   Close C_Sel1;
292   --
293   hr_utility.set_location(' Leaving:'||l_proc, 10);
294 End pre_insert;
295 --
296 -- ----------------------------------------------------------------------------
297 -- |-----------------------------< post_insert >------------------------------|
298 -- ----------------------------------------------------------------------------
299 -- {Start Of Comments}
300 --
301 -- Description:
302 --   This private procedure contains any processing which is required after the
303 --   insert dml.
304 --
305 -- Prerequisites:
306 --   This is an internal procedure which is called from the ins procedure.
307 --
308 -- In Parameters:
309 --   A Pl/Sql record structre.
310 --
311 -- Post Success:
312 --   Processing continues.
313 --
314 -- Post Failure:
315 --   If an error has occurred, an error message and exception will be raised
316 --   but not handled.
317 --
318 -- Developer Implementation Notes:
319 --   Any post-processing required after the insert dml is issued should be
320 --   coded within this procedure. It is important to note that any 3rd party
321 --   maintenance should be reviewed before placing in this procedure.
322 --
323 -- Access Status:
324 --   Internal Row Handler Use Only.
325 --
326 -- {End Of Comments}
327 -- ----------------------------------------------------------------------------
328 Procedure post_insert
329   (p_effective_date               in date
330   ,p_rec                          in per_pgh_shd.g_rec_type
331   ) is
332 --
333   l_proc  varchar2(72) := g_package||'post_insert';
334 --
335 Begin
336   hr_utility.set_location('Entering:'||l_proc, 5);
337   begin
338     --
339     per_pgh_rki.after_insert
340       (p_effective_date              => p_effective_date
341       ,p_hierarchy_id
342       => p_rec.hierarchy_id
343       ,p_business_group_id
344       => p_rec.business_group_id
345       ,p_name
346       => p_rec.name
347       ,p_type
348       => p_rec.type
349       ,p_request_id
350       => p_rec.request_id
351       ,p_program_application_id
352       => p_rec.program_application_id
353       ,p_program_id
354       => p_rec.program_id
355       ,p_program_update_date
356       => p_rec.program_update_date
357       ,p_object_version_number
358       => p_rec.object_version_number
359       ,p_attribute_category
360       => p_rec.attribute_category
361       ,p_attribute1
362       => p_rec.attribute1
363       ,p_attribute2
364       => p_rec.attribute2
365       ,p_attribute3
366       => p_rec.attribute3
367       ,p_attribute4
368       => p_rec.attribute4
369       ,p_attribute5
370       => p_rec.attribute5
371       ,p_attribute6
372       => p_rec.attribute6
373       ,p_attribute7
374       => p_rec.attribute7
375       ,p_attribute8
376       => p_rec.attribute8
377       ,p_attribute9
378       => p_rec.attribute9
379       ,p_attribute10
380       => p_rec.attribute10
381       ,p_attribute11
382       => p_rec.attribute11
383       ,p_attribute12
384       => p_rec.attribute12
385       ,p_attribute13
386       => p_rec.attribute13
387       ,p_attribute14
388       => p_rec.attribute14
389       ,p_attribute15
390       => p_rec.attribute15
391       ,p_attribute16
392       => p_rec.attribute16
393       ,p_attribute17
394       => p_rec.attribute17
395       ,p_attribute18
396       => p_rec.attribute18
397       ,p_attribute19
398       => p_rec.attribute19
399       ,p_attribute20
400       => p_rec.attribute20
401       ,p_attribute21
402       => p_rec.attribute21
403       ,p_attribute22
404       => p_rec.attribute22
405       ,p_attribute23
406       => p_rec.attribute23
407       ,p_attribute24
408       => p_rec.attribute24
409       ,p_attribute25
410       => p_rec.attribute25
411       ,p_attribute26
412       => p_rec.attribute26
413       ,p_attribute27
414       => p_rec.attribute27
415       ,p_attribute28
416       => p_rec.attribute28
417       ,p_attribute29
418       => p_rec.attribute29
419       ,p_attribute30
420       => p_rec.attribute30
421       ,p_information_category
422       => p_rec.information_category
423       ,p_information1
424       => p_rec.information1
425       ,p_information2
426       => p_rec.information2
427       ,p_information3
428       => p_rec.information3
429       ,p_information4
430       => p_rec.information4
431       ,p_information5
432       => p_rec.information5
433       ,p_information6
434       => p_rec.information6
435       ,p_information7
436       => p_rec.information7
437       ,p_information8
438       => p_rec.information8
439       ,p_information9
440       => p_rec.information9
441       ,p_information10
442       => p_rec.information10
443       ,p_information11
444       => p_rec.information11
445       ,p_information12
446       => p_rec.information12
447       ,p_information13
448       => p_rec.information13
449       ,p_information14
450       => p_rec.information14
451       ,p_information15
452       => p_rec.information15
453       ,p_information16
454       => p_rec.information16
455       ,p_information17
456       => p_rec.information17
457       ,p_information18
458       => p_rec.information18
459       ,p_information19
460       => p_rec.information19
461       ,p_information20
462       => p_rec.information20
463       ,p_information21
464       => p_rec.information21
465       ,p_information22
466       => p_rec.information22
467       ,p_information23
468       => p_rec.information23
469       ,p_information24
470       => p_rec.information24
471       ,p_information25
472       => p_rec.information25
473       ,p_information26
474       => p_rec.information26
475       ,p_information27
476       => p_rec.information27
477       ,p_information28
478       => p_rec.information28
479       ,p_information29
480       => p_rec.information29
481       ,p_information30
482       => p_rec.information30
483     );
484     --
485   exception
486     --
487     when hr_api.cannot_find_prog_unit then
488       --
489       hr_api.cannot_find_prog_unit_error
490         (p_module_name => 'PER_GEN_HIERARCHY'
491         ,p_hook_type   => 'AI');
492       --
493   end;
494   --
495   hr_utility.set_location(' Leaving:'||l_proc, 10);
496 End post_insert;
497 --
498 -- ----------------------------------------------------------------------------
499 -- |---------------------------------< ins >----------------------------------|
500 -- ----------------------------------------------------------------------------
501 Procedure ins
502   (p_effective_date               in date
503   ,p_rec                          in out nocopy per_pgh_shd.g_rec_type
504   ) is
505 --
506   l_proc  varchar2(72) := g_package||'ins';
507 --
508 Begin
509   hr_utility.set_location('Entering:'||l_proc, 5);
510   --
511   -- Call the supporting insert validate operations
512   --
513   per_pgh_bus.insert_validate
514      (p_effective_date
515      ,p_rec
516      );
517   --
518   -- Call the supporting pre-insert operation
519   --
520   per_pgh_ins.pre_insert(p_rec);
521   --
522   -- Insert the row
523   --
524   per_pgh_ins.insert_dml(p_rec);
525   --
526   -- Call the supporting post-insert operation
527   --
528   per_pgh_ins.post_insert
529      (p_effective_date
530      ,p_rec
531      );
532   --
533   hr_utility.set_location('Leaving:'||l_proc, 20);
534 end ins;
535 --
536 -- ----------------------------------------------------------------------------
537 -- |---------------------------------< ins >----------------------------------|
538 -- ----------------------------------------------------------------------------
539 Procedure ins
540   (p_effective_date               in     date
541   ,p_business_group_id              in     number
542   ,p_name                           in     varchar2
543   ,p_type                           in     varchar2
544   ,p_request_id                     in     number   default null
545   ,p_program_application_id         in     number   default null
546   ,p_program_id                     in     number   default null
547   ,p_program_update_date            in     date     default null
548   ,p_attribute_category             in     varchar2 default null
549   ,p_attribute1                     in     varchar2 default null
550   ,p_attribute2                     in     varchar2 default null
551   ,p_attribute3                     in     varchar2 default null
552   ,p_attribute4                     in     varchar2 default null
553   ,p_attribute5                     in     varchar2 default null
554   ,p_attribute6                     in     varchar2 default null
555   ,p_attribute7                     in     varchar2 default null
556   ,p_attribute8                     in     varchar2 default null
557   ,p_attribute9                     in     varchar2 default null
558   ,p_attribute10                    in     varchar2 default null
559   ,p_attribute11                    in     varchar2 default null
560   ,p_attribute12                    in     varchar2 default null
561   ,p_attribute13                    in     varchar2 default null
562   ,p_attribute14                    in     varchar2 default null
563   ,p_attribute15                    in     varchar2 default null
564   ,p_attribute16                    in     varchar2 default null
565   ,p_attribute17                    in     varchar2 default null
566   ,p_attribute18                    in     varchar2 default null
567   ,p_attribute19                    in     varchar2 default null
571   ,p_attribute23                    in     varchar2 default null
568   ,p_attribute20                    in     varchar2 default null
569   ,p_attribute21                    in     varchar2 default null
570   ,p_attribute22                    in     varchar2 default null
572   ,p_attribute24                    in     varchar2 default null
573   ,p_attribute25                    in     varchar2 default null
574   ,p_attribute26                    in     varchar2 default null
575   ,p_attribute27                    in     varchar2 default null
576   ,p_attribute28                    in     varchar2 default null
577   ,p_attribute29                    in     varchar2 default null
578   ,p_attribute30                    in     varchar2 default null
579   ,p_information_category           in     varchar2 default null
580   ,p_information1                   in     varchar2 default null
581   ,p_information2                   in     varchar2 default null
582   ,p_information3                   in     varchar2 default null
583   ,p_information4                   in     varchar2 default null
584   ,p_information5                   in     varchar2 default null
585   ,p_information6                   in     varchar2 default null
586   ,p_information7                   in     varchar2 default null
587   ,p_information8                   in     varchar2 default null
588   ,p_information9                   in     varchar2 default null
589   ,p_information10                  in     varchar2 default null
590   ,p_information11                  in     varchar2 default null
591   ,p_information12                  in     varchar2 default null
592   ,p_information13                  in     varchar2 default null
593   ,p_information14                  in     varchar2 default null
594   ,p_information15                  in     varchar2 default null
595   ,p_information16                  in     varchar2 default null
596   ,p_information17                  in     varchar2 default null
597   ,p_information18                  in     varchar2 default null
598   ,p_information19                  in     varchar2 default null
599   ,p_information20                  in     varchar2 default null
600   ,p_information21                  in     varchar2 default null
601   ,p_information22                  in     varchar2 default null
602   ,p_information23                  in     varchar2 default null
603   ,p_information24                  in     varchar2 default null
604   ,p_information25                  in     varchar2 default null
605   ,p_information26                  in     varchar2 default null
606   ,p_information27                  in     varchar2 default null
607   ,p_information28                  in     varchar2 default null
608   ,p_information29                  in     varchar2 default null
609   ,p_information30                  in     varchar2 default null
610   ,p_hierarchy_id                   in    out nocopy number
611   ,p_object_version_number          in    out nocopy number
612   ) is
613 --
614   l_rec	  per_pgh_shd.g_rec_type;
615   l_proc  varchar2(72) := g_package||'ins';
616 --
617 Begin
618   hr_utility.set_location('Entering:'||l_proc, 5);
619   --
620   -- Call conversion function to turn arguments into the
621   -- p_rec structure.
622   --
623   l_rec :=
624   per_pgh_shd.convert_args
625     (null
626     ,p_business_group_id
627     ,p_name
628     ,p_type
629     ,p_request_id
630     ,p_program_application_id
631     ,p_program_id
632     ,p_program_update_date
633     ,null
634     ,p_attribute_category
635     ,p_attribute1
636     ,p_attribute2
637     ,p_attribute3
638     ,p_attribute4
639     ,p_attribute5
640     ,p_attribute6
641     ,p_attribute7
642     ,p_attribute8
643     ,p_attribute9
644     ,p_attribute10
645     ,p_attribute11
646     ,p_attribute12
647     ,p_attribute13
648     ,p_attribute14
649     ,p_attribute15
650     ,p_attribute16
651     ,p_attribute17
652     ,p_attribute18
653     ,p_attribute19
654     ,p_attribute20
655     ,p_attribute21
656     ,p_attribute22
657     ,p_attribute23
658     ,p_attribute24
659     ,p_attribute25
660     ,p_attribute26
661     ,p_attribute27
662     ,p_attribute28
663     ,p_attribute29
664     ,p_attribute30
665     ,p_information_category
666     ,p_information1
667     ,p_information2
668     ,p_information3
669     ,p_information4
670     ,p_information5
671     ,p_information6
672     ,p_information7
673     ,p_information8
674     ,p_information9
675     ,p_information10
676     ,p_information11
677     ,p_information12
678     ,p_information13
679     ,p_information14
680     ,p_information15
681     ,p_information16
682     ,p_information17
683     ,p_information18
684     ,p_information19
685     ,p_information20
686     ,p_information21
687     ,p_information22
688     ,p_information23
689     ,p_information24
690     ,p_information25
691     ,p_information26
692     ,p_information27
693     ,p_information28
694     ,p_information29
695     ,p_information30
696     );
697   --
698   -- Having converted the arguments into the per_pgh_rec
699   -- plsql record structure we call the corresponding record business process.
700   --
701   per_pgh_ins.ins
702      (p_effective_date
703      ,l_rec
704      );
705   --
706   -- As the primary key argument(s)
707   -- are specified as an OUT's we must set these values.
708   --
709   p_hierarchy_id := l_rec.hierarchy_id;
710   p_object_version_number := l_rec.object_version_number;
711   --
712   hr_utility.set_location(' Leaving:'||l_proc, 10);
713 End ins;
714 --
715 end per_pgh_ins;