DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PEM_INS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_pem_ins as
2 /* $Header: pepemrhi.pkb 120.3.12020000.2 2012/09/07 10:43:01 srannama ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pem_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_previous_employer_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_previous_employer_id  in  number) is
20 --
21   l_proc       varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   per_pem_ins.g_previous_employer_id_i := p_previous_employer_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |------------------------------< insert_dml >------------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 --   This procedure controls the actual dml insert logic. The processing of
39 --   this procedure are as follows:
40 --   1) Initialise the object_version_number to 1 if the object_version_number
41 --      is defined as an attribute for this entity.
42 --   2) To set and unset the g_api_dml status as required (as we are about to
43 --      perform dml).
47 --
44 --   3) To insert the row into the schema.
45 --   4) To trap any constraint violations that may have occurred.
46 --   5) To raise any other errors.
48 -- Prerequisites:
49 --   This is an internal private procedure which must be called from the ins
50 --   procedure and must have all mandatory attributes set (except the
51 --   object_version_number which is initialised within this procedure).
52 --
53 -- In Parameters:
54 --   A Pl/Sql record structre.
55 --
56 -- Post Success:
57 --   The specified row will be inserted into the schema.
58 --
59 -- Post Failure:
60 --   On the insert dml failure it is important to note that we always reset the
61 --   g_api_dml status to false.
62 --   If a check, unique or parent integrity constraint violation is raised the
63 --   constraint_error procedure will be called.
64 --   If any other error is reported, the error will be raised after the
65 --   g_api_dml status is reset.
66 --
67 -- Developer Implementation Notes:
68 --   None.
69 --
70 -- Access Status:
71 --   Internal Row Handler Use Only.
72 --
73 -- {End Of Comments}
74 -- ----------------------------------------------------------------------------
75 Procedure insert_dml
76   (p_rec in out nocopy per_pem_shd.g_rec_type
77   ) is
78 --
79   l_proc  varchar2(72) := g_package||'insert_dml';
80 --
81 Begin
82   hr_utility.set_location('Entering:'||l_proc, 5);
83   p_rec.object_version_number := 1;  -- Initialise the object version
84   --
85   --
86   --
87   -- Insert the row into: per_previous_employers
88   --
89   insert into per_previous_employers
90       (previous_employer_id
91       ,business_group_id
92       ,person_id
93       ,party_id
94       ,start_date
95       ,end_date
96       ,period_years
97       ,period_days
98       ,employer_name
99       ,employer_country
100       ,employer_address
101       ,employer_type
102       ,employer_subtype
103       ,description
104       ,pem_attribute_category
105       ,pem_attribute1
106       ,pem_attribute2
107       ,pem_attribute3
108       ,pem_attribute4
109       ,pem_attribute5
110       ,pem_attribute6
111       ,pem_attribute7
112       ,pem_attribute8
113       ,pem_attribute9
114       ,pem_attribute10
115       ,pem_attribute11
116       ,pem_attribute12
117       ,pem_attribute13
118       ,pem_attribute14
119       ,pem_attribute15
120       ,pem_attribute16
121       ,pem_attribute17
122       ,pem_attribute18
123       ,pem_attribute19
124       ,pem_attribute20
125       ,pem_attribute21
126       ,pem_attribute22
127       ,pem_attribute23
128       ,pem_attribute24
129       ,pem_attribute25
130       ,pem_attribute26
131       ,pem_attribute27
132       ,pem_attribute28
133       ,pem_attribute29
134       ,pem_attribute30
135       ,pem_information_category
136       ,pem_information1
137       ,pem_information2
138       ,pem_information3
139       ,pem_information4
140       ,pem_information5
141       ,pem_information6
142       ,pem_information7
143       ,pem_information8
144       ,pem_information9
145       ,pem_information10
146       ,pem_information11
147       ,pem_information12
148       ,pem_information13
149       ,pem_information14
150       ,pem_information15
151       ,pem_information16
152       ,pem_information17
153       ,pem_information18
154       ,pem_information19
155       ,pem_information20
156       ,pem_information21
157       ,pem_information22
158       ,pem_information23
159       ,pem_information24
160       ,pem_information25
161       ,pem_information26
162       ,pem_information27
163       ,pem_information28
164       ,pem_information29
165       ,pem_information30
166       ,object_version_number
167       ,all_assignments
168       ,period_months
169       )
170   Values
171     (p_rec.previous_employer_id
172     ,p_rec.business_group_id
173     ,p_rec.person_id
174     ,p_rec.party_id
175     ,p_rec.start_date
176     ,p_rec.end_date
177     ,p_rec.period_years
178     ,p_rec.period_days
179     ,p_rec.employer_name
180     ,p_rec.employer_country
181     ,p_rec.employer_address
182     ,p_rec.employer_type
183     ,p_rec.employer_subtype
184     ,p_rec.description
185     ,p_rec.pem_attribute_category
186     ,p_rec.pem_attribute1
187     ,p_rec.pem_attribute2
188     ,p_rec.pem_attribute3
189     ,p_rec.pem_attribute4
193     ,p_rec.pem_attribute8
190     ,p_rec.pem_attribute5
191     ,p_rec.pem_attribute6
192     ,p_rec.pem_attribute7
194     ,p_rec.pem_attribute9
195     ,p_rec.pem_attribute10
196     ,p_rec.pem_attribute11
197     ,p_rec.pem_attribute12
198     ,p_rec.pem_attribute13
199     ,p_rec.pem_attribute14
200     ,p_rec.pem_attribute15
201     ,p_rec.pem_attribute16
202     ,p_rec.pem_attribute17
203     ,p_rec.pem_attribute18
204     ,p_rec.pem_attribute19
205     ,p_rec.pem_attribute20
206     ,p_rec.pem_attribute21
207     ,p_rec.pem_attribute22
208     ,p_rec.pem_attribute23
209     ,p_rec.pem_attribute24
210     ,p_rec.pem_attribute25
211     ,p_rec.pem_attribute26
212     ,p_rec.pem_attribute27
213     ,p_rec.pem_attribute28
214     ,p_rec.pem_attribute29
215     ,p_rec.pem_attribute30
216     ,p_rec.pem_information_category
217     ,p_rec.pem_information1
218     ,p_rec.pem_information2
219     ,p_rec.pem_information3
220     ,p_rec.pem_information4
221     ,p_rec.pem_information5
222     ,p_rec.pem_information6
223     ,p_rec.pem_information7
224     ,p_rec.pem_information8
225     ,p_rec.pem_information9
226     ,p_rec.pem_information10
227     ,p_rec.pem_information11
228     ,p_rec.pem_information12
229     ,p_rec.pem_information13
230     ,p_rec.pem_information14
231     ,p_rec.pem_information15
232     ,p_rec.pem_information16
233     ,p_rec.pem_information17
234     ,p_rec.pem_information18
235     ,p_rec.pem_information19
236     ,p_rec.pem_information20
237     ,p_rec.pem_information21
238     ,p_rec.pem_information22
239     ,p_rec.pem_information23
240     ,p_rec.pem_information24
241     ,p_rec.pem_information25
242     ,p_rec.pem_information26
243     ,p_rec.pem_information27
244     ,p_rec.pem_information28
245     ,p_rec.pem_information29
246     ,p_rec.pem_information30
247     ,p_rec.object_version_number
248     ,p_rec.all_assignments
249     ,p_rec.period_months
250     );
251   --
252   --
253   --
254   hr_utility.set_location(' Leaving:'||l_proc, 10);
255 Exception
256   When hr_api.check_integrity_violated Then
257     -- A check constraint has been violated
258     --
259     per_pem_shd.constraint_error
260       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
261   When hr_api.parent_integrity_violated Then
262     -- Parent integrity has been violated
263     --
264     per_pem_shd.constraint_error
265       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
266   When hr_api.unique_integrity_violated Then
267     -- Unique integrity has been violated
268     --
269     per_pem_shd.constraint_error
270       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
271   When Others Then
272     --
273     Raise;
274 End insert_dml;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |------------------------------< pre_insert >------------------------------|
278 -- ----------------------------------------------------------------------------
279 -- {Start Of Comments}
280 --
281 -- Description:
282 --   This private procedure contains any processing which is required before
283 --   the insert dml. Presently, if the entity has a corresponding primary
284 --   key which is maintained by an associating sequence, the primary key for
285 --   the entity will be populated with the next sequence value in
286 --   preparation for the insert dml.
287 --
288 -- Prerequisites:
289 --   This is an internal procedure which is called from the ins procedure.
290 --
291 -- In Parameters:
292 --   A Pl/Sql record structure.
293 --
294 -- Post Success:
295 --   Processing continues.
296 --
297 -- Post Failure:
298 --   If an error has occurred, an error message and exception will be raised
299 --   but not handled.
300 --
301 -- Developer Implementation Notes:
302 --   Any pre-processing required before the insert dml is issued should be
303 --   coded within this procedure. As stated above, a good example is the
304 --   generation of a primary key number via a corresponding sequence.
305 --   It is important to note that any 3rd party maintenance should be reviewed
306 --   before placing in this procedure.
307 --
308 -- Access Status:
309 --   Internal Row Handler Use Only.
310 --
311 -- {End Of Comments}
312 -- ----------------------------------------------------------------------------
313 Procedure pre_insert
314   (p_rec  in out nocopy per_pem_shd.g_rec_type
315   ) is
316 --
317   Cursor C_Sel1 is select per_previous_employers_s.nextval from sys.dual;
318 --
319   Cursor C_Sel2 is
320     Select null
321       from per_previous_employers
322      where previous_employer_id =
323              per_pem_ins.g_previous_employer_id_i;
324 --
325   l_proc   varchar2(72) := g_package||'pre_insert';
326   l_exists varchar2(1);
327 --
328 Begin
329   hr_utility.set_location('Entering:'||l_proc, 5);
330   --
331   If (per_pem_ins.g_previous_employer_id_i is not null) Then
332     --
333     -- Verify registered primary key values not already in use
334     --
335     Open C_Sel2;
336     Fetch C_Sel2 into l_exists;
337     If C_Sel2%found Then
341        --
338        Close C_Sel2;
339        --
340        -- The primary key values are already in use.
342        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
343        fnd_message.set_token('TABLE_NAME','per_previous_employers');
344        fnd_message.raise_error;
345     End If;
346     Close C_Sel2;
347     --
348     -- Use registered key values and clear globals
349     --
350     p_rec.previous_employer_id :=
351       per_pem_ins.g_previous_employer_id_i;
352     per_pem_ins.g_previous_employer_id_i := null;
353   Else
354     --
355     -- No registerd key values, so select the next sequence number
356     --
357     --
358     -- Select the next sequence number
359     --
360     Open C_Sel1;
361     Fetch C_Sel1 Into p_rec.previous_employer_id;
362     Close C_Sel1;
363   End If;
364   --
365   hr_utility.set_location(' Leaving:'||l_proc, 10);
366 End pre_insert;
367 --
368 -- ----------------------------------------------------------------------------
369 -- |-----------------------------< post_insert >------------------------------|
370 -- ----------------------------------------------------------------------------
371 -- {Start Of Comments}
372 --
373 -- Description:
374 --   This private procedure contains any processing which is required after
375 --   the insert dml.
376 --
377 -- Prerequisites:
378 --   This is an internal procedure which is called from the ins procedure.
379 --
380 -- In Parameters:
381 --   A Pl/Sql record structre.
382 --
383 -- Post Success:
384 --   Processing continues.
385 --
386 -- Post Failure:
387 --   If an error has occurred, an error message and exception will be raised
388 --   but not handled.
389 --
390 -- Developer Implementation Notes:
391 --   Any post-processing required after the insert dml is issued should be
392 --   coded within this procedure. It is important to note that any 3rd party
393 --   maintenance should be reviewed before placing in this procedure.
394 --
395 -- Access Status:
396 --   Internal Row Handler Use Only.
397 --
398 -- {End Of Comments}
399 -- ----------------------------------------------------------------------------
400 Procedure post_insert
401   (p_effective_date               in date
402   ,p_rec                          in per_pem_shd.g_rec_type
403   ) is
404 --
405   l_proc  varchar2(72) := g_package||'post_insert';
406 --
407 Begin
408   hr_utility.set_location('Entering:'||l_proc, 5);
409   begin
410     --
411     per_pem_rki.after_insert
412       (p_effective_date              => p_effective_date
413       ,p_previous_employer_id
414       => p_rec.previous_employer_id
415       ,p_business_group_id
416       => p_rec.business_group_id
417       ,p_person_id
418       => p_rec.person_id
419       ,p_party_id
420       => p_rec.party_id
421       ,p_start_date
422       => p_rec.start_date
423       ,p_end_date
424       => p_rec.end_date
425       ,p_period_years
426       => p_rec.period_years
427       ,p_period_days
428       => p_rec.period_days
429       ,p_employer_name
430       => p_rec.employer_name
431       ,p_employer_country
432       => p_rec.employer_country
433       ,p_employer_address
434       => p_rec.employer_address
435       ,p_employer_type
436       => p_rec.employer_type
437       ,p_employer_subtype
438       => p_rec.employer_subtype
439       ,p_description
440       => p_rec.description
444       => p_rec.pem_attribute1
441       ,p_pem_attribute_category
442       => p_rec.pem_attribute_category
443       ,p_pem_attribute1
445       ,p_pem_attribute2
446       => p_rec.pem_attribute2
447       ,p_pem_attribute3
448       => p_rec.pem_attribute3
449       ,p_pem_attribute4
450       => p_rec.pem_attribute4
451       ,p_pem_attribute5
452       => p_rec.pem_attribute5
453       ,p_pem_attribute6
454       => p_rec.pem_attribute6
455       ,p_pem_attribute7
456       => p_rec.pem_attribute7
457       ,p_pem_attribute8
458       => p_rec.pem_attribute8
459       ,p_pem_attribute9
460       => p_rec.pem_attribute9
461       ,p_pem_attribute10
462       => p_rec.pem_attribute10
463       ,p_pem_attribute11
464       => p_rec.pem_attribute11
465       ,p_pem_attribute12
466       => p_rec.pem_attribute12
467       ,p_pem_attribute13
468       => p_rec.pem_attribute13
469       ,p_pem_attribute14
470       => p_rec.pem_attribute14
471       ,p_pem_attribute15
472       => p_rec.pem_attribute15
473       ,p_pem_attribute16
474       => p_rec.pem_attribute16
475       ,p_pem_attribute17
476       => p_rec.pem_attribute17
477       ,p_pem_attribute18
478       => p_rec.pem_attribute18
479       ,p_pem_attribute19
480       => p_rec.pem_attribute19
481       ,p_pem_attribute20
482       => p_rec.pem_attribute20
483       ,p_pem_attribute21
484       => p_rec.pem_attribute21
485       ,p_pem_attribute22
486       => p_rec.pem_attribute22
487       ,p_pem_attribute23
488       => p_rec.pem_attribute23
489       ,p_pem_attribute24
490       => p_rec.pem_attribute24
491       ,p_pem_attribute25
492       => p_rec.pem_attribute25
493       ,p_pem_attribute26
494       => p_rec.pem_attribute26
495       ,p_pem_attribute27
496       => p_rec.pem_attribute27
497       ,p_pem_attribute28
498       => p_rec.pem_attribute28
499       ,p_pem_attribute29
500       => p_rec.pem_attribute29
501       ,p_pem_attribute30
502       => p_rec.pem_attribute30
503       ,p_pem_information_category
504       => p_rec.pem_information_category
505       ,p_pem_information1
506       => p_rec.pem_information1
507       ,p_pem_information2
508       => p_rec.pem_information2
509       ,p_pem_information3
510       => p_rec.pem_information3
511       ,p_pem_information4
512       => p_rec.pem_information4
513       ,p_pem_information5
514       => p_rec.pem_information5
515       ,p_pem_information6
516       => p_rec.pem_information6
517       ,p_pem_information7
518       => p_rec.pem_information7
519       ,p_pem_information8
520       => p_rec.pem_information8
521       ,p_pem_information9
522       => p_rec.pem_information9
523       ,p_pem_information10
524       => p_rec.pem_information10
525       ,p_pem_information11
526       => p_rec.pem_information11
527       ,p_pem_information12
528       => p_rec.pem_information12
529       ,p_pem_information13
530       => p_rec.pem_information13
531       ,p_pem_information14
532       => p_rec.pem_information14
533       ,p_pem_information15
534       => p_rec.pem_information15
535       ,p_pem_information16
536       => p_rec.pem_information16
537       ,p_pem_information17
538       => p_rec.pem_information17
539       ,p_pem_information18
540       => p_rec.pem_information18
541       ,p_pem_information19
542       => p_rec.pem_information19
543       ,p_pem_information20
544       => p_rec.pem_information20
545       ,p_pem_information21
546       => p_rec.pem_information21
547       ,p_pem_information22
548       => p_rec.pem_information22
549       ,p_pem_information23
550       => p_rec.pem_information23
551       ,p_pem_information24
552       => p_rec.pem_information24
553       ,p_pem_information25
554       => p_rec.pem_information25
555       ,p_pem_information26
556       => p_rec.pem_information26
557       ,p_pem_information27
558       => p_rec.pem_information27
559       ,p_pem_information28
560       => p_rec.pem_information28
561       ,p_pem_information29
562       => p_rec.pem_information29
563       ,p_pem_information30
564       => p_rec.pem_information30
565       ,p_object_version_number
566       => p_rec.object_version_number
567       ,p_all_assignments
568       => p_rec.all_assignments
569       ,p_period_months
570       => p_rec.period_months
571       );
572     --
573   exception
574     --
575     when hr_api.cannot_find_prog_unit then
576       --
577       hr_api.cannot_find_prog_unit_error
578         (p_module_name => 'PER_PREVIOUS_EMPLOYERS'
579         ,p_hook_type   => 'AI');
580       --
581   end;
582   --
583   hr_utility.set_location(' Leaving:'||l_proc, 10);
584 End post_insert;
585 --
586 -- ----------------------------------------------------------------------------
587 -- |---------------------------------< ins >----------------------------------|
588 -- ----------------------------------------------------------------------------
589 Procedure ins
590   (p_effective_date               in date
591   ,p_rec                          in out nocopy per_pem_shd.g_rec_type
592   ) is
593 --
594   l_proc  varchar2(72) := g_package||'ins';
595 --
596 Begin
597   hr_utility.set_location('Entering:'||l_proc, 5);
598   --
602      (p_effective_date
599   -- Call the supporting insert validate operations
600   --
601   per_pem_bus.insert_validate
603      ,p_rec
604      );
605   --
606   -- Call to raise any errors on multi-message list
607   hr_multi_message.end_validation_set;
608   --
609   -- Call the supporting pre-insert operation
610   --
611   per_pem_ins.pre_insert(p_rec);
612   --
613   -- Insert the row
614   --
615   per_pem_ins.insert_dml(p_rec);
616   --
617   -- Call the supporting post-insert operation
618   --
619   per_pem_ins.post_insert
620      (p_effective_date
621      ,p_rec
622      );
623   --
624   -- Call to raise any errors on multi-message list
625   hr_multi_message.end_validation_set;
626   --
627   hr_utility.set_location('Leaving:'||l_proc, 20);
628 end ins;
629 --
630 -- ----------------------------------------------------------------------------
631 -- |---------------------------------< ins >----------------------------------|
632 -- ----------------------------------------------------------------------------
633 Procedure ins
634   (p_effective_date                 in     date
635   ,p_business_group_id              in     number   default null
636   ,p_person_id                      in     number   default null
637   ,p_party_id                       in     number   default null
638   ,p_start_date                     in     date     default null
639   ,p_end_date                       in     date     default null
640   ,p_period_years                   in     number   default null
641   ,p_period_days                    in     number   default null
642   ,p_employer_name                  in     varchar2 default null
643   ,p_employer_country               in     varchar2 default null
644   ,p_employer_address               in     varchar2 default null
645   ,p_employer_type                  in     varchar2 default null
646   ,p_employer_subtype               in     varchar2 default null
647   ,p_description                    in     varchar2 default null
648   ,p_pem_attribute_category         in     varchar2 default null
649   ,p_pem_attribute1                 in     varchar2 default null
650   ,p_pem_attribute2                 in     varchar2 default null
651   ,p_pem_attribute3                 in     varchar2 default null
652   ,p_pem_attribute4                 in     varchar2 default null
653   ,p_pem_attribute5                 in     varchar2 default null
654   ,p_pem_attribute6                 in     varchar2 default null
655   ,p_pem_attribute7                 in     varchar2 default null
656   ,p_pem_attribute8                 in     varchar2 default null
657   ,p_pem_attribute9                 in     varchar2 default null
658   ,p_pem_attribute10                in     varchar2 default null
659   ,p_pem_attribute11                in     varchar2 default null
660   ,p_pem_attribute12                in     varchar2 default null
661   ,p_pem_attribute13                in     varchar2 default null
662   ,p_pem_attribute14                in     varchar2 default null
663   ,p_pem_attribute15                in     varchar2 default null
664   ,p_pem_attribute16                in     varchar2 default null
665   ,p_pem_attribute17                in     varchar2 default null
666   ,p_pem_attribute18                in     varchar2 default null
667   ,p_pem_attribute19                in     varchar2 default null
668   ,p_pem_attribute20                in     varchar2 default null
669   ,p_pem_attribute21                in     varchar2 default null
670   ,p_pem_attribute22                in     varchar2 default null
671   ,p_pem_attribute23                in     varchar2 default null
672   ,p_pem_attribute24                in     varchar2 default null
673   ,p_pem_attribute25                in     varchar2 default null
674   ,p_pem_attribute26                in     varchar2 default null
675   ,p_pem_attribute27                in     varchar2 default null
676   ,p_pem_attribute28                in     varchar2 default null
677   ,p_pem_attribute29                in     varchar2 default null
678   ,p_pem_attribute30                in     varchar2 default null
679   ,p_pem_information_category       in     varchar2 default null
680   ,p_pem_information1               in     varchar2 default null
681   ,p_pem_information2               in     varchar2 default null
682   ,p_pem_information3               in     varchar2 default null
683   ,p_pem_information4               in     varchar2 default null
684   ,p_pem_information5               in     varchar2 default null
685   ,p_pem_information6               in     varchar2 default null
686   ,p_pem_information7               in     varchar2 default null
687   ,p_pem_information8               in     varchar2 default null
688   ,p_pem_information9               in     varchar2 default null
689   ,p_pem_information10              in     varchar2 default null
690   ,p_pem_information11              in     varchar2 default null
691   ,p_pem_information12              in     varchar2 default null
692   ,p_pem_information13              in     varchar2 default null
693   ,p_pem_information14              in     varchar2 default null
694   ,p_pem_information15              in     varchar2 default null
695   ,p_pem_information16              in     varchar2 default null
696   ,p_pem_information17              in     varchar2 default null
697   ,p_pem_information18              in     varchar2 default null
698   ,p_pem_information19              in     varchar2 default null
699   ,p_pem_information20              in     varchar2 default null
700   ,p_pem_information21              in     varchar2 default null
701   ,p_pem_information22              in     varchar2 default null
702   ,p_pem_information23              in     varchar2 default null
706   ,p_pem_information27              in     varchar2 default null
703   ,p_pem_information24              in     varchar2 default null
704   ,p_pem_information25              in     varchar2 default null
705   ,p_pem_information26              in     varchar2 default null
707   ,p_pem_information28              in     varchar2 default null
708   ,p_pem_information29              in     varchar2 default null
709   ,p_pem_information30              in     varchar2 default null
710   ,p_all_assignments                in     varchar2 default null
711   ,p_period_months                  in     number   default null
712   ,p_previous_employer_id              out nocopy number
713   ,p_object_version_number             out nocopy number
714   ) is
715 --
716   -- Bug Fix 3261422 Start
717   cursor csr_get_party_id is
718   select party_id
719   from    per_all_people_f per
720     where   per.person_id = p_person_id
721     and     trunc(p_effective_date)
722     between per.effective_start_date
723     and     per.effective_end_date;
724   -- Bug Fix 3261422 End
725 --
726   l_rec   per_pem_shd.g_rec_type;
727   l_proc  varchar2(72) := g_package||'ins';
728   l_party_id number;
729 --
730 Begin
731   hr_utility.set_location('Entering:'||l_proc, 5);
732   -- Bug Fix 3261422 Start
733   if p_party_id is null then
734     open csr_get_party_id;
735     fetch csr_get_party_id into l_party_id;
736     close csr_get_party_id;
737   else
738     l_party_id := p_party_id;
739   end if;
740   -- Bug Fix 3261422 End
741 
742   --
743   -- Call conversion function to turn arguments into the
744   -- p_rec structure.
745   --
746   l_rec :=
747   per_pem_shd.convert_args
748     (null
749     ,p_business_group_id
750     ,p_person_id
751     ,l_party_id
752     ,p_start_date
753     ,p_end_date
754     ,p_period_years
755     ,p_period_days
756     ,p_employer_name
757     ,p_employer_country
758     ,p_employer_address
759     ,p_employer_type
760     ,p_employer_subtype
761     ,p_description
762     ,p_pem_attribute_category
763     ,p_pem_attribute1
764     ,p_pem_attribute2
765     ,p_pem_attribute3
766     ,p_pem_attribute4
767     ,p_pem_attribute5
768     ,p_pem_attribute6
769     ,p_pem_attribute7
770     ,p_pem_attribute8
771     ,p_pem_attribute9
772     ,p_pem_attribute10
773     ,p_pem_attribute11
774     ,p_pem_attribute12
775     ,p_pem_attribute13
776     ,p_pem_attribute14
777     ,p_pem_attribute15
778     ,p_pem_attribute16
779     ,p_pem_attribute17
780     ,p_pem_attribute18
781     ,p_pem_attribute19
782     ,p_pem_attribute20
783     ,p_pem_attribute21
784     ,p_pem_attribute22
785     ,p_pem_attribute23
786     ,p_pem_attribute24
787     ,p_pem_attribute25
788     ,p_pem_attribute26
789     ,p_pem_attribute27
790     ,p_pem_attribute28
791     ,p_pem_attribute29
792     ,p_pem_attribute30
793     ,p_pem_information_category
794     ,p_pem_information1
795     ,p_pem_information2
796     ,p_pem_information3
797     ,p_pem_information4
798     ,p_pem_information5
799     ,p_pem_information6
800     ,p_pem_information7
801     ,p_pem_information8
802     ,p_pem_information9
803     ,p_pem_information10
804     ,p_pem_information11
805     ,p_pem_information12
806     ,p_pem_information13
807     ,p_pem_information14
808     ,p_pem_information15
809     ,p_pem_information16
810     ,p_pem_information17
811     ,p_pem_information18
812     ,p_pem_information19
813     ,p_pem_information20
814     ,p_pem_information21
815     ,p_pem_information22
816     ,p_pem_information23
817     ,p_pem_information24
818     ,p_pem_information25
819     ,p_pem_information26
820     ,p_pem_information27
821     ,p_pem_information28
822     ,p_pem_information29
823     ,p_pem_information30
824     ,null
825     ,p_all_assignments
826     ,p_period_months
827     );
828   --
829   -- Having converted the arguments into the per_pem_rec
830   -- plsql record structure we call the corresponding record business process.
831   --
832   per_pem_ins.ins
833      (p_effective_date
834      ,l_rec
835      );
836   --
837   -- As the primary key argument(s)
838   -- are specified as an OUT's we must set these values.
839   --
840   p_previous_employer_id := l_rec.previous_employer_id;
841   p_object_version_number := l_rec.object_version_number;
842   --
843   hr_utility.set_location(' Leaving:'||l_proc, 10);
844 End ins;
845 --
846 end per_pem_ins;