DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PJU_INS

Source


1 Package Body per_pju_ins as
2 /* $Header: pepjurhi.pkb 115.14 2002/12/04 10:55:38 eumenyio ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pju_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_job_usage_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_previous_job_usage_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_pju_ins.g_previous_job_usage_id_i := p_previous_job_usage_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).
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.
47 --
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_pju_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_job_usages
88   --
89   insert into per_previous_job_usages
90       (previous_job_usage_id
91       ,assignment_id
92       ,previous_employer_id
93       ,previous_job_id
94       ,start_date
95       ,end_date
96       ,period_years
97       ,period_months
98       ,period_days
99       ,pju_attribute_category
100       ,pju_attribute1
101       ,pju_attribute2
102       ,pju_attribute3
103       ,pju_attribute4
104       ,pju_attribute5
105       ,pju_attribute6
109       ,pju_attribute10
106       ,pju_attribute7
107       ,pju_attribute8
108       ,pju_attribute9
110       ,pju_attribute11
111       ,pju_attribute12
112       ,pju_attribute13
113       ,pju_attribute14
114       ,pju_attribute15
115       ,pju_attribute16
116       ,pju_attribute17
117       ,pju_attribute18
118       ,pju_attribute19
119       ,pju_attribute20
120       ,pju_information_category
121       ,pju_information1
122       ,pju_information2
123       ,pju_information3
124       ,pju_information4
125       ,pju_information5
126       ,pju_information6
127       ,pju_information7
128       ,pju_information8
129       ,pju_information9
130       ,pju_information10
131       ,pju_information11
132       ,pju_information12
133       ,pju_information13
134       ,pju_information14
135       ,pju_information15
136       ,pju_information16
137       ,pju_information17
138       ,pju_information18
139       ,pju_information19
140       ,pju_information20
141       ,object_version_number
142       )
143   Values
144     (p_rec.previous_job_usage_id
145     ,p_rec.assignment_id
146     ,p_rec.previous_employer_id
147     ,p_rec.previous_job_id
148     ,p_rec.start_date
149     ,p_rec.end_date
150     ,p_rec.period_years
151     ,p_rec.period_months
152     ,p_rec.period_days
153     ,p_rec.pju_attribute_category
154     ,p_rec.pju_attribute1
155     ,p_rec.pju_attribute2
156     ,p_rec.pju_attribute3
157     ,p_rec.pju_attribute4
158     ,p_rec.pju_attribute5
159     ,p_rec.pju_attribute6
160     ,p_rec.pju_attribute7
161     ,p_rec.pju_attribute8
162     ,p_rec.pju_attribute9
163     ,p_rec.pju_attribute10
164     ,p_rec.pju_attribute11
165     ,p_rec.pju_attribute12
166     ,p_rec.pju_attribute13
167     ,p_rec.pju_attribute14
168     ,p_rec.pju_attribute15
169     ,p_rec.pju_attribute16
170     ,p_rec.pju_attribute17
171     ,p_rec.pju_attribute18
172     ,p_rec.pju_attribute19
173     ,p_rec.pju_attribute20
174     ,p_rec.pju_information_category
175     ,p_rec.pju_information1
176     ,p_rec.pju_information2
177     ,p_rec.pju_information3
178     ,p_rec.pju_information4
179     ,p_rec.pju_information5
180     ,p_rec.pju_information6
181     ,p_rec.pju_information7
182     ,p_rec.pju_information8
183     ,p_rec.pju_information9
184     ,p_rec.pju_information10
185     ,p_rec.pju_information11
186     ,p_rec.pju_information12
187     ,p_rec.pju_information13
188     ,p_rec.pju_information14
189     ,p_rec.pju_information15
190     ,p_rec.pju_information16
191     ,p_rec.pju_information17
192     ,p_rec.pju_information18
193     ,p_rec.pju_information19
194     ,p_rec.pju_information20
195     ,p_rec.object_version_number
196     );
197   --
198   --
199   --
200   hr_utility.set_location(' Leaving:'||l_proc, 10);
201 Exception
202   When hr_api.check_integrity_violated Then
203     -- A check constraint has been violated
204     --
205     per_pju_shd.constraint_error
206       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
207   When hr_api.parent_integrity_violated Then
208     -- Parent integrity has been violated
209     --
210     per_pju_shd.constraint_error
211       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
212   When hr_api.unique_integrity_violated Then
213     -- Unique integrity has been violated
214     --
215     per_pju_shd.constraint_error
216       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
217   When Others Then
218     --
219     Raise;
220 End insert_dml;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |------------------------------< pre_insert >------------------------------|
224 -- ----------------------------------------------------------------------------
225 -- {Start Of Comments}
226 --
227 -- Description:
228 --   This private procedure contains any processing which is required before
229 --   the insert dml. Presently, if the entity has a corresponding primary
230 --   key which is maintained by an associating sequence, the primary key for
231 --   the entity will be populated with the next sequence value in
232 --   preparation for the insert dml.
233 --
234 -- Prerequisites:
235 --   This is an internal procedure which is called from the ins procedure.
236 --
237 -- In Parameters:
238 --   A Pl/Sql record structure.
239 --
240 -- Post Success:
241 --   Processing continues.
242 --
243 -- Post Failure:
244 --   If an error has occurred, an error message and exception will be raised
245 --   but not handled.
246 --
247 -- Developer Implementation Notes:
248 --   Any pre-processing required before the insert dml is issued should be
249 --   coded within this procedure. As stated above, a good example is the
250 --   generation of a primary key number via a corresponding sequence.
251 --   It is important to note that any 3rd party maintenance should be reviewed
252 --   before placing in this procedure.
253 --
254 -- Access Status:
255 --   Internal Row Handler Use Only.
256 --
257 -- {End Of Comments}
258 -- ----------------------------------------------------------------------------
259 Procedure pre_insert
260   (p_rec  in out nocopy per_pju_shd.g_rec_type
261   ) is
262 --
263   Cursor C_Sel1 is select per_previous_job_usages_s.nextval from sys.dual;
264 --
265   Cursor C_Sel2 is
269              per_pju_ins.g_previous_job_usage_id_i;
266     Select null
267       from per_previous_job_usages
268      where previous_job_usage_id =
270 --
271   l_proc   varchar2(72) := g_package||'pre_insert';
272   l_exists varchar2(1);
273 --
274 Begin
275   hr_utility.set_location('Entering:'||l_proc, 5);
276   --
277   If (per_pju_ins.g_previous_job_usage_id_i is not null) Then
278     --
279     -- Verify registered primary key values not already in use
280     --
281     Open C_Sel2;
282     Fetch C_Sel2 into l_exists;
283     If C_Sel2%found Then
284        Close C_Sel2;
285        --
286        -- The primary key values are already in use.
287        --
288        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
289        fnd_message.set_token('TABLE_NAME','per_previous_job_usages');
290        fnd_message.raise_error;
291     End If;
292     Close C_Sel2;
293     --
294     -- Use registered key values and clear globals
295     --
296     p_rec.previous_job_usage_id :=
297       per_pju_ins.g_previous_job_usage_id_i;
298     per_pju_ins.g_previous_job_usage_id_i := null;
299   Else
300     --
301     -- No registerd key values, so select the next sequence number
302     --
303     --
304     -- Select the next sequence number
305     --
306     Open C_Sel1;
307     Fetch C_Sel1 Into p_rec.previous_job_usage_id;
308     Close C_Sel1;
309   End If;
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
321 --   the 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_pju_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_pju_rki.after_insert
357       (p_previous_job_usage_id
358       => p_rec.previous_job_usage_id
359       ,p_assignment_id
360       => p_rec.assignment_id
361       ,p_previous_employer_id
362       => p_rec.previous_employer_id
363       ,p_previous_job_id
364       => p_rec.previous_job_id
365       ,p_start_date
366       => p_rec.start_date
367       ,p_end_date
368       => p_rec.end_date
369       ,p_period_years
370       => p_rec.period_years
371       ,p_period_months
372       => p_rec.period_months
373       ,p_period_days
374       => p_rec.period_days
375       ,p_pju_attribute_category
376       => p_rec.pju_attribute_category
377       ,p_pju_attribute1
378       => p_rec.pju_attribute1
379       ,p_pju_attribute2
380       => p_rec.pju_attribute2
381       ,p_pju_attribute3
382       => p_rec.pju_attribute3
383       ,p_pju_attribute4
384       => p_rec.pju_attribute4
385       ,p_pju_attribute5
386       => p_rec.pju_attribute5
387       ,p_pju_attribute6
388       => p_rec.pju_attribute6
389       ,p_pju_attribute7
390       => p_rec.pju_attribute7
391       ,p_pju_attribute8
392       => p_rec.pju_attribute8
393       ,p_pju_attribute9
394       => p_rec.pju_attribute9
395       ,p_pju_attribute10
396       => p_rec.pju_attribute10
397       ,p_pju_attribute11
398       => p_rec.pju_attribute11
399       ,p_pju_attribute12
400       => p_rec.pju_attribute12
401       ,p_pju_attribute13
402       => p_rec.pju_attribute13
403       ,p_pju_attribute14
404       => p_rec.pju_attribute14
405       ,p_pju_attribute15
406       => p_rec.pju_attribute15
407       ,p_pju_attribute16
408       => p_rec.pju_attribute16
409       ,p_pju_attribute17
410       => p_rec.pju_attribute17
411       ,p_pju_attribute18
412       => p_rec.pju_attribute18
413       ,p_pju_attribute19
414       => p_rec.pju_attribute19
415       ,p_pju_attribute20
416       => p_rec.pju_attribute20
417       ,p_pju_information_category
418       => p_rec.pju_information_category
419       ,p_pju_information1
420       => p_rec.pju_information1
421       ,p_pju_information2
422       => p_rec.pju_information2
423       ,p_pju_information3
427       ,p_pju_information5
424       => p_rec.pju_information3
425       ,p_pju_information4
426       => p_rec.pju_information4
428       => p_rec.pju_information5
429       ,p_pju_information6
430       => p_rec.pju_information6
431       ,p_pju_information7
432       => p_rec.pju_information7
433       ,p_pju_information8
434       => p_rec.pju_information8
435       ,p_pju_information9
436       => p_rec.pju_information9
437       ,p_pju_information10
438       => p_rec.pju_information10
439       ,p_pju_information11
440       => p_rec.pju_information11
441       ,p_pju_information12
442       => p_rec.pju_information12
443       ,p_pju_information13
444       => p_rec.pju_information13
445       ,p_pju_information14
446       => p_rec.pju_information14
447       ,p_pju_information15
448       => p_rec.pju_information15
449       ,p_pju_information16
450       => p_rec.pju_information16
451       ,p_pju_information17
452       => p_rec.pju_information17
453       ,p_pju_information18
454       => p_rec.pju_information18
455       ,p_pju_information19
456       => p_rec.pju_information19
457       ,p_pju_information20
458       => p_rec.pju_information20
459       ,p_object_version_number
460       => p_rec.object_version_number
461       );
462     --
463   exception
464     --
465     when hr_api.cannot_find_prog_unit then
466       --
467       hr_api.cannot_find_prog_unit_error
468         (p_module_name => 'PER_PREVIOUS_JOB_USAGES'
469         ,p_hook_type   => 'AI');
470       --
471   end;
472   --
473   hr_utility.set_location(' Leaving:'||l_proc, 10);
474 End post_insert;
475 --
476 -- ----------------------------------------------------------------------------
477 -- |---------------------------------< ins >----------------------------------|
478 -- ----------------------------------------------------------------------------
479 Procedure ins
480   (p_rec                          in out nocopy per_pju_shd.g_rec_type
481   ) is
482 --
483   l_proc  varchar2(72) := g_package||'ins';
484 --
485 Begin
486   hr_utility.set_location('Entering:'||l_proc, 5);
487   --
488   -- Call the supporting insert validate operations
489   --
490   per_pju_bus.insert_validate
491      (p_rec
492      );
493   --
494   -- Call the supporting pre-insert operation
495   --
496   per_pju_ins.pre_insert(p_rec);
497   --
498   -- Insert the row
499   --
500   per_pju_ins.insert_dml(p_rec);
501   --
502   -- Call the supporting post-insert operation
503   --
504   per_pju_ins.post_insert
505      (p_rec
506      );
507   --
508   hr_utility.set_location('Leaving:'||l_proc, 20);
509 end ins;
510 --
511 -- ----------------------------------------------------------------------------
512 -- |---------------------------------< ins >----------------------------------|
513 -- ----------------------------------------------------------------------------
514 Procedure ins
515   (p_assignment_id                  in     number
516   ,p_previous_employer_id           in     number
517   ,p_previous_job_id                in     number
518   ,p_start_date                     in     date     default null
519   ,p_end_date                       in     date     default null
520   ,p_period_years                   in     number   default null
521   ,p_period_months                  in     number   default null
522   ,p_period_days                    in     number   default null
523   ,p_pju_attribute_category         in     varchar2 default null
524   ,p_pju_attribute1                 in     varchar2 default null
525   ,p_pju_attribute2                 in     varchar2 default null
526   ,p_pju_attribute3                 in     varchar2 default null
527   ,p_pju_attribute4                 in     varchar2 default null
528   ,p_pju_attribute5                 in     varchar2 default null
529   ,p_pju_attribute6                 in     varchar2 default null
530   ,p_pju_attribute7                 in     varchar2 default null
531   ,p_pju_attribute8                 in     varchar2 default null
532   ,p_pju_attribute9                 in     varchar2 default null
533   ,p_pju_attribute10                in     varchar2 default null
534   ,p_pju_attribute11                in     varchar2 default null
535   ,p_pju_attribute12                in     varchar2 default null
536   ,p_pju_attribute13                in     varchar2 default null
537   ,p_pju_attribute14                in     varchar2 default null
538   ,p_pju_attribute15                in     varchar2 default null
539   ,p_pju_attribute16                in     varchar2 default null
540   ,p_pju_attribute17                in     varchar2 default null
541   ,p_pju_attribute18                in     varchar2 default null
542   ,p_pju_attribute19                in     varchar2 default null
543   ,p_pju_attribute20                in     varchar2 default null
544   ,p_pju_information_category       in     varchar2 default null
545   ,p_pju_information1               in     varchar2 default null
546   ,p_pju_information2               in     varchar2 default null
547   ,p_pju_information3               in     varchar2 default null
548   ,p_pju_information4               in     varchar2 default null
549   ,p_pju_information5               in     varchar2 default null
550   ,p_pju_information6               in     varchar2 default null
551   ,p_pju_information7               in     varchar2 default null
552   ,p_pju_information8               in     varchar2 default null
553   ,p_pju_information9               in     varchar2 default null
554   ,p_pju_information10              in     varchar2 default null
555   ,p_pju_information11              in     varchar2 default null
559   ,p_pju_information15              in     varchar2 default null
556   ,p_pju_information12              in     varchar2 default null
557   ,p_pju_information13              in     varchar2 default null
558   ,p_pju_information14              in     varchar2 default null
560   ,p_pju_information16              in     varchar2 default null
561   ,p_pju_information17              in     varchar2 default null
562   ,p_pju_information18              in     varchar2 default null
563   ,p_pju_information19              in     varchar2 default null
564   ,p_pju_information20              in     varchar2 default null
565   ,p_previous_job_usage_id             out nocopy number
566   ,p_object_version_number             out nocopy number
567   ) is
568 --
569   l_rec   per_pju_shd.g_rec_type;
570   l_proc  varchar2(72) := g_package||'ins';
571 --
572 Begin
573   hr_utility.set_location('Entering:'||l_proc, 5);
574   --
575   -- Call conversion function to turn arguments into the
576   -- p_rec structure.
577   --
578   l_rec :=
579   per_pju_shd.convert_args
580     (null
581     ,p_assignment_id
582     ,p_previous_employer_id
583     ,p_previous_job_id
584     ,p_start_date
585     ,p_end_date
586     ,p_period_years
587     ,p_period_months
588     ,p_period_days
589     ,p_pju_attribute_category
590     ,p_pju_attribute1
591     ,p_pju_attribute2
592     ,p_pju_attribute3
593     ,p_pju_attribute4
594     ,p_pju_attribute5
595     ,p_pju_attribute6
596     ,p_pju_attribute7
597     ,p_pju_attribute8
598     ,p_pju_attribute9
599     ,p_pju_attribute10
600     ,p_pju_attribute11
601     ,p_pju_attribute12
602     ,p_pju_attribute13
603     ,p_pju_attribute14
604     ,p_pju_attribute15
605     ,p_pju_attribute16
606     ,p_pju_attribute17
607     ,p_pju_attribute18
608     ,p_pju_attribute19
609     ,p_pju_attribute20
610     ,p_pju_information_category
611     ,p_pju_information1
612     ,p_pju_information2
613     ,p_pju_information3
614     ,p_pju_information4
615     ,p_pju_information5
616     ,p_pju_information6
617     ,p_pju_information7
618     ,p_pju_information8
619     ,p_pju_information9
620     ,p_pju_information10
621     ,p_pju_information11
622     ,p_pju_information12
623     ,p_pju_information13
624     ,p_pju_information14
625     ,p_pju_information15
626     ,p_pju_information16
627     ,p_pju_information17
628     ,p_pju_information18
629     ,p_pju_information19
630     ,p_pju_information20
631     ,null
632     );
633   --
634   -- Having converted the arguments into the per_pju_rec
635   -- plsql record structure we call the corresponding record business process.
636   --
637   per_pju_ins.ins
638      (l_rec
639      );
640   --
641   -- As the primary key argument(s)
642   -- are specified as an OUT's we must set these values.
643   --
644   p_previous_job_usage_id := l_rec.previous_job_usage_id;
645   p_object_version_number := l_rec.object_version_number;
646   --
647   hr_utility.set_location(' Leaving:'||l_proc, 10);
648 End ins;
649 --
650 end per_pju_ins;