1 Package Body pay_con_ins as
2 /* $Header: pyconrhi.pkb 115.3 1999/12/03 16:45:29 pkm ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_con_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 -- Prerequisites:
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 Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out pay_con_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 pay_con_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: pay_us_contribution_history
64 --
65 insert into pay_us_contribution_history
66 ( contr_history_id,
67 person_id,
68 date_from,
69 date_to,
70 contr_type,
71 business_group_id,
72 legislation_code,
73 amt_contr,
74 max_contr_allowed,
75 includable_comp,
76 tax_unit_id,
77 source_system,
78 contr_information_category,
79 contr_information1,
80 contr_information2,
81 contr_information3,
82 contr_information4,
83 contr_information5,
84 contr_information6,
85 contr_information7,
86 contr_information8,
87 contr_information9,
88 contr_information10,
89 contr_information11,
90 contr_information12,
91 contr_information13,
92 contr_information14,
93 contr_information15,
94 contr_information16,
95 contr_information17,
96 contr_information18,
97 contr_information19,
98 contr_information20,
99 contr_information21,
100 contr_information22,
101 contr_information23,
102 contr_information24,
103 contr_information25,
104 contr_information26,
105 contr_information27,
106 contr_information28,
107 contr_information29,
108 contr_information30,
109 object_version_number
110 )
111 Values
112 ( p_rec.contr_history_id,
113 p_rec.person_id,
114 p_rec.date_from,
115 p_rec.date_to,
116 p_rec.contr_type,
117 p_rec.business_group_id,
118 p_rec.legislation_code,
119 p_rec.amt_contr,
120 p_rec.max_contr_allowed,
121 p_rec.includable_comp,
122 p_rec.tax_unit_id,
123 p_rec.source_system,
124 p_rec.contr_information_category,
125 p_rec.contr_information1,
126 p_rec.contr_information2,
127 p_rec.contr_information3,
128 p_rec.contr_information4,
129 p_rec.contr_information5,
130 p_rec.contr_information6,
131 p_rec.contr_information7,
132 p_rec.contr_information8,
133 p_rec.contr_information9,
134 p_rec.contr_information10,
135 p_rec.contr_information11,
136 p_rec.contr_information12,
137 p_rec.contr_information13,
138 p_rec.contr_information14,
139 p_rec.contr_information15,
140 p_rec.contr_information16,
141 p_rec.contr_information17,
142 p_rec.contr_information18,
143 p_rec.contr_information19,
144 p_rec.contr_information20,
145 p_rec.contr_information21,
146 p_rec.contr_information22,
147 p_rec.contr_information23,
148 p_rec.contr_information24,
149 p_rec.contr_information25,
150 p_rec.contr_information26,
151 p_rec.contr_information27,
152 p_rec.contr_information28,
153 p_rec.contr_information29,
154 p_rec.contr_information30,
155 p_rec.object_version_number
156 );
157 --
158 pay_con_shd.g_api_dml := false; -- Unset the api dml status
159 --
160 hr_utility.set_location(' Leaving:'||l_proc, 10);
161 Exception
162 When hr_api.check_integrity_violated Then
163 -- A check constraint has been violated
164 pay_con_shd.g_api_dml := false; -- Unset the api dml status
165 pay_con_shd.constraint_error
166 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
167 When hr_api.parent_integrity_violated Then
168 -- Parent integrity has been violated
169 pay_con_shd.g_api_dml := false; -- Unset the api dml status
170 pay_con_shd.constraint_error
171 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
172 When hr_api.unique_integrity_violated Then
173 -- Unique integrity has been violated
174 pay_con_shd.g_api_dml := false; -- Unset the api dml status
175 pay_con_shd.constraint_error
176 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
177 When Others Then
178 pay_con_shd.g_api_dml := false; -- Unset the api dml status
179 Raise;
180 End insert_dml;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |------------------------------< pre_insert >------------------------------|
184 -- ----------------------------------------------------------------------------
185 -- {Start Of Comments}
186 --
187 -- Description:
188 -- This private procedure contains any processing which is required before
189 -- the insert dml. Presently, if the entity has a corresponding primary
190 -- key which is maintained by an associating sequence, the primary key for
191 -- the entity will be populated with the next sequence value in
192 -- preparation for the insert dml.
193 --
194 -- Prerequisites:
195 -- This is an internal procedure which is called from the ins procedure.
196 --
197 -- In Parameters:
198 -- A Pl/Sql record structre.
199 --
200 -- Post Success:
201 -- Processing continues.
202 --
203 -- Post Failure:
204 -- If an error has occurred, an error message and exception will be raised
205 -- but not handled.
206 --
207 -- Developer Implementation Notes:
208 -- Any pre-processing required before the insert dml is issued should be
209 -- coded within this procedure. As stated above, a good example is the
210 -- generation of a primary key number via a corresponding sequence.
211 -- It is important to note that any 3rd party maintenance should be reviewed
212 -- before placing in this procedure.
213 --
214 -- Access Status:
215 -- Internal Row Handler Use Only.
216 --
217 -- {End Of Comments}
218 -- ----------------------------------------------------------------------------
219 Procedure pre_insert(p_rec in out pay_con_shd.g_rec_type) is
220 --
221 l_proc varchar2(72) := g_package||'pre_insert';
222 --
223 Cursor C_Sel1 is select pay_us_contribution_history_s.nextval from sys.dual;
224 --
225 Begin
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 --
229 -- Select the next sequence number
230 --
231 Open C_Sel1;
232 Fetch C_Sel1 Into p_rec.contr_history_id;
233 Close C_Sel1;
234 --
235 hr_utility.set_location(' Leaving:'||l_proc, 10);
236 End pre_insert;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |-----------------------------< post_insert >------------------------------|
240 -- ----------------------------------------------------------------------------
241 -- {Start Of Comments}
242 --
243 -- Description:
244 -- This private procedure contains any processing which is required after the
245 -- insert dml.
246 --
247 -- Prerequisites:
248 -- This is an internal procedure which is called from the ins procedure.
249 --
250 -- In Parameters:
251 -- A Pl/Sql record structre.
252 --
253 -- Post Success:
254 -- Processing continues.
255 --
256 -- Post Failure:
257 -- If an error has occurred, an error message and exception will be raised
258 -- but not handled.
259 --
260 -- Developer Implementation Notes:
261 -- Any post-processing required after the insert dml is issued should be
262 -- coded within this procedure. It is important to note that any 3rd party
263 -- maintenance should be reviewed before placing in this procedure.
264 --
265 -- Access Status:
266 -- Internal Row Handler Use Only.
267 --
268 -- {End Of Comments}
269 -- ----------------------------------------------------------------------------
270 Procedure post_insert(p_rec in pay_con_shd.g_rec_type) is
271 --
272 l_proc varchar2(72) := g_package||'post_insert';
273 --
274 Begin
275 hr_utility.set_location('Entering:'||l_proc, 5);
276 --
277 --
278 -- Start of API User Hook for post_insert.
279 --
280 begin
281 --
282 pay_con_rki.after_insert
283 (
284 p_contr_history_id =>p_rec.contr_history_id
285 ,p_person_id =>p_rec.person_id
286 ,p_date_from =>p_rec.date_from
287 ,p_date_to =>p_rec.date_to
288 ,p_contr_type =>p_rec.contr_type
289 ,p_business_group_id =>p_rec.business_group_id
290 ,p_legislation_code =>p_rec.legislation_code
291 ,p_amt_contr =>p_rec.amt_contr
292 ,p_max_contr_allowed =>p_rec.max_contr_allowed
293 ,p_includable_comp =>p_rec.includable_comp
294 ,p_tax_unit_id =>p_rec.tax_unit_id
295 ,p_source_system =>p_rec.source_system
296 ,p_contr_information_category =>p_rec.contr_information_category
297 ,p_contr_information1 =>p_rec.contr_information1
298 ,p_contr_information2 =>p_rec.contr_information2
299 ,p_contr_information3 =>p_rec.contr_information3
300 ,p_contr_information4 =>p_rec.contr_information4
301 ,p_contr_information5 =>p_rec.contr_information5
302 ,p_contr_information6 =>p_rec.contr_information6
303 ,p_contr_information7 =>p_rec.contr_information7
304 ,p_contr_information8 =>p_rec.contr_information8
305 ,p_contr_information9 =>p_rec.contr_information9
306 ,p_contr_information10 =>p_rec.contr_information10
307 ,p_contr_information11 =>p_rec.contr_information11
308 ,p_contr_information12 =>p_rec.contr_information12
309 ,p_contr_information13 =>p_rec.contr_information13
310 ,p_contr_information14 =>p_rec.contr_information14
311 ,p_contr_information15 =>p_rec.contr_information15
312 ,p_contr_information16 =>p_rec.contr_information16
313 ,p_contr_information17 =>p_rec.contr_information17
314 ,p_contr_information18 =>p_rec.contr_information18
315 ,p_contr_information19 =>p_rec.contr_information19
316 ,p_contr_information20 =>p_rec.contr_information20
317 ,p_contr_information21 =>p_rec.contr_information21
318 ,p_contr_information22 =>p_rec.contr_information22
319 ,p_contr_information23 =>p_rec.contr_information23
320 ,p_contr_information24 =>p_rec.contr_information24
321 ,p_contr_information25 =>p_rec.contr_information25
322 ,p_contr_information26 =>p_rec.contr_information26
323 ,p_contr_information27 =>p_rec.contr_information27
324 ,p_contr_information28 =>p_rec.contr_information28
325 ,p_contr_information29 =>p_rec.contr_information29
326 ,p_contr_information30 =>p_rec.contr_information30
327 ,p_object_version_number =>p_rec.object_version_number
328 );
329 --
330 exception
331 --
332 when hr_api.cannot_find_prog_unit then
333 --
334 hr_api.cannot_find_prog_unit_error
335 (p_module_name => 'pay_contribution_history'
336 ,p_hook_type => 'AI');
337 --
338 end;
339 --
340 -- End of API User Hook for post_insert.
341 --
342 --
343 hr_utility.set_location(' Leaving:'||l_proc, 10);
344 End post_insert;
345 --
346 -- ----------------------------------------------------------------------------
347 -- |---------------------------------< ins >----------------------------------|
348 -- ----------------------------------------------------------------------------
349 Procedure ins
350 (
351 p_rec in out pay_con_shd.g_rec_type
352 ) is
353 --
354 l_proc varchar2(72) := g_package||'ins';
355 --
356 Begin
357 hr_utility.set_location('Entering:'||l_proc, 5);
358 --
359 -- Call the supporting insert validate operations
360 --
361 pay_con_bus.insert_validate(p_rec);
362 --
363 -- Call the supporting pre-insert operation
364 --
365 pre_insert(p_rec);
366 --
367 -- Insert the row
368 --
369 insert_dml(p_rec);
370 --
371 -- Call the supporting post-insert operation
372 --
373 post_insert(p_rec);
374 end ins;
375 --
376 -- ----------------------------------------------------------------------------
377 -- |---------------------------------< ins >----------------------------------|
378 -- ----------------------------------------------------------------------------
379 Procedure ins
380 (
381 p_contr_history_id out number,
382 p_person_id in number,
383 p_date_from in date,
384 p_date_to in date,
385 p_contr_type in varchar2,
386 p_business_group_id in number,
387 p_legislation_code in varchar2,
388 p_amt_contr in number default null,
389 p_max_contr_allowed in number default null,
390 p_includable_comp in number default null,
391 p_tax_unit_id in number default null,
392 p_source_system in varchar2 default null,
393 p_contr_information_category in varchar2 default null,
394 p_contr_information1 in varchar2 default null,
395 p_contr_information2 in varchar2 default null,
396 p_contr_information3 in varchar2 default null,
397 p_contr_information4 in varchar2 default null,
398 p_contr_information5 in varchar2 default null,
399 p_contr_information6 in varchar2 default null,
400 p_contr_information7 in varchar2 default null,
401 p_contr_information8 in varchar2 default null,
402 p_contr_information9 in varchar2 default null,
403 p_contr_information10 in varchar2 default null,
404 p_contr_information11 in varchar2 default null,
405 p_contr_information12 in varchar2 default null,
406 p_contr_information13 in varchar2 default null,
407 p_contr_information14 in varchar2 default null,
408 p_contr_information15 in varchar2 default null,
409 p_contr_information16 in varchar2 default null,
410 p_contr_information17 in varchar2 default null,
411 p_contr_information18 in varchar2 default null,
412 p_contr_information19 in varchar2 default null,
413 p_contr_information20 in varchar2 default null,
414 p_contr_information21 in varchar2 default null,
415 p_contr_information22 in varchar2 default null,
416 p_contr_information23 in varchar2 default null,
417 p_contr_information24 in varchar2 default null,
418 p_contr_information25 in varchar2 default null,
419 p_contr_information26 in varchar2 default null,
420 p_contr_information27 in varchar2 default null,
421 p_contr_information28 in varchar2 default null,
422 p_contr_information29 in varchar2 default null,
423 p_contr_information30 in varchar2 default null,
424 p_object_version_number out number
425 ) is
426 --
427 l_rec pay_con_shd.g_rec_type;
428 l_proc varchar2(72) := g_package||'ins';
429 --
430 Begin
431 hr_utility.set_location('Entering:'||l_proc, 5);
432 --
433 -- Call conversion function to turn arguments into the
434 -- p_rec structure.
435 --
436 l_rec :=
437 pay_con_shd.convert_args
438 (
439 null,
440 p_person_id,
441 p_date_from,
442 p_date_to,
443 p_contr_type,
444 p_business_group_id,
445 p_legislation_code,
446 p_amt_contr,
447 p_max_contr_allowed,
448 p_includable_comp,
449 p_tax_unit_id,
450 p_source_system,
451 p_contr_information_category,
452 p_contr_information1,
453 p_contr_information2,
454 p_contr_information3,
455 p_contr_information4,
456 p_contr_information5,
457 p_contr_information6,
458 p_contr_information7,
459 p_contr_information8,
460 p_contr_information9,
461 p_contr_information10,
462 p_contr_information11,
463 p_contr_information12,
464 p_contr_information13,
465 p_contr_information14,
466 p_contr_information15,
467 p_contr_information16,
468 p_contr_information17,
469 p_contr_information18,
470 p_contr_information19,
471 p_contr_information20,
472 p_contr_information21,
473 p_contr_information22,
474 p_contr_information23,
475 p_contr_information24,
476 p_contr_information25,
477 p_contr_information26,
478 p_contr_information27,
479 p_contr_information28,
480 p_contr_information29,
481 p_contr_information30,
482 null
483 );
484 --
485 -- Having converted the arguments into the pay_con_rec
486 -- plsql record structure we call the corresponding record business process.
487 --
488 ins(l_rec);
489 --
490 -- As the primary key argument(s)
491 -- are specified as an OUT's we must set these values.
492 --
493 p_contr_history_id := l_rec.contr_history_id;
494 p_object_version_number := l_rec.object_version_number;
495 --
496 hr_utility.set_location(' Leaving:'||l_proc, 10);
497 End ins;
498 --
499 end pay_con_ins;