DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_OPI_INS

Source


1 Package Body ben_opi_ins as
2 /* $Header: beopirhi.pkb 115.0 2003/09/23 10:15:09 hmani noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_opi_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 insert the row into the schema.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) To raise any other errors.
23 --
24 -- Pre Conditions:
25 --   This is an internal private procedure which must be called from the ins
26 --   procedure and must have all mandatory attributes set (except the
27 --   object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 --   A opt/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 --   If a check, unique or parent integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 --   None.
41 --
42 -- Access Status:
43 --   Internal Table Handopt Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy ben_opi_shd.g_rec_type) is
48 --
49   l_proc  varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   p_rec.object_version_number := 1;  -- Initialise the object version
54   --
55   --
56   -- Insert the row into: ben_opt_extra_info
57   --
58   insert into ben_opt_extra_info
59   (	opt_extra_info_id,
60 	information_type,
61 	opt_id,
62 	request_id,
63 	program_application_id,
64 	program_id,
65 	program_update_date,
66 	opi_attribute_category,
67 	opi_attribute1,
68 	opi_attribute2,
69 	opi_attribute3,
70 	opi_attribute4,
71 	opi_attribute5,
72 	opi_attribute6,
73 	opi_attribute7,
74 	opi_attribute8,
75 	opi_attribute9,
76 	opi_attribute10,
77 	opi_attribute11,
78 	opi_attribute12,
79 	opi_attribute13,
80 	opi_attribute14,
81 	opi_attribute15,
82 	opi_attribute16,
83 	opi_attribute17,
84 	opi_attribute18,
85 	opi_attribute19,
86 	opi_attribute20,
87 	opi_information_category,
88 	opi_information1,
89 	opi_information2,
90 	opi_information3,
91 	opi_information4,
92 	opi_information5,
93 	opi_information6,
94 	opi_information7,
95 	opi_information8,
96 	opi_information9,
97 	opi_information10,
98 	opi_information11,
99 	opi_information12,
100 	opi_information13,
101 	opi_information14,
102 	opi_information15,
103 	opi_information16,
104 	opi_information17,
105 	opi_information18,
106 	opi_information19,
107 	opi_information20,
108 	opi_information21,
109 	opi_information22,
110 	opi_information23,
111 	opi_information24,
112 	opi_information25,
113 	opi_information26,
114 	opi_information27,
115 	opi_information28,
116 	opi_information29,
117 	opi_information30,
118 	object_version_number
119   )
120   Values
121   (	p_rec.opt_extra_info_id,
122 	p_rec.information_type,
123 	p_rec.opt_id,
124 	p_rec.request_id,
125 	p_rec.program_application_id,
126 	p_rec.program_id,
127 	p_rec.program_update_date,
128 	p_rec.opi_attribute_category,
129 	p_rec.opi_attribute1,
130 	p_rec.opi_attribute2,
131 	p_rec.opi_attribute3,
132 	p_rec.opi_attribute4,
133 	p_rec.opi_attribute5,
134 	p_rec.opi_attribute6,
135 	p_rec.opi_attribute7,
136 	p_rec.opi_attribute8,
137 	p_rec.opi_attribute9,
138 	p_rec.opi_attribute10,
139 	p_rec.opi_attribute11,
140 	p_rec.opi_attribute12,
141 	p_rec.opi_attribute13,
142 	p_rec.opi_attribute14,
143 	p_rec.opi_attribute15,
144 	p_rec.opi_attribute16,
145 	p_rec.opi_attribute17,
146 	p_rec.opi_attribute18,
147 	p_rec.opi_attribute19,
148 	p_rec.opi_attribute20,
149 	p_rec.opi_information_category,
150 	p_rec.opi_information1,
151 	p_rec.opi_information2,
152 	p_rec.opi_information3,
153 	p_rec.opi_information4,
154 	p_rec.opi_information5,
155 	p_rec.opi_information6,
156 	p_rec.opi_information7,
157 	p_rec.opi_information8,
158 	p_rec.opi_information9,
159 	p_rec.opi_information10,
160 	p_rec.opi_information11,
161 	p_rec.opi_information12,
162 	p_rec.opi_information13,
163 	p_rec.opi_information14,
164 	p_rec.opi_information15,
165 	p_rec.opi_information16,
166 	p_rec.opi_information17,
167 	p_rec.opi_information18,
168 	p_rec.opi_information19,
169 	p_rec.opi_information20,
170 	p_rec.opi_information21,
171 	p_rec.opi_information22,
172 	p_rec.opi_information23,
173 	p_rec.opi_information24,
174 	p_rec.opi_information25,
175 	p_rec.opi_information26,
176 	p_rec.opi_information27,
177 	p_rec.opi_information28,
178 	p_rec.opi_information29,
179 	p_rec.opi_information30,
180 	p_rec.object_version_number
181   );
182   --
183   --
184   hr_utility.set_location(' Leaving:'||l_proc, 10);
185 Exception
186   When hr_api.check_integrity_violated Then
187     -- A check constraint has been violated
188     ben_opi_shd.constraint_error
189       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
190   When hr_api.parent_integrity_violated Then
191     -- Parent integrity has been violated
192     ben_opi_shd.constraint_error
193       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
194   When hr_api.unique_integrity_violated Then
195     -- Unique integrity has been violated
196     ben_opi_shd.constraint_error
197       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
198   When Others Then
199     Raise;
200 End insert_dml;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |------------------------------< pre_insert >------------------------------|
204 -- ----------------------------------------------------------------------------
205 -- {Start Of Comments}
206 --
207 -- Description:
208 --   This private procedure contains any processing which is required before
209 --   the insert dml. Presently, if the entity has a corresponding primary
210 --   key which is maintained by an associating sequence, the primary key for
211 --   the entity will be populated with the next sequence value in
212 --   preparation for the insert dml.
213 --
214 -- Pre Conditions:
215 --   This is an internal procedure which is called from the ins procedure.
216 --
217 -- In Parameters:
218 --   A opt/Sql record structre.
219 --
220 -- Post Success:
221 --   Processing continues.
222 --
223 -- Post Failure:
224 --   If an error has occurred, an error message and exception will be raised
225 --   but not handled.
226 --
227 -- Developer Implementation Notes:
228 --   Any pre-processing required before the insert dml is issued should be
229 --   coded within this procedure. As stated above, a good example is the
230 --   generation of a primary key number via a corresponding sequence.
231 --   It is important to note that any 3rd party maintenance should be reviewed
232 --   before optacing in this procedure.
233 --
234 -- Access Status:
235 --   Internal Table Handopt Use Only.
236 --
237 -- {End Of Comments}
238 -- ----------------------------------------------------------------------------
239 Procedure pre_insert(p_rec  in out nocopy ben_opi_shd.g_rec_type) is
240 --
241   l_proc  varchar2(72) := g_package||'pre_insert';
242 --
243   Cursor C_Sel1 is select ben_opt_extra_info_s.nextval from sys.dual;
244 --
245 Begin
246   hr_utility.set_location('Entering:'||l_proc, 5);
247   --
248   --
249   -- Select the next sequence number
250   --
251   Open C_Sel1;
252   Fetch C_Sel1 Into p_rec.opt_extra_info_id;
253   Close C_Sel1;
254   --
255   hr_utility.set_location(' Leaving:'||l_proc, 10);
256 End pre_insert;
257 --
258 -- ----------------------------------------------------------------------------
259 -- |-----------------------------< post_insert >------------------------------|
260 -- ----------------------------------------------------------------------------
261 -- {Start Of Comments}
262 --
263 -- Description:
264 --   This private procedure contains any processing which is required after the
265 --   insert dml.
266 --
267 -- Pre Conditions:
268 --   This is an internal procedure which is called from the ins procedure.
269 --
270 -- In Parameters:
271 --   A opt/Sql record structre.
272 --
273 -- Post Success:
274 --   Processing continues.
275 --
276 -- Post Failure:
277 --   If an error has occurred, an error message and exception will be raised
278 --   but not handled.
279 --
280 -- Developer Implementation Notes:
281 --   Any post-processing required after the insert dml is issued should be
282 --   coded within this procedure. It is important to note that any 3rd party
283 --   maintenance should be reviewed before optacing in this procedure.
284 --
285 -- Access Status:
286 --   Internal Table Handopt Use Only.
287 --
288 -- {End Of Comments}
289 -- ----------------------------------------------------------------------------
290 Procedure post_insert(p_rec in ben_opi_shd.g_rec_type) is
291 --
292   l_proc  varchar2(72) := g_package||'post_insert';
293 --
294 Begin
295   hr_utility.set_location('Entering:'||l_proc, 5);
296   --
297   -- This is a hook point and the user hook for post_insert is called here.
298   --
299   begin
300      ben_opi_rki.after_insert	(
301 	p_opt_extra_info_id		=>	p_rec.opt_extra_info_id		,
302 	p_information_type		=>	p_rec.information_type		,
303 	p_opt_id				=>	p_rec.opt_id			,
304 	p_request_id			=>	p_rec.request_id			,
305 	p_program_application_id	=>	p_rec.program_application_id	,
306 	p_program_id			=>	p_rec.program_id			,
307 	p_program_update_date		=>	p_rec.program_update_date	,
308 	p_opi_attribute_category	=>	p_rec.opi_attribute_category	,
309 	p_opi_attribute1			=>	p_rec.opi_attribute1	,
310 	p_opi_attribute2			=>	p_rec.opi_attribute2	,
311 	p_opi_attribute3			=>	p_rec.opi_attribute3	,
312 	p_opi_attribute4			=>	p_rec.opi_attribute4	,
313 	p_opi_attribute5			=>	p_rec.opi_attribute5	,
314 	p_opi_attribute6			=>	p_rec.opi_attribute6	,
315 	p_opi_attribute7			=>	p_rec.opi_attribute7	,
316 	p_opi_attribute8			=>	p_rec.opi_attribute8	,
317 	p_opi_attribute9			=>	p_rec.opi_attribute9	,
318 	p_opi_attribute10			=>	p_rec.opi_attribute10	,
319 	p_opi_attribute11			=>	p_rec.opi_attribute11	,
320 	p_opi_attribute12			=>	p_rec.opi_attribute12	,
321 	p_opi_attribute13			=>	p_rec.opi_attribute13	,
322 	p_opi_attribute14			=>	p_rec.opi_attribute14	,
323 	p_opi_attribute15			=>	p_rec.opi_attribute15	,
324 	p_opi_attribute16			=>	p_rec.opi_attribute16	,
325 	p_opi_attribute17			=>	p_rec.opi_attribute17	,
326 	p_opi_attribute18			=>	p_rec.opi_attribute18	,
327 	p_opi_attribute19			=>	p_rec.opi_attribute19	,
328 	p_opi_attribute20			=>	p_rec.opi_attribute20	,
329 	p_opi_information_category	=>	p_rec.opi_information_category	,
330 	p_opi_information1		=>	p_rec.opi_information1	,
331 	p_opi_information2		=>	p_rec.opi_information2	,
332 	p_opi_information3		=>	p_rec.opi_information3	,
333 	p_opi_information4		=>	p_rec.opi_information4	,
334 	p_opi_information5		=>	p_rec.opi_information5	,
335 	p_opi_information6		=>	p_rec.opi_information6	,
336 	p_opi_information7		=>	p_rec.opi_information7	,
337 	p_opi_information8		=>	p_rec.opi_information8	,
338 	p_opi_information9		=>	p_rec.opi_information9	,
339 	p_opi_information10		=>	p_rec.opi_information10	,
340 	p_opi_information11		=>	p_rec.opi_information11	,
341 	p_opi_information12		=>	p_rec.opi_information12	,
342 	p_opi_information13		=>	p_rec.opi_information13	,
343 	p_opi_information14		=>	p_rec.opi_information14	,
344 	p_opi_information15		=>	p_rec.opi_information15	,
345 	p_opi_information16		=>	p_rec.opi_information16	,
346 	p_opi_information17		=>	p_rec.opi_information17	,
347 	p_opi_information18		=>	p_rec.opi_information18	,
348 	p_opi_information19		=>	p_rec.opi_information19	,
349 	p_opi_information20		=>	p_rec.opi_information20	,
350 	p_opi_information21		=>	p_rec.opi_information21	,
351 	p_opi_information22		=>	p_rec.opi_information22	,
352 	p_opi_information23		=>	p_rec.opi_information23	,
353 	p_opi_information24		=>	p_rec.opi_information24	,
354 	p_opi_information25		=>	p_rec.opi_information25	,
355 	p_opi_information26		=>	p_rec.opi_information26	,
356 	p_opi_information27		=>	p_rec.opi_information27	,
357 	p_opi_information28		=>	p_rec.opi_information28	,
358 	p_opi_information29		=>	p_rec.opi_information29	,
359 	p_opi_information30		=>	p_rec.opi_information30
360 	);
361      exception
362         when hr_api.cannot_find_prog_unit then
363              hr_api.cannot_find_prog_unit_error
364 		 (	p_module_name => 'BEN_OPT_EXTRA_INFO'
365 			,p_hook_type  => 'AI'
366 	        );
367   end;
368   -- End of API User Hook for post_insert.
369   hr_utility.set_location(' Leaving:'||l_proc, 10);
370 End post_insert;
371 --
372 -- ----------------------------------------------------------------------------
373 -- |---------------------------------< ins >----------------------------------|
374 -- ----------------------------------------------------------------------------
375 Procedure ins
376   (
377   p_rec        in out nocopy ben_opi_shd.g_rec_type,
378   p_validate   in     boolean default false
379   ) is
380 --
381   l_proc  varchar2(72) := g_package||'ins';
382 --
383 Begin
384   hr_utility.set_location('Entering:'||l_proc, 5);
385   --
386   -- Determine if the business process is to be validated.
387   --
388   If p_validate then
389     --
390     -- Issue the savepoint.
391     --
392     SAVEPOINT ins_ben_opi;
393   End If;
394   --
395   -- Call the supporting insert validate operations
396   --
397   ben_opi_bus.insert_validate(p_rec);
398   --
399   -- Call the supporting pre-insert operation
400   --
401   pre_insert(p_rec);
402   --
403   -- Insert the row
404   --
405   insert_dml(p_rec);
406   --
407   -- Call the supporting post-insert operation
408   --
409   post_insert(p_rec);
410   --
411   -- If we are validating then raise the Validate_Enabled exception
412   --
413   If p_validate then
414     Raise HR_Api.Validate_Enabled;
415   End If;
416   --
417   hr_utility.set_location(' Leaving:'||l_proc, 10);
418 Exception
419   When HR_Api.Validate_Enabled Then
420     --
421     -- As the Validate_Enabled exception has been raised
422     -- we must rollback to the savepoint
423     --
424     ROLLBACK TO ins_ben_opi;
425 end ins;
426 --
427 -- ----------------------------------------------------------------------------
428 -- |---------------------------------< ins >----------------------------------|
429 -- ----------------------------------------------------------------------------
430 Procedure ins
431   (
432   p_opt_extra_info_id            out nocopy number,
433   p_information_type             in varchar2,
434   p_opt_id                       in number,
435   p_request_id                   in number           default null,
436   p_program_application_id       in number           default null,
437   p_program_id                   in number           default null,
438   p_program_update_date          in date             default null,
439   p_opi_attribute_category       in varchar2         default null,
440   p_opi_attribute1               in varchar2         default null,
441   p_opi_attribute2               in varchar2         default null,
442   p_opi_attribute3               in varchar2         default null,
443   p_opi_attribute4               in varchar2         default null,
444   p_opi_attribute5               in varchar2         default null,
445   p_opi_attribute6               in varchar2         default null,
446   p_opi_attribute7               in varchar2         default null,
447   p_opi_attribute8               in varchar2         default null,
448   p_opi_attribute9               in varchar2         default null,
449   p_opi_attribute10              in varchar2         default null,
450   p_opi_attribute11              in varchar2         default null,
451   p_opi_attribute12              in varchar2         default null,
452   p_opi_attribute13              in varchar2         default null,
453   p_opi_attribute14              in varchar2         default null,
454   p_opi_attribute15              in varchar2         default null,
455   p_opi_attribute16              in varchar2         default null,
456   p_opi_attribute17              in varchar2         default null,
457   p_opi_attribute18              in varchar2         default null,
458   p_opi_attribute19              in varchar2         default null,
459   p_opi_attribute20              in varchar2         default null,
460   p_opi_information_category     in varchar2         default null,
461   p_opi_information1             in varchar2         default null,
462   p_opi_information2             in varchar2         default null,
463   p_opi_information3             in varchar2         default null,
464   p_opi_information4             in varchar2         default null,
465   p_opi_information5             in varchar2         default null,
466   p_opi_information6             in varchar2         default null,
467   p_opi_information7             in varchar2         default null,
468   p_opi_information8             in varchar2         default null,
469   p_opi_information9             in varchar2         default null,
470   p_opi_information10            in varchar2         default null,
471   p_opi_information11            in varchar2         default null,
472   p_opi_information12            in varchar2         default null,
473   p_opi_information13            in varchar2         default null,
474   p_opi_information14            in varchar2         default null,
475   p_opi_information15            in varchar2         default null,
476   p_opi_information16            in varchar2         default null,
477   p_opi_information17            in varchar2         default null,
478   p_opi_information18            in varchar2         default null,
479   p_opi_information19            in varchar2         default null,
480   p_opi_information20            in varchar2         default null,
481   p_opi_information21            in varchar2         default null,
482   p_opi_information22            in varchar2         default null,
483   p_opi_information23            in varchar2         default null,
484   p_opi_information24            in varchar2         default null,
485   p_opi_information25            in varchar2         default null,
486   p_opi_information26            in varchar2         default null,
487   p_opi_information27            in varchar2         default null,
488   p_opi_information28            in varchar2         default null,
489   p_opi_information29            in varchar2         default null,
490   p_opi_information30            in varchar2         default null,
491   p_object_version_number        out nocopy number,
492   p_validate                     in boolean   default false
493   ) is
494 --
495   l_rec	  ben_opi_shd.g_rec_type;
496   l_proc  varchar2(72) := g_package||'ins';
497 --
498 Begin
499   hr_utility.set_location('Entering:'||l_proc, 5);
500   --
501   -- Call conversion function to turn arguments into the
502   -- p_rec structure.
503   --
504   l_rec :=
505   ben_opi_shd.convert_args
506   (
507   null,
508   p_information_type,
509   p_opt_id,
510   p_request_id,
511   p_program_application_id,
512   p_program_id,
513   p_program_update_date,
514   p_opi_attribute_category,
515   p_opi_attribute1,
516   p_opi_attribute2,
517   p_opi_attribute3,
518   p_opi_attribute4,
519   p_opi_attribute5,
520   p_opi_attribute6,
521   p_opi_attribute7,
522   p_opi_attribute8,
523   p_opi_attribute9,
524   p_opi_attribute10,
525   p_opi_attribute11,
526   p_opi_attribute12,
527   p_opi_attribute13,
528   p_opi_attribute14,
529   p_opi_attribute15,
530   p_opi_attribute16,
531   p_opi_attribute17,
532   p_opi_attribute18,
533   p_opi_attribute19,
534   p_opi_attribute20,
535   p_opi_information_category,
536   p_opi_information1,
537   p_opi_information2,
538   p_opi_information3,
539   p_opi_information4,
540   p_opi_information5,
541   p_opi_information6,
542   p_opi_information7,
543   p_opi_information8,
544   p_opi_information9,
545   p_opi_information10,
546   p_opi_information11,
547   p_opi_information12,
548   p_opi_information13,
549   p_opi_information14,
550   p_opi_information15,
551   p_opi_information16,
552   p_opi_information17,
553   p_opi_information18,
554   p_opi_information19,
555   p_opi_information20,
556   p_opi_information21,
557   p_opi_information22,
558   p_opi_information23,
559   p_opi_information24,
560   p_opi_information25,
561   p_opi_information26,
562   p_opi_information27,
563   p_opi_information28,
564   p_opi_information29,
565   p_opi_information30,
566   null
567   );
568   --
569   -- Having converted the arguments into the ben_opi_rec
570   -- optsql record structure we call the corresponding record business process.
571   --
572   ins(l_rec, p_validate);
573   --
574   -- As the primary key argument(s)
575   -- are specified as an OUT's we must set these values.
576   --
577   p_opt_extra_info_id := l_rec.opt_extra_info_id;
578   p_object_version_number := l_rec.object_version_number;
579   --
580   hr_utility.set_location(' Leaving:'||l_proc, 10);
581 End ins;
582 --
583 end ben_opi_ins;