DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ECA_INS

Source


1 Package Body per_eca_ins as
2 /* $Header: peecarhi.pkb 115.6 2002/12/05 10:25:53 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_eca_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_eca_shd.g_rec_type
55 ) is
56 --
57 l_proc  varchar2(72) := g_package||'insert_dml';
58   l_created_by          per_election_candidates.created_by%TYPE;
59   l_creation_date       per_election_candidates.creation_date%TYPE;
60   l_last_update_date    per_election_candidates.last_update_date%TYPE;
61   l_last_updated_by     per_election_candidates.last_updated_by%TYPE;
62   l_last_update_login   per_election_candidates.last_update_login%TYPE;
63 --
64 Begin
65 hr_utility.set_location('Entering:'||l_proc, 5);
66 p_rec.object_version_number := 1;  -- Initialise the object version
67 --
68 --
69   -- Set the who columns
70   --
71   l_creation_date      := sysdate;
72   l_created_by         := fnd_global.user_id;
73   l_last_update_date   := sysdate;
74   l_last_updated_by    := fnd_global.user_id;
75   l_last_update_login  := fnd_global.login_id;
76 --
77 -- Insert the row into: per_election_candidates
78 --
79 insert into per_election_candidates
80 (election_candidate_id
81 ,business_group_id
82 ,election_id
83 ,person_id
84 ,rank
85 ,role_id
86 ,attribute_category
87 ,attribute1
88 ,attribute2
89 ,attribute3
90 ,attribute4
91 ,attribute5
92 ,attribute6
93 ,attribute7
94 ,attribute8
95 ,attribute9
96 ,attribute10
97 ,attribute11
98 ,attribute12
99 ,attribute13
100 ,attribute14
101 ,attribute15
102 ,attribute16
103 ,attribute17
104 ,attribute18
105 ,attribute19
106 ,attribute20
107 ,attribute21
108 ,attribute22
109 ,attribute23
110 ,attribute24
111 ,attribute25
112 ,attribute26
113 ,attribute27
114 ,attribute28
115 ,attribute29
116 ,attribute30
117 ,candidate_info_category
118 ,candidate_information1
119 ,candidate_information2
120 ,candidate_information3
121 ,candidate_information4
122 ,candidate_information5
123 ,candidate_information6
124 ,candidate_information7
125 ,candidate_information8
126 ,candidate_information9
127 ,candidate_information10
128 ,candidate_information11
129 ,candidate_information12
130 ,candidate_information13
131 ,candidate_information14
132 ,candidate_information15
133 ,candidate_information16
134 ,candidate_information17
135 ,candidate_information18
136 ,candidate_information19
137 ,candidate_information20
138 ,candidate_information21
139 ,candidate_information22
140 ,candidate_information23
141 ,candidate_information24
142 ,candidate_information25
143 ,candidate_information26
144 ,candidate_information27
145 ,candidate_information28
146 ,candidate_information29
147 ,candidate_information30
148 ,object_version_number
149       ,creation_date
150       ,created_by
151       ,last_update_date
152       ,last_updated_by
153       ,last_update_login
154 )
155 Values
156 (p_rec.election_candidate_id
157 ,p_rec.business_group_id
158 ,p_rec.election_id
159 ,p_rec.person_id
160 ,p_rec.rank
161 ,p_rec.role_id
162 ,p_rec.attribute_category
163 ,p_rec.attribute1
164 ,p_rec.attribute2
165 ,p_rec.attribute3
166 ,p_rec.attribute4
167 ,p_rec.attribute5
168 ,p_rec.attribute6
169 ,p_rec.attribute7
170 ,p_rec.attribute8
171 ,p_rec.attribute9
172 ,p_rec.attribute10
173 ,p_rec.attribute11
174 ,p_rec.attribute12
175 ,p_rec.attribute13
176 ,p_rec.attribute14
177 ,p_rec.attribute15
178 ,p_rec.attribute16
179 ,p_rec.attribute17
180 ,p_rec.attribute18
181 ,p_rec.attribute19
182 ,p_rec.attribute20
183 ,p_rec.attribute21
184 ,p_rec.attribute22
185 ,p_rec.attribute23
186 ,p_rec.attribute24
187 ,p_rec.attribute25
188 ,p_rec.attribute26
189 ,p_rec.attribute27
190 ,p_rec.attribute28
191 ,p_rec.attribute29
192 ,p_rec.attribute30
193 ,p_rec.candidate_info_category
194 ,p_rec.candidate_information1
195 ,p_rec.candidate_information2
196 ,p_rec.candidate_information3
197 ,p_rec.candidate_information4
198 ,p_rec.candidate_information5
199 ,p_rec.candidate_information6
200 ,p_rec.candidate_information7
201 ,p_rec.candidate_information8
202 ,p_rec.candidate_information9
203 ,p_rec.candidate_information10
204 ,p_rec.candidate_information11
205 ,p_rec.candidate_information12
206 ,p_rec.candidate_information13
207 ,p_rec.candidate_information14
208 ,p_rec.candidate_information15
209 ,p_rec.candidate_information16
210 ,p_rec.candidate_information17
211 ,p_rec.candidate_information18
212 ,p_rec.candidate_information19
213 ,p_rec.candidate_information20
214 ,p_rec.candidate_information21
215 ,p_rec.candidate_information22
216 ,p_rec.candidate_information23
217 ,p_rec.candidate_information24
218 ,p_rec.candidate_information25
219 ,p_rec.candidate_information26
220 ,p_rec.candidate_information27
221 ,p_rec.candidate_information28
222 ,p_rec.candidate_information29
223 ,p_rec.candidate_information30
224 ,p_rec.object_version_number
225     ,l_creation_date
226     ,l_created_by
227     ,l_last_update_date
228     ,l_last_updated_by
229     ,l_last_update_login
230 );
231 --
232 --
233 --
234 hr_utility.set_location(' Leaving:'||l_proc, 10);
235 Exception
236 When hr_api.check_integrity_violated Then
237 -- A check constraint has been violated
238 --
239 per_eca_shd.constraint_error
240 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
241 When hr_api.parent_integrity_violated Then
242 -- Parent integrity has been violated
243 --
244 per_eca_shd.constraint_error
245 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
246 When hr_api.unique_integrity_violated Then
247 -- Unique integrity has been violated
248 --
249 per_eca_shd.constraint_error
250 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
251 When Others Then
252 --
253 Raise;
254 End insert_dml;
255 --
256 -- ----------------------------------------------------------------------------
257 -- |------------------------------< pre_insert >------------------------------|
258 -- ----------------------------------------------------------------------------
259 -- {Start Of Comments}
260 --
261 -- Description:
262 --   This private procedure contains any processing which is required before
263 --   the insert dml. Presently, if the entity has a corresponding primary
264 --   key which is maintained by an associating sequence, the primary key for
265 --   the entity will be populated with the next sequence value in
266 --   preparation for the insert dml.
267 --
268 -- Prerequisites:
269 --   This is an internal procedure which is called from the ins procedure.
270 --
271 -- In Parameters:
272 --   A Pl/Sql record structre.
273 --
274 -- Post Success:
275 --   Processing continues.
276 --
277 -- Post Failure:
278 --   If an error has occurred, an error message and exception will be raised
279 --   but not handled.
280 --
281 -- Developer Implementation Notes:
282 --   Any pre-processing required before the insert dml is issued should be
283 --   coded within this procedure. As stated above, a good example is the
284 --   generation of a primary key number via a corresponding sequence.
285 --   It is important to note that any 3rd party maintenance should be reviewed
286 --   before placing in this procedure.
287 --
288 -- Access Status:
289 --   Internal Row Handler Use Only.
290 --
291 -- {End Of Comments}
292 -- ----------------------------------------------------------------------------
293 Procedure pre_insert
294 (p_rec  in out nocopy per_eca_shd.g_rec_type
295 ) is
296 --
297 l_proc  varchar2(72) := g_package||'pre_insert';
298 --
299 Cursor C_Sel1 is select per_election_candidates_s.nextval from sys.dual;
300 --
301 Begin
302 hr_utility.set_location('Entering:'||l_proc, 5);
303 --
304 --
305 -- Select the next sequence number
306 --
307 Open C_Sel1;
308 Fetch C_Sel1 Into p_rec.election_candidate_id;
309 Close C_Sel1;
310 --
311 hr_utility.set_location(' Leaving:'||l_proc, 10);
312 End pre_insert;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |-----------------------------< post_insert >------------------------------|
316 -- ----------------------------------------------------------------------------
317 -- {Start Of Comments}
318 --
319 -- Description:
320 --   This private procedure contains any processing which is required after the
321 --   insert dml.
322 --
323 -- Prerequisites:
324 --   This is an internal procedure which is called from the ins procedure.
325 --
326 -- In Parameters:
327 --   A Pl/Sql record structre.
328 --
329 -- Post Success:
330 --   Processing continues.
331 --
332 -- Post Failure:
333 --   If an error has occurred, an error message and exception will be raised
334 --   but not handled.
335 --
336 -- Developer Implementation Notes:
337 --   Any post-processing required after the insert dml is issued should be
338 --   coded within this procedure. It is important to note that any 3rd party
339 --   maintenance should be reviewed before placing in this procedure.
340 --
341 -- Access Status:
342 --   Internal Row Handler Use Only.
343 --
344 -- {End Of Comments}
345 -- ----------------------------------------------------------------------------
346 Procedure post_insert
347 (p_rec                          in per_eca_shd.g_rec_type
348 ) is
349 --
350 l_proc  varchar2(72) := g_package||'post_insert';
351 --
352 Begin
353 hr_utility.set_location('Entering:'||l_proc, 5);
354 begin
355 --
356 per_eca_rki.after_insert
357 (p_election_candidate_id
358 => p_rec.election_candidate_id
359 ,p_business_group_id
360 => p_rec.business_group_id
361 ,p_election_id
362 => p_rec.election_id
363 ,p_person_id
364 => p_rec.person_id
365 ,p_rank
366 => p_rec.rank
367 ,p_role_id
368 => p_rec.role_id
369 ,p_attribute_category
370 => p_rec.attribute_category
371 ,p_attribute1
372 => p_rec.attribute1
373 ,p_attribute2
374 => p_rec.attribute2
375 ,p_attribute3
376 => p_rec.attribute3
377 ,p_attribute4
378 => p_rec.attribute4
379 ,p_attribute5
380 => p_rec.attribute5
381 ,p_attribute6
382 => p_rec.attribute6
383 ,p_attribute7
384 => p_rec.attribute7
385 ,p_attribute8
386 => p_rec.attribute8
387 ,p_attribute9
388 => p_rec.attribute9
389 ,p_attribute10
390 => p_rec.attribute10
391 ,p_attribute11
392 => p_rec.attribute11
393 ,p_attribute12
394 => p_rec.attribute12
395 ,p_attribute13
396 => p_rec.attribute13
397 ,p_attribute14
398 => p_rec.attribute14
399 ,p_attribute15
400 => p_rec.attribute15
401 ,p_attribute16
402 => p_rec.attribute16
403 ,p_attribute17
404 => p_rec.attribute17
405 ,p_attribute18
406 => p_rec.attribute18
407 ,p_attribute19
408 => p_rec.attribute19
409 ,p_attribute20
410 => p_rec.attribute20
411 ,p_attribute21
412 => p_rec.attribute21
413 ,p_attribute22
414 => p_rec.attribute22
415 ,p_attribute23
416 => p_rec.attribute23
417 ,p_attribute24
418 => p_rec.attribute24
419 ,p_attribute25
420 => p_rec.attribute25
421 ,p_attribute26
422 => p_rec.attribute26
423 ,p_attribute27
424 => p_rec.attribute27
425 ,p_attribute28
426 => p_rec.attribute28
427 ,p_attribute29
428 => p_rec.attribute29
429 ,p_attribute30
430 => p_rec.attribute30
431 ,p_candidate_info_category
432 => p_rec.candidate_info_category
433 ,p_candidate_information1
434 => p_rec.candidate_information1
435 ,p_candidate_information2
436 => p_rec.candidate_information2
437 ,p_candidate_information3
438 => p_rec.candidate_information3
439 ,p_candidate_information4
440 => p_rec.candidate_information4
441 ,p_candidate_information5
442 => p_rec.candidate_information5
443 ,p_candidate_information6
444 => p_rec.candidate_information6
445 ,p_candidate_information7
446 => p_rec.candidate_information7
447 ,p_candidate_information8
448 => p_rec.candidate_information8
449 ,p_candidate_information9
450 => p_rec.candidate_information9
451 ,p_candidate_information10
452 => p_rec.candidate_information10
453 ,p_candidate_information11
454 => p_rec.candidate_information11
455 ,p_candidate_information12
456 => p_rec.candidate_information12
457 ,p_candidate_information13
458 => p_rec.candidate_information13
459 ,p_candidate_information14
460 => p_rec.candidate_information14
461 ,p_candidate_information15
462 => p_rec.candidate_information15
463 ,p_candidate_information16
464 => p_rec.candidate_information16
465 ,p_candidate_information17
466 => p_rec.candidate_information17
467 ,p_candidate_information18
468 => p_rec.candidate_information18
469 ,p_candidate_information19
470 => p_rec.candidate_information19
471 ,p_candidate_information20
472 => p_rec.candidate_information20
473 ,p_candidate_information21
474 => p_rec.candidate_information21
475 ,p_candidate_information22
476 => p_rec.candidate_information22
477 ,p_candidate_information23
478 => p_rec.candidate_information23
479 ,p_candidate_information24
480 => p_rec.candidate_information24
481 ,p_candidate_information25
482 => p_rec.candidate_information25
483 ,p_candidate_information26
484 => p_rec.candidate_information26
485 ,p_candidate_information27
486 => p_rec.candidate_information27
487 ,p_candidate_information28
488 => p_rec.candidate_information28
489 ,p_candidate_information29
490 => p_rec.candidate_information29
491 ,p_candidate_information30
492 => p_rec.candidate_information30
493 ,p_object_version_number
494 => p_rec.object_version_number
495 );
496 --
497 exception
498 --
499 when hr_api.cannot_find_prog_unit then
500 --
501 hr_api.cannot_find_prog_unit_error
502 (p_module_name => 'PER_ELECTION_CANDIDATES'
503 ,p_hook_type   => 'AI');
504 --
505 end;
506 --
507 hr_utility.set_location(' Leaving:'||l_proc, 10);
508 End post_insert;
509 --
510 -- ----------------------------------------------------------------------------
511 -- |---------------------------------< ins >----------------------------------|
512 -- ----------------------------------------------------------------------------
513 Procedure ins
514   (p_rec                          in out nocopy per_eca_shd.g_rec_type
515   ,p_validate          in     boolean default false
516   ) is
517 --
518   l_proc  varchar2(72) := g_package||'ins';
519 --
520 Begin
521   hr_utility.set_location('Entering:'||l_proc, 5);
522   --
523   -- Determine if the business process is to be validated.
524   --
525   If p_validate then
526     --
527     -- Issue the savepoint.
528     --
529     SAVEPOINT ins_per_eca;
530   End If;
531 
532   --
533   -- Call the supporting insert validate operations
534   --
535   per_eca_bus.insert_validate
536      (p_rec
537      );
538   --
539   -- Call the supporting pre-insert operation
540   --
541   per_eca_ins.pre_insert(p_rec);
542   --
543   -- Insert the row
544   --
545   per_eca_ins.insert_dml(p_rec);
546   --
547   -- Call the supporting post-insert operation
548   --
549   per_eca_ins.post_insert
550      (p_rec
551      );
552   --
553   -- If we are validating then raise the Validate_Enabled exception
554   --
555   If p_validate then
556     Raise HR_Api.Validate_Enabled;
557   End If;
558   --
559   hr_utility.set_location('Leaving:'||l_proc, 20);
560 Exception
561   When HR_Api.Validate_Enabled Then
562     --
563     -- As the Validate_Enabled exception has been raised
564     -- we must rollback to the savepoint
565     --
566     ROLLBACK TO ins_per_eca;
567 end ins;
568 --
569 -- ----------------------------------------------------------------------------
570 -- |---------------------------------< ins >----------------------------------|
571 -- ----------------------------------------------------------------------------
572 Procedure ins
573   (p_business_group_id              in     number
574   ,p_election_id                    in     number
575   ,p_person_id                      in     number
576   ,p_rank                           in     number   default null
577   ,p_role_id                        in     number   default null
578   ,p_attribute_category             in     varchar2 default null
579   ,p_attribute1                     in     varchar2 default null
580   ,p_attribute2                     in     varchar2 default null
581   ,p_attribute3                     in     varchar2 default null
582   ,p_attribute4                     in     varchar2 default null
583   ,p_attribute5                     in     varchar2 default null
584   ,p_attribute6                     in     varchar2 default null
585   ,p_attribute7                     in     varchar2 default null
586   ,p_attribute8                     in     varchar2 default null
587   ,p_attribute9                     in     varchar2 default null
588   ,p_attribute10                    in     varchar2 default null
589   ,p_attribute11                    in     varchar2 default null
590   ,p_attribute12                    in     varchar2 default null
591   ,p_attribute13                    in     varchar2 default null
592   ,p_attribute14                    in     varchar2 default null
593   ,p_attribute15                    in     varchar2 default null
594   ,p_attribute16                    in     varchar2 default null
595   ,p_attribute17                    in     varchar2 default null
596   ,p_attribute18                    in     varchar2 default null
597   ,p_attribute19                    in     varchar2 default null
598   ,p_attribute20                    in     varchar2 default null
599   ,p_attribute21                    in     varchar2 default null
600   ,p_attribute22                    in     varchar2 default null
601   ,p_attribute23                    in     varchar2 default null
602   ,p_attribute24                    in     varchar2 default null
603   ,p_attribute25                    in     varchar2 default null
604   ,p_attribute26                    in     varchar2 default null
605   ,p_attribute27                    in     varchar2 default null
606   ,p_attribute28                    in     varchar2 default null
607   ,p_attribute29                    in     varchar2 default null
608   ,p_attribute30                    in     varchar2 default null
609   ,p_candidate_info_category   in     varchar2 default null
610   ,p_candidate_information1         in     varchar2 default null
611   ,p_candidate_information2         in     varchar2 default null
612   ,p_candidate_information3         in     varchar2 default null
613   ,p_candidate_information4         in     varchar2 default null
614   ,p_candidate_information5         in     varchar2 default null
615   ,p_candidate_information6         in     varchar2 default null
616   ,p_candidate_information7         in     varchar2 default null
617   ,p_candidate_information8         in     varchar2 default null
618   ,p_candidate_information9         in     varchar2 default null
619   ,p_candidate_information10        in     varchar2 default null
620   ,p_candidate_information11        in     varchar2 default null
621   ,p_candidate_information12        in     varchar2 default null
622   ,p_candidate_information13        in     varchar2 default null
623   ,p_candidate_information14        in     varchar2 default null
624   ,p_candidate_information15        in     varchar2 default null
625   ,p_candidate_information16        in     varchar2 default null
626   ,p_candidate_information17        in     varchar2 default null
627   ,p_candidate_information18        in     varchar2 default null
628   ,p_candidate_information19        in     varchar2 default null
629   ,p_candidate_information20        in     varchar2 default null
630   ,p_candidate_information21        in     varchar2 default null
631   ,p_candidate_information22        in     varchar2 default null
632   ,p_candidate_information23        in     varchar2 default null
633   ,p_candidate_information24        in     varchar2 default null
634   ,p_candidate_information25        in     varchar2 default null
635   ,p_candidate_information26        in     varchar2 default null
636   ,p_candidate_information27        in     varchar2 default null
637   ,p_candidate_information28        in     varchar2 default null
638   ,p_candidate_information29        in     varchar2 default null
639   ,p_candidate_information30        in     varchar2 default null
640   ,p_election_candidate_id             out nocopy number
641   ,p_object_version_number             out nocopy number
642   ) is
643 --
644   l_rec	  per_eca_shd.g_rec_type;
645   l_proc  varchar2(72) := g_package||'ins';
646 --
647 Begin
648   hr_utility.set_location('Entering:'||l_proc, 5);
649   --
650   -- Call conversion function to turn arguments into the
651   -- p_rec structure.
652   --
653   l_rec :=
654   per_eca_shd.convert_args
655     (null
656     ,p_business_group_id
657     ,p_election_id
658     ,p_person_id
659     ,p_rank
660     ,p_role_id
661     ,p_attribute_category
662     ,p_attribute1
663     ,p_attribute2
664     ,p_attribute3
665     ,p_attribute4
666     ,p_attribute5
667     ,p_attribute6
668     ,p_attribute7
669     ,p_attribute8
670     ,p_attribute9
671     ,p_attribute10
672     ,p_attribute11
673     ,p_attribute12
674     ,p_attribute13
675     ,p_attribute14
676     ,p_attribute15
677     ,p_attribute16
678     ,p_attribute17
679     ,p_attribute18
680     ,p_attribute19
681     ,p_attribute20
682     ,p_attribute21
683     ,p_attribute22
684     ,p_attribute23
685     ,p_attribute24
686     ,p_attribute25
687     ,p_attribute26
688     ,p_attribute27
689     ,p_attribute28
690     ,p_attribute29
691     ,p_attribute30
692     ,p_candidate_info_category
693     ,p_candidate_information1
694     ,p_candidate_information2
695     ,p_candidate_information3
696     ,p_candidate_information4
697     ,p_candidate_information5
698     ,p_candidate_information6
699     ,p_candidate_information7
700     ,p_candidate_information8
701     ,p_candidate_information9
702     ,p_candidate_information10
703     ,p_candidate_information11
704     ,p_candidate_information12
705     ,p_candidate_information13
706     ,p_candidate_information14
707     ,p_candidate_information15
708     ,p_candidate_information16
709     ,p_candidate_information17
710     ,p_candidate_information18
711     ,p_candidate_information19
712     ,p_candidate_information20
713     ,p_candidate_information21
714     ,p_candidate_information22
715     ,p_candidate_information23
716     ,p_candidate_information24
717     ,p_candidate_information25
718     ,p_candidate_information26
719     ,p_candidate_information27
720     ,p_candidate_information28
721     ,p_candidate_information29
722     ,p_candidate_information30
723     ,null
724     );
725   --
726   -- Having converted the arguments into the per_eca_rec
727   -- plsql record structure we call the corresponding record business process.
728   --
729   per_eca_ins.ins
730      (l_rec
731      );
732   --
733   -- As the primary key argument(s)
734   -- are specified as an OUT's we must set these values.
735   --
736   p_election_candidate_id := l_rec.election_candidate_id;
737   p_object_version_number := l_rec.object_version_number;
738   --
739   hr_utility.set_location(' Leaving:'||l_proc, 10);
740 End ins;
741 --
742 end per_eca_ins;