DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_EQT_INS

Source


1 Package Body per_eqt_ins as
2 /* $Header: peeqtrhi.pkb 115.15 2004/03/30 18:11:30 ynegoro ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_eqt_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 -- Pre Conditions:
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 Table Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy per_eqt_shd.g_rec_type) is
54 --
55   l_proc  varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   p_rec.object_version_number := 1;  -- Initialise the object version
60   --
61   per_eqt_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: per_qualification_types
64 
65   --  mvankada
66   --  Added Developer DF columns
67   insert into per_qualification_types
68   (	qualification_type_id,
69 	name,
70 	category,
71 	rank,
72 	attribute_category,
73 	attribute1,
74 	attribute2,
75 	attribute3,
76 	attribute4,
77 	attribute5,
78 	attribute6,
79 	attribute7,
80 	attribute8,
81 	attribute9,
82 	attribute10,
83 	attribute11,
84 	attribute12,
85 	attribute13,
86 	attribute14,
87 	attribute15,
88 	attribute16,
89 	attribute17,
90 	attribute18,
91 	attribute19,
92 	attribute20,
93 	object_version_number,
94 	information_category,
95  	information1,
96 	information2,
97 	information3,
98 	information4,
99 	information5,
100 	information6,
101 	information7,
102 	information8,
103 	information9,
104 	information10,
105 	information11,
106 	information12,
107 	information13,
108 	information14,
109 	information15,
110 	information16,
111 	information17,
112 	information18,
113 	information19,
114 	information20,
115 	information21,
116 	information22,
117 	information23,
118 	information24,
119 	information25,
120 	information26,
121 	information27,
122 	information28,
123 	information29,
124 	information30
125        ,qual_framework_id       -- BUG3356369
126        ,qualification_type
127        ,credit_type
128        ,credits
129        ,level_type
130        ,level_number
131        ,field
132        ,sub_field
133        ,provider
134        ,qa_organization
135 	)
136   Values
137   (	p_rec.qualification_type_id,
138 	p_rec.name,
139 	p_rec.category,
140 	p_rec.rank,
141 	p_rec.attribute_category,
142 	p_rec.attribute1,
143 	p_rec.attribute2,
144 	p_rec.attribute3,
145 	p_rec.attribute4,
146 	p_rec.attribute5,
147 	p_rec.attribute6,
148 	p_rec.attribute7,
149 	p_rec.attribute8,
150 	p_rec.attribute9,
151 	p_rec.attribute10,
152 	p_rec.attribute11,
153 	p_rec.attribute12,
154 	p_rec.attribute13,
155 	p_rec.attribute14,
156 	p_rec.attribute15,
157 	p_rec.attribute16,
158 	p_rec.attribute17,
159 	p_rec.attribute18,
160 	p_rec.attribute19,
161 	p_rec.attribute20,
162 	p_rec.object_version_number,
163 	p_rec.information_category,
164  	p_rec.information1,
165 	p_rec.information2,
166 	p_rec.information3,
167 	p_rec.information4,
168 	p_rec.information5,
169 	p_rec.information6,
170 	p_rec.information7,
171 	p_rec.information8,
172 	p_rec.information9,
173 	p_rec.information10,
174 	p_rec.information11,
175 	p_rec.information12,
176 	p_rec.information13,
177 	p_rec.information14,
178 	p_rec.information15,
179 	p_rec.information16,
180 	p_rec.information17,
181 	p_rec.information18,
182 	p_rec.information19,
183 	p_rec.information20,
184 	p_rec.information21,
185 	p_rec.information22,
186 	p_rec.information23,
187 	p_rec.information24,
188 	p_rec.information25,
189 	p_rec.information26,
190 	p_rec.information27,
191 	p_rec.information28,
192 	p_rec.information29,
193 	p_rec.information30
194        ,p_rec.qual_framework_id       -- BUG3356369
195        ,p_rec.qualification_type
196        ,p_rec.credit_type
197        ,p_rec.credits
198        ,p_rec.level_type
199        ,p_rec.level_number
200        ,p_rec.field
201        ,p_rec.sub_field
202        ,p_rec.provider
203        ,p_rec.qa_organization
204 	 );
205   --
206   per_eqt_shd.g_api_dml := false;   -- Unset the api dml status
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209 Exception
210   When hr_api.check_integrity_violated Then
211     -- A check constraint has been violated
212     per_eqt_shd.g_api_dml := false;   -- Unset the api dml status
213     per_eqt_shd.constraint_error
214       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
215   When hr_api.parent_integrity_violated Then
216     -- Parent integrity has been violated
217     per_eqt_shd.g_api_dml := false;   -- Unset the api dml status
218     per_eqt_shd.constraint_error
219       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
220   When hr_api.unique_integrity_violated Then
221     -- Unique integrity has been violated
222     per_eqt_shd.g_api_dml := false;   -- Unset the api dml status
223     per_eqt_shd.constraint_error
224       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
225   When Others Then
226     per_eqt_shd.g_api_dml := false;   -- Unset the api dml status
227     Raise;
228 End insert_dml;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |------------------------------< pre_insert >------------------------------|
232 -- ----------------------------------------------------------------------------
233 -- {Start Of Comments}
234 --
235 -- Description:
236 --   This private procedure contains any processing which is required before
237 --   the insert dml. Presently, if the entity has a corresponding primary
238 --   key which is maintained by an associating sequence, the primary key for
239 --   the entity will be populated with the next sequence value in
240 --   preparation for the insert dml.
241 --
242 -- Pre Conditions:
243 --   This is an internal procedure which is called from the ins procedure.
244 --
245 -- In Parameters:
246 --   A Pl/Sql record structre.
247 --
248 -- Post Success:
249 --   Processing continues.
250 --
251 -- Post Failure:
252 --   If an error has occurred, an error message and exception will be raised
253 --   but not handled.
254 --
255 -- Developer Implementation Notes:
256 --   Any pre-processing required before the insert dml is issued should be
257 --   coded within this procedure. As stated above, a good example is the
258 --   generation of a primary key number via a corresponding sequence.
259 --   It is important to note that any 3rd party maintenance should be reviewed
260 --   before placing in this procedure.
261 --
262 -- Access Status:
263 --   Internal Table Handler Use Only.
264 --
265 -- {End Of Comments}
266 -- ----------------------------------------------------------------------------
267 Procedure pre_insert(p_rec  in out nocopy per_eqt_shd.g_rec_type) is
268   --
269   l_proc  varchar2(72) := g_package||'pre_insert';
270   --
271   cursor c1 is
272     select per_qualification_types_s.nextval
273     from   sys.dual;
274   --
275 Begin
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   --
278   open c1;
279     --
280     fetch c1 into p_rec.qualification_type_id;
281     --
282   close c1;
283   --
284   hr_utility.set_location(' Leaving:'||l_proc, 10);
285 End pre_insert;
286 --
287 -- ----------------------------------------------------------------------------
288 -- |-----------------------------< post_insert >------------------------------|
289 -- ----------------------------------------------------------------------------
290 -- {Start Of Comments}
291 --
292 -- Description:
293 --   This private procedure contains any processing which is required after the
294 --   insert dml.
295 --
296 -- Pre Conditions:
297 --   This is an internal procedure which is called from the ins procedure.
298 --
299 -- In Parameters:
300 --   A Pl/Sql record structre.
301 --
302 -- Post Success:
303 --   Processing continues.
304 --
305 -- Post Failure:
306 --   If an error has occurred, an error message and exception will be raised
307 --   but not handled.
308 --
309 -- Developer Implementation Notes:
310 --   Any post-processing required after the insert dml is issued should be
311 --   coded within this procedure. It is important to note that any 3rd party
312 --   maintenance should be reviewed before placing in this procedure.
313 --
314 -- Access Status:
315 --   Internal Table Handler Use Only.
316 --
317 -- {End Of Comments}
318 -- ---------------------------------------------------------------------------
319 -- mvankada
320 -- Added Developer DF columns
321 
322 Procedure post_insert(p_rec in per_eqt_shd.g_rec_type
323                       ,p_effective_date in date) is
324 --
325   l_proc  varchar2(72) := g_package||'post_insert';
326 --
327 Begin
328   hr_utility.set_location('Entering:'||l_proc, 5);
329   --
330   -- Start of API User Hook for post_insert.
331   Begin
332     per_eqt_rki.after_insert
333     (p_qualification_type_id  => p_rec.qualification_type_id
334     ,p_name                   => p_rec.name
335     ,p_category               => p_rec.category
336     ,p_rank                   => p_rec.rank
337     ,p_attribute_category     => p_rec.attribute_category
338     ,p_attribute1             => p_rec.attribute1
339     ,p_attribute2             => p_rec.attribute2
340     ,p_attribute3             => p_rec.attribute3
341     ,p_attribute4             => p_rec.attribute4
342     ,p_attribute5             => p_rec.attribute5
343     ,p_attribute6             => p_rec.attribute6
344     ,p_attribute7             => p_rec.attribute7
345     ,p_attribute8             => p_rec.attribute8
346     ,p_attribute9             => p_rec.attribute9
347     ,p_attribute10            => p_rec.attribute10
348     ,p_attribute11            => p_rec.attribute11
349     ,p_attribute12            => p_rec.attribute12
350     ,p_attribute13            => p_rec.attribute13
351     ,p_attribute14            => p_rec.attribute14
352     ,p_attribute15            => p_rec.attribute15
353     ,p_attribute16            => p_rec.attribute16
354     ,p_attribute17            => p_rec.attribute17
355     ,p_attribute18            => p_rec.attribute18
356     ,p_attribute19            => p_rec.attribute19
357     ,p_attribute20            => p_rec.attribute20
358     ,p_object_version_number  => p_rec.object_version_number
359     ,p_effective_date         => p_effective_date
360     ,p_information_category   => p_rec.information_category
361     ,p_information1	      => p_rec.information1
362     ,p_information2	      => p_rec.information2
363     ,p_information3	      => p_rec.information3
364     ,p_information4	      => p_rec.information4
365     ,p_information5	      => p_rec.information5
366     ,p_information6	      => p_rec.information6
367     ,p_information7           => p_rec.information7
368     ,p_information8	      => p_rec.information8
369     ,p_information9           => p_rec.information9
370     ,p_information10	      => p_rec.information10
371     ,p_information11	      => p_rec.information11
372     ,p_information12	      => p_rec.information12
373     ,p_information13	      => p_rec.information13
374     ,p_information14	      => p_rec.information14
375     ,p_information15	      => p_rec.information15
376     ,p_information16	      => p_rec.information16
377     ,p_information17	      => p_rec.information17
378     ,p_information18	      => p_rec.information18
379     ,p_information19	      => p_rec.information19
380     ,p_information20	      => p_rec.information20
381     ,p_information21	      => p_rec.information21
382     ,p_information22	      => p_rec.information22
383     ,p_information23	      => p_rec.information23
384     ,p_information24	      => p_rec.information24
385     ,p_information25	      => p_rec.information25
386     ,p_information26	      => p_rec.information26
387     ,p_information27	      => p_rec.information27
388     ,p_information28	      => p_rec.information28
389     ,p_information29	      => p_rec.information29
390     ,p_information30	      => p_rec.information30
391     ,p_qual_framework_id      => p_rec.qual_framework_id
392     ,p_qualification_type     => p_rec.qualification_type
393     ,p_credit_type            => p_rec.credit_type
394     ,p_credits                => p_rec.credits
395     ,p_level_type             => p_rec.level_type
396     ,p_level_number           => p_rec.level_number
397     ,p_field                  => p_rec.field
398     ,p_sub_field              => p_rec.sub_field
399     ,p_provider               => p_rec.provider
400     ,p_qa_organization        => p_rec.qa_organization
401      );
402        exception
403         when hr_api.cannot_find_prog_unit then
404              hr_api.cannot_find_prog_unit_error
405                  (p_module_name => 'PER_QUALIFICATION_TYPES'
406                  ,p_hook_type   => 'AI'
407                  );
408      end;
409 --   End of API User Hook for post_insert.
410 --
411   hr_utility.set_location(' Leaving:'||l_proc, 10);
412 End post_insert;
413 --
414 -- ----------------------------------------------------------------------------
415 -- |---------------------------------< ins >----------------------------------|
416 -- ----------------------------------------------------------------------------
417 Procedure ins
418   (
419   p_rec            in out nocopy per_eqt_shd.g_rec_type,
420   p_effective_date in     date,
421   p_validate       in     boolean default false
422   ) is
423 --
424   l_proc  varchar2(72) := g_package||'ins';
425 --
426 Begin
427   hr_utility.set_location('Entering:'||l_proc, 5);
428   --
429   -- Determine if the business process is to be validated.
430   --
431   If p_validate then
432     --
433     -- Issue the savepoint.
434     --
435     SAVEPOINT ins_per_eqt;
436   End If;
437   --
438   -- Call the supporting insert validate operations
439   --
440   per_eqt_bus.insert_validate(p_rec,p_effective_date);
441   --
442   -- Call the supporting pre-insert operation
443   --
444   pre_insert(p_rec);
445   --
446   -- Insert the row
447   --
448   insert_dml(p_rec);
449   --
450   -- Call the supporting post-insert operation
451   --
452   post_insert(p_rec
453              ,p_effective_date
454              );
455   --
456   -- If we are validating then raise the Validate_Enabled exception
457   --
458   If p_validate then
459     Raise HR_Api.Validate_Enabled;
460   End If;
461   --
462   hr_utility.set_location(' Leaving:'||l_proc, 10);
463 Exception
464   When HR_Api.Validate_Enabled Then
465     --
466     -- As the Validate_Enabled exception has been raised
467     -- we must rollback to the savepoint
468     --
469     ROLLBACK TO ins_per_eqt;
470 end ins;
471 --
472 -- ----------------------------------------------------------------------------
473 -- |---------------------------------< ins >----------------------------------|
474 -- ----------------------------------------------------------------------------
475 
476 -- mvankada
477 -- Passed Developer DF Columns to the procedure ins
478 
479 Procedure ins
480   (
481   p_qualification_type_id  out nocopy number,
482   p_name                   in varchar2,
483   p_category               in varchar2,
484   p_rank                   in number           default null,
485   p_attribute_category     in varchar2         default null,
486   p_attribute1             in varchar2         default null,
487   p_attribute2             in varchar2         default null,
488   p_attribute3             in varchar2         default null,
489   p_attribute4             in varchar2         default null,
490   p_attribute5             in varchar2         default null,
491   p_attribute6             in varchar2         default null,
492   p_attribute7             in varchar2         default null,
493   p_attribute8             in varchar2         default null,
494   p_attribute9             in varchar2         default null,
495   p_attribute10            in varchar2         default null,
496   p_attribute11            in varchar2         default null,
497   p_attribute12            in varchar2         default null,
498   p_attribute13            in varchar2         default null,
499   p_attribute14            in varchar2         default null,
500   p_attribute15            in varchar2         default null,
501   p_attribute16            in varchar2         default null,
502   p_attribute17            in varchar2         default null,
503   p_attribute18            in varchar2         default null,
504   p_attribute19            in varchar2         default null,
505   p_attribute20            in varchar2         default null,
506   p_object_version_number  out nocopy number,
507   p_effective_date         in date,
508   p_information_category   in varchar2         default null,
509   p_information1           in varchar2         default null,
510   p_information2           in varchar2         default null,
511   p_information3           in varchar2         default null,
512   p_information4           in varchar2         default null,
513   p_information5           in varchar2         default null,
514   p_information6           in varchar2         default null,
515   p_information7           in varchar2         default null,
516   p_information8           in varchar2         default null,
517   p_information9           in varchar2         default null,
518   p_information10          in varchar2         default null,
519   p_information11          in varchar2         default null,
520   p_information12          in varchar2         default null,
521   p_information13          in varchar2         default null,
522   p_information14          in varchar2         default null,
523   p_information15          in varchar2         default null,
524   p_information16          in varchar2         default null,
525   p_information17          in varchar2         default null,
526   p_information18          in varchar2         default null,
527   p_information19          in varchar2         default null,
528   p_information20          in varchar2         default null,
529   p_information21          in varchar2         default null,
530   p_information22          in varchar2         default null,
531   p_information23          in varchar2         default null,
532   p_information24          in varchar2         default null,
533   p_information25          in varchar2         default null,
534   p_information26          in varchar2         default null,
535   p_information27          in varchar2         default null,
536   p_information28          in varchar2         default null,
537   p_information29          in varchar2         default null,
538   p_information30          in varchar2         default null,
539   p_validate               in boolean          default false
540 -- BUG3356369
541  ,p_qual_framework_id      in number           default null
542  ,p_qualification_type     in varchar2         default null
543  ,p_credit_type            in varchar2         default null
544  ,p_credits                in number           default null
545  ,p_level_type             in varchar2         default null
546  ,p_level_number           in number           default null
547  ,p_field                  in varchar2         default null
548  ,p_sub_field              in varchar2         default null
549  ,p_provider               in varchar2         default null
550  ,p_qa_organization        in varchar2         default null
551   ) is
552 --
553   l_rec	  per_eqt_shd.g_rec_type;
554   l_proc  varchar2(72) := g_package||'ins';
555 --
556 Begin
557   hr_utility.set_location('Entering:'||l_proc, 5);
558   --
559   -- Call conversion function to turn arguments into the
560   -- p_rec structure.
561   --
562   l_rec :=
563   per_eqt_shd.convert_args
564   (
565   null,
566   p_name,
567   p_category,
568   p_rank,
569   p_attribute_category,
570   p_attribute1,
571   p_attribute2,
572   p_attribute3,
573   p_attribute4,
574   p_attribute5,
575   p_attribute6,
576   p_attribute7,
577   p_attribute8,
578   p_attribute9,
579   p_attribute10,
580   p_attribute11,
581   p_attribute12,
582   p_attribute13,
583   p_attribute14,
584   p_attribute15,
585   p_attribute16,
586   p_attribute17,
587   p_attribute18,
588   p_attribute19,
589   p_attribute20,
590   null,
591   p_information_category,
592   p_information1,
593   p_information2,
594   p_information3,
595   p_information4,
596   p_information5,
597   p_information6,
598   p_information7,
599   p_information8,
600   p_information9,
601   p_information10,
602   p_information11,
603   p_information12,
604   p_information13,
605   p_information14,
606   p_information15,
607   p_information16,
608   p_information17,
609   p_information18,
610   p_information19,
611   p_information20,
612   p_information21,
613   p_information22,
614   p_information23,
615   p_information24,
616   p_information25,
617   p_information26,
618   p_information27,
619   p_information28,
620   p_information29,
621   p_information30
622  ,p_qual_framework_id     -- BUG3356369
623  ,p_qualification_type
624  ,p_credit_type
625  ,p_credits
626  ,p_level_type
627  ,p_level_number
628  ,p_field
629  ,p_sub_field
630  ,p_provider
631  ,p_qa_organization
632   );
633   --
634   -- Having converted the arguments into the per_eqt_rec
635   -- plsql record structure we call the corresponding record business process.
636   --
637   ins(l_rec,p_effective_date,p_validate);
638   --
639   -- As the primary key argument(s)
640   -- are specified as an OUT's we must set these values.
641   --
642   p_qualification_type_id := l_rec.qualification_type_id;
643   p_object_version_number := l_rec.object_version_number;
644   --
645   hr_utility.set_location(' Leaving:'||l_proc, 10);
646 End ins;
647 --
648 end per_eqt_ins;