DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PGV_INS

Source


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