DBA Data[Home] [Help]

PACKAGE BODY: APPS.PE_POI_INS

Source


1 Package Body pe_poi_ins as
2 /* $Header: pepoirhi.pkb 120.0 2005/05/31 14:50:38 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pe_poi_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 Pl/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 Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy pe_poi_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   -- Insert the row into: per_position_extra_info
56   --
57   insert into per_position_extra_info
58   (	position_extra_info_id,
59 	position_id,
60 	information_type,
61 	request_id,
62 	program_application_id,
63 	program_id,
64 	program_update_date,
65 	poei_attribute_category,
66 	poei_attribute1,
67 	poei_attribute2,
68 	poei_attribute3,
69 	poei_attribute4,
70 	poei_attribute5,
71 	poei_attribute6,
72 	poei_attribute7,
73 	poei_attribute8,
74 	poei_attribute9,
75 	poei_attribute10,
76 	poei_attribute11,
77 	poei_attribute12,
78 	poei_attribute13,
79 	poei_attribute14,
80 	poei_attribute15,
81 	poei_attribute16,
82 	poei_attribute17,
83 	poei_attribute18,
84 	poei_attribute19,
85 	poei_attribute20,
86 	poei_information_category,
87 	poei_information1,
88 	poei_information2,
89 	poei_information3,
90 	poei_information4,
91 	poei_information5,
92 	poei_information6,
93 	poei_information7,
94 	poei_information8,
95 	poei_information9,
96 	poei_information10,
97 	poei_information11,
98 	poei_information12,
99 	poei_information13,
100 	poei_information14,
101 	poei_information15,
102 	poei_information16,
103 	poei_information17,
104 	poei_information18,
105 	poei_information19,
106 	poei_information20,
107 	poei_information21,
108 	poei_information22,
109 	poei_information23,
110 	poei_information24,
111 	poei_information25,
112 	poei_information26,
113 	poei_information27,
114 	poei_information28,
115 	poei_information29,
116 	poei_information30,
117 	object_version_number
118   )
119   Values
120   (	p_rec.position_extra_info_id,
121 	p_rec.position_id,
122 	p_rec.information_type,
123 	p_rec.request_id,
124 	p_rec.program_application_id,
125 	p_rec.program_id,
126 	p_rec.program_update_date,
127 	p_rec.poei_attribute_category,
128 	p_rec.poei_attribute1,
129 	p_rec.poei_attribute2,
130 	p_rec.poei_attribute3,
131 	p_rec.poei_attribute4,
132 	p_rec.poei_attribute5,
133 	p_rec.poei_attribute6,
134 	p_rec.poei_attribute7,
135 	p_rec.poei_attribute8,
136 	p_rec.poei_attribute9,
137 	p_rec.poei_attribute10,
138 	p_rec.poei_attribute11,
139 	p_rec.poei_attribute12,
140 	p_rec.poei_attribute13,
141 	p_rec.poei_attribute14,
142 	p_rec.poei_attribute15,
143 	p_rec.poei_attribute16,
144 	p_rec.poei_attribute17,
145 	p_rec.poei_attribute18,
146 	p_rec.poei_attribute19,
147 	p_rec.poei_attribute20,
148 	p_rec.poei_information_category,
149 	p_rec.poei_information1,
150 	p_rec.poei_information2,
151 	p_rec.poei_information3,
152 	p_rec.poei_information4,
153 	p_rec.poei_information5,
154 	p_rec.poei_information6,
155 	p_rec.poei_information7,
156 	p_rec.poei_information8,
157 	p_rec.poei_information9,
158 	p_rec.poei_information10,
159 	p_rec.poei_information11,
160 	p_rec.poei_information12,
161 	p_rec.poei_information13,
162 	p_rec.poei_information14,
163 	p_rec.poei_information15,
164 	p_rec.poei_information16,
165 	p_rec.poei_information17,
166 	p_rec.poei_information18,
167 	p_rec.poei_information19,
168 	p_rec.poei_information20,
169 	p_rec.poei_information21,
170 	p_rec.poei_information22,
171 	p_rec.poei_information23,
172 	p_rec.poei_information24,
173 	p_rec.poei_information25,
174 	p_rec.poei_information26,
175 	p_rec.poei_information27,
176 	p_rec.poei_information28,
177 	p_rec.poei_information29,
178 	p_rec.poei_information30,
179 	p_rec.object_version_number
180   );
181   --
182   hr_utility.set_location(' Leaving:'||l_proc, 10);
183 Exception
184   When hr_api.check_integrity_violated Then
185     -- A check constraint has been violated
186     pe_poi_shd.constraint_error
187       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
188   When hr_api.parent_integrity_violated Then
189     -- Parent integrity has been violated
190     pe_poi_shd.constraint_error
191       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
192   When hr_api.unique_integrity_violated Then
193     -- Unique integrity has been violated
194     pe_poi_shd.constraint_error
195       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
196   When Others Then
197     Raise;
198 End insert_dml;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |------------------------------< pre_insert >------------------------------|
202 -- ----------------------------------------------------------------------------
203 -- {Start Of Comments}
204 --
205 -- Description:
206 --   This private procedure contains any processing which is required before
207 --   the insert dml. Presently, if the entity has a corresponding primary
208 --   key which is maintained by an associating sequence, the primary key for
209 --   the entity will be populated with the next sequence value in
210 --   preparation for the insert dml.
211 --
212 -- Pre Conditions:
213 --   This is an internal procedure which is called from the ins procedure.
214 --
215 -- In Parameters:
216 --   A Pl/Sql record structre.
217 --
218 -- Post Success:
219 --   Processing continues.
220 --
221 -- Post Failure:
222 --   If an error has occurred, an error message and exception will be raised
223 --   but not handled.
224 --
225 -- Developer Implementation Notes:
226 --   Any pre-processing required before the insert dml is issued should be
227 --   coded within this procedure. As stated above, a good example is the
228 --   generation of a primary key number via a corresponding sequence.
229 --   It is important to note that any 3rd party maintenance should be reviewed
230 --   before placing in this procedure.
231 --
232 -- Access Status:
233 --   Internal Table Handler Use Only.
234 --
235 -- {End Of Comments}
236 -- ----------------------------------------------------------------------------
237 Procedure pre_insert(p_rec  in out nocopy pe_poi_shd.g_rec_type) is
238 --
239   l_proc  varchar2(72) := g_package||'pre_insert';
240 --
241   Cursor C_Sel1 is select per_position_extra_info_s.nextval from sys.dual;
242 --
243 Begin
244   hr_utility.set_location('Entering:'||l_proc, 5);
245   --
246   --
247   -- Select the next sequence number
248   --
249   Open C_Sel1;
250   Fetch C_Sel1 Into p_rec.position_extra_info_id;
251   Close C_Sel1;
252   --
253   hr_utility.set_location(' Leaving:'||l_proc, 10);
254 End pre_insert;
255 --
256 -- ----------------------------------------------------------------------------
257 -- |-----------------------------< post_insert >------------------------------|
258 -- ----------------------------------------------------------------------------
259 -- {Start Of Comments}
260 --
261 -- Description:
262 --   This private procedure contains any processing which is required after the
263 --   insert dml.
264 --
265 -- Pre Conditions:
266 --   This is an internal procedure which is called from the ins procedure.
267 --
268 -- In Parameters:
269 --   A Pl/Sql record structre.
270 --
271 -- Post Success:
272 --   Processing continues.
273 --
274 -- Post Failure:
275 --   If an error has occurred, an error message and exception will be raised
276 --   but not handled.
277 --
278 -- Developer Implementation Notes:
279 --   Any post-processing required after the insert dml is issued should be
280 --   coded within this procedure. It is important to note that any 3rd party
281 --   maintenance should be reviewed before placing in this procedure.
282 --
283 -- Access Status:
284 --   Internal Table Handler Use Only.
285 --
286 -- {End Of Comments}
287 -- ----------------------------------------------------------------------------
288 Procedure post_insert(p_rec in pe_poi_shd.g_rec_type) is
289 --
290   l_proc  varchar2(72) := g_package||'post_insert';
291 --
292 Begin
293   hr_utility.set_location('Entering:'||l_proc, 5);
294   --
295   -- This is a hook point and the user hook for post_insert is called here.
296   --
297   begin
298      pe_poi_rki.after_insert	(
299 	p_position_extra_info_id	=>	p_rec.position_extra_info_id	,
300 	p_position_id			=>	p_rec.position_id			,
301 	p_information_type		=>	p_rec.information_type		,
302 	p_request_id			=>	p_rec.request_id			,
303 	p_program_application_id	=>	p_rec.program_application_id	,
304 	p_program_id			=>	p_rec.program_id			,
305 	p_program_update_date		=>	p_rec.program_update_date	,
306 	p_poei_attribute_category	=>	p_rec.poei_attribute_category	,
307 	p_poei_attribute1		=>	p_rec.poei_attribute1		,
308 	p_poei_attribute2		=>	p_rec.poei_attribute2		,
309 	p_poei_attribute3		=>	p_rec.poei_attribute3		,
310 	p_poei_attribute4		=>	p_rec.poei_attribute4		,
311 	p_poei_attribute5		=>	p_rec.poei_attribute5		,
312 	p_poei_attribute6		=>	p_rec.poei_attribute6		,
313 	p_poei_attribute7		=>	p_rec.poei_attribute7		,
314 	p_poei_attribute8		=>	p_rec.poei_attribute8		,
315 	p_poei_attribute9		=>	p_rec.poei_attribute9		,
316 	p_poei_attribute10		=>	p_rec.poei_attribute10		,
317 	p_poei_attribute11		=>	p_rec.poei_attribute11		,
318 	p_poei_attribute12		=>	p_rec.poei_attribute12		,
319 	p_poei_attribute13		=>	p_rec.poei_attribute13		,
320 	p_poei_attribute14		=>	p_rec.poei_attribute14		,
321 	p_poei_attribute15		=>	p_rec.poei_attribute15		,
322 	p_poei_attribute16		=>	p_rec.poei_attribute16		,
323 	p_poei_attribute17		=>	p_rec.poei_attribute17		,
324 	p_poei_attribute18		=>	p_rec.poei_attribute18		,
325 	p_poei_attribute19		=>	p_rec.poei_attribute19		,
326 	p_poei_attribute20		=>	p_rec.poei_attribute20		,
327 	p_poei_information_category	=>	p_rec.poei_information_category	,
328 	p_poei_information1		=>	p_rec.poei_information1		,
329 	p_poei_information2		=>	p_rec.poei_information2		,
330 	p_poei_information3		=>	p_rec.poei_information3		,
331 	p_poei_information4		=>	p_rec.poei_information4		,
332 	p_poei_information5		=>	p_rec.poei_information5		,
333 	p_poei_information6		=>	p_rec.poei_information6		,
334 	p_poei_information7		=>	p_rec.poei_information7		,
335 	p_poei_information8		=>	p_rec.poei_information8		,
336 	p_poei_information9		=>	p_rec.poei_information9		,
337 	p_poei_information10		=>	p_rec.poei_information10	,
338 	p_poei_information11		=>	p_rec.poei_information11	,
339 	p_poei_information12		=>	p_rec.poei_information12	,
340 	p_poei_information13		=>	p_rec.poei_information13	,
341 	p_poei_information14		=>	p_rec.poei_information14	,
342 	p_poei_information15		=>	p_rec.poei_information15	,
343 	p_poei_information16		=>	p_rec.poei_information16	,
344 	p_poei_information17		=>	p_rec.poei_information17	,
345 	p_poei_information18		=>	p_rec.poei_information18	,
346 	p_poei_information19		=>	p_rec.poei_information19	,
347 	p_poei_information20		=>	p_rec.poei_information20	,
348 	p_poei_information21		=>	p_rec.poei_information21	,
349 	p_poei_information22		=>	p_rec.poei_information22	,
350 	p_poei_information23		=>	p_rec.poei_information23	,
351 	p_poei_information24		=>	p_rec.poei_information24	,
352 	p_poei_information25		=>	p_rec.poei_information25	,
353 	p_poei_information26		=>	p_rec.poei_information26	,
354 	p_poei_information27		=>	p_rec.poei_information27	,
355 	p_poei_information28		=>	p_rec.poei_information28	,
356 	p_poei_information29		=>	p_rec.poei_information29	,
357 	p_poei_information30		=>	p_rec.poei_information30
358 	);
359      exception
360         when hr_api.cannot_find_prog_unit then
361              hr_api.cannot_find_prog_unit_error
362 		 (	p_module_name => 'PER_POSITION_EXTRA_INFO'
363 			,p_hook_type  => 'AI'
364 	        );
365   end;
366   -- End of API User Hook for post_insert.
367   --
368   hr_utility.set_location(' Leaving:'||l_proc, 10);
369 End post_insert;
370 --
371 -- ----------------------------------------------------------------------------
372 -- |---------------------------------< ins >----------------------------------|
373 -- ----------------------------------------------------------------------------
374 Procedure ins
375   (
376   p_rec        in out nocopy pe_poi_shd.g_rec_type,
377   p_validate   in     boolean default false
378   ) is
379 --
380   l_proc  varchar2(72) := g_package||'ins';
381 --
382 Begin
383   hr_utility.set_location('Entering:'||l_proc, 5);
384   --
385   -- Determine if the business process is to be validated.
386   --
387   If p_validate then
388     --
389     -- Issue the savepoint.
390     --
391     SAVEPOINT ins_pe_poi;
392   End If;
393   --
394   -- Call the supporting insert validate operations
395   --
396   pe_poi_bus.insert_validate(p_rec);
397   --
398   -- Call the supporting pre-insert operation
399   --
400   pre_insert(p_rec);
401   --
402   -- Insert the row
403   --
404   insert_dml(p_rec);
405   --
406   -- Call the supporting post-insert operation
407   --
408   post_insert(p_rec);
409   --
410   -- If we are validating then raise the Validate_Enabled exception
411   --
412   If p_validate then
413     Raise HR_Api.Validate_Enabled;
414   End If;
415   --
416   hr_utility.set_location(' Leaving:'||l_proc, 10);
417 Exception
418   When HR_Api.Validate_Enabled Then
419     --
420     -- As the Validate_Enabled exception has been raised
421     -- we must rollback to the savepoint
422     --
423     ROLLBACK TO ins_pe_poi;
424 end ins;
425 --
426 -- ----------------------------------------------------------------------------
427 -- |---------------------------------< ins >----------------------------------|
428 -- ----------------------------------------------------------------------------
429 Procedure ins
430   (
431   p_position_extra_info_id       out nocopy number,
432   p_position_id                  in number,
433   p_information_type             in varchar2,
434   p_request_id                   in number           default null,
435   p_program_application_id       in number           default null,
436   p_program_id                   in number           default null,
437   p_program_update_date          in date             default null,
438   p_poei_attribute_category      in varchar2         default null,
439   p_poei_attribute1              in varchar2         default null,
440   p_poei_attribute2              in varchar2         default null,
441   p_poei_attribute3              in varchar2         default null,
442   p_poei_attribute4              in varchar2         default null,
443   p_poei_attribute5              in varchar2         default null,
444   p_poei_attribute6              in varchar2         default null,
445   p_poei_attribute7              in varchar2         default null,
446   p_poei_attribute8              in varchar2         default null,
447   p_poei_attribute9              in varchar2         default null,
448   p_poei_attribute10             in varchar2         default null,
449   p_poei_attribute11             in varchar2         default null,
450   p_poei_attribute12             in varchar2         default null,
451   p_poei_attribute13             in varchar2         default null,
452   p_poei_attribute14             in varchar2         default null,
453   p_poei_attribute15             in varchar2         default null,
454   p_poei_attribute16             in varchar2         default null,
455   p_poei_attribute17             in varchar2         default null,
456   p_poei_attribute18             in varchar2         default null,
457   p_poei_attribute19             in varchar2         default null,
458   p_poei_attribute20             in varchar2         default null,
459   p_poei_information_category    in varchar2         default null,
460   p_poei_information1            in varchar2         default null,
461   p_poei_information2            in varchar2         default null,
462   p_poei_information3            in varchar2         default null,
463   p_poei_information4            in varchar2         default null,
464   p_poei_information5            in varchar2         default null,
465   p_poei_information6            in varchar2         default null,
466   p_poei_information7            in varchar2         default null,
467   p_poei_information8            in varchar2         default null,
468   p_poei_information9            in varchar2         default null,
469   p_poei_information10           in varchar2         default null,
470   p_poei_information11           in varchar2         default null,
471   p_poei_information12           in varchar2         default null,
472   p_poei_information13           in varchar2         default null,
473   p_poei_information14           in varchar2         default null,
474   p_poei_information15           in varchar2         default null,
475   p_poei_information16           in varchar2         default null,
476   p_poei_information17           in varchar2         default null,
477   p_poei_information18           in varchar2         default null,
478   p_poei_information19           in varchar2         default null,
479   p_poei_information20           in varchar2         default null,
480   p_poei_information21           in varchar2         default null,
481   p_poei_information22           in varchar2         default null,
482   p_poei_information23           in varchar2         default null,
483   p_poei_information24           in varchar2         default null,
484   p_poei_information25           in varchar2         default null,
485   p_poei_information26           in varchar2         default null,
486   p_poei_information27           in varchar2         default null,
487   p_poei_information28           in varchar2         default null,
488   p_poei_information29           in varchar2         default null,
489   p_poei_information30           in varchar2         default null,
490   p_object_version_number        out nocopy number,
491   p_validate                     in boolean   default false
492   ) is
493 --
494   l_rec	  pe_poi_shd.g_rec_type;
495   l_proc  varchar2(72) := g_package||'ins';
496 --
497 Begin
498   hr_utility.set_location('Entering:'||l_proc, 5);
499   --
500   -- Call conversion function to turn arguments into the
501   -- p_rec structure.
502   --
503   l_rec :=
504   pe_poi_shd.convert_args
505   (
506   null,
507   p_position_id,
508   p_information_type,
509   p_request_id,
510   p_program_application_id,
511   p_program_id,
512   p_program_update_date,
513   p_poei_attribute_category,
514   p_poei_attribute1,
515   p_poei_attribute2,
516   p_poei_attribute3,
517   p_poei_attribute4,
518   p_poei_attribute5,
519   p_poei_attribute6,
520   p_poei_attribute7,
521   p_poei_attribute8,
522   p_poei_attribute9,
523   p_poei_attribute10,
524   p_poei_attribute11,
525   p_poei_attribute12,
526   p_poei_attribute13,
527   p_poei_attribute14,
528   p_poei_attribute15,
529   p_poei_attribute16,
530   p_poei_attribute17,
531   p_poei_attribute18,
532   p_poei_attribute19,
533   p_poei_attribute20,
534   p_poei_information_category,
535   p_poei_information1,
536   p_poei_information2,
537   p_poei_information3,
538   p_poei_information4,
539   p_poei_information5,
540   p_poei_information6,
541   p_poei_information7,
542   p_poei_information8,
543   p_poei_information9,
544   p_poei_information10,
545   p_poei_information11,
546   p_poei_information12,
547   p_poei_information13,
548   p_poei_information14,
549   p_poei_information15,
550   p_poei_information16,
551   p_poei_information17,
552   p_poei_information18,
553   p_poei_information19,
554   p_poei_information20,
555   p_poei_information21,
556   p_poei_information22,
557   p_poei_information23,
558   p_poei_information24,
559   p_poei_information25,
560   p_poei_information26,
561   p_poei_information27,
562   p_poei_information28,
563   p_poei_information29,
564   p_poei_information30,
565   null
566   );
567   --
568   -- Having converted the arguments into the pe_poi_rec
569   -- plsql record structure we call the corresponding record business process.
570   --
571   ins(l_rec, p_validate);
572   --
573   -- As the primary key argument(s)
574   -- are specified as an OUT's we must set these values.
575   --
576   p_position_extra_info_id := l_rec.position_extra_info_id;
577   p_object_version_number := l_rec.object_version_number;
578   --
579   hr_utility.set_location(' Leaving:'||l_proc, 10);
580 End ins;
581 --
582 end pe_poi_ins;