1 Package Body ben_ecc_ins as
2 /* $Header: beeccrhi.pkb 120.0 2005/05/28 01:49:03 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ecc_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 nocopy ben_ecc_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 ben_ecc_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_elctbl_chc_ctfn
64 --
65 insert into ben_elctbl_chc_ctfn
66 ( elctbl_chc_ctfn_id,
67 enrt_ctfn_typ_cd,
68 rqd_flag,
69 elig_per_elctbl_chc_id,
70 enrt_bnft_id,
71 business_group_id,
72 ecc_attribute_category,
73 ecc_attribute1,
74 ecc_attribute2,
75 ecc_attribute3,
76 ecc_attribute4,
77 ecc_attribute5,
78 ecc_attribute6,
79 ecc_attribute7,
80 ecc_attribute8,
81 ecc_attribute9,
82 ecc_attribute10,
83 ecc_attribute11,
84 ecc_attribute12,
85 ecc_attribute13,
86 ecc_attribute14,
87 ecc_attribute15,
88 ecc_attribute16,
89 ecc_attribute17,
90 ecc_attribute18,
91 ecc_attribute19,
92 ecc_attribute20,
93 ecc_attribute21,
94 ecc_attribute22,
95 ecc_attribute23,
96 ecc_attribute24,
97 ecc_attribute25,
98 ecc_attribute26,
99 ecc_attribute27,
100 ecc_attribute28,
101 ecc_attribute29,
102 ecc_attribute30,
103 susp_if_ctfn_not_prvd_flag,
104 ctfn_determine_cd,
105 request_id,
106 program_application_id,
107 program_id,
108 program_update_date,
109 object_version_number
110 )
111 Values
112 ( p_rec.elctbl_chc_ctfn_id,
113 p_rec.enrt_ctfn_typ_cd,
114 p_rec.rqd_flag,
115 p_rec.elig_per_elctbl_chc_id,
116 p_rec.enrt_bnft_id,
117 p_rec.business_group_id,
118 p_rec.ecc_attribute_category,
119 p_rec.ecc_attribute1,
120 p_rec.ecc_attribute2,
121 p_rec.ecc_attribute3,
122 p_rec.ecc_attribute4,
123 p_rec.ecc_attribute5,
124 p_rec.ecc_attribute6,
125 p_rec.ecc_attribute7,
126 p_rec.ecc_attribute8,
127 p_rec.ecc_attribute9,
128 p_rec.ecc_attribute10,
129 p_rec.ecc_attribute11,
130 p_rec.ecc_attribute12,
131 p_rec.ecc_attribute13,
132 p_rec.ecc_attribute14,
133 p_rec.ecc_attribute15,
134 p_rec.ecc_attribute16,
135 p_rec.ecc_attribute17,
136 p_rec.ecc_attribute18,
137 p_rec.ecc_attribute19,
138 p_rec.ecc_attribute20,
139 p_rec.ecc_attribute21,
140 p_rec.ecc_attribute22,
141 p_rec.ecc_attribute23,
142 p_rec.ecc_attribute24,
143 p_rec.ecc_attribute25,
144 p_rec.ecc_attribute26,
145 p_rec.ecc_attribute27,
146 p_rec.ecc_attribute28,
147 p_rec.ecc_attribute29,
148 p_rec.ecc_attribute30,
149 p_rec.susp_if_ctfn_not_prvd_flag,
150 p_rec.ctfn_determine_cd,
151 p_rec.request_id,
152 p_rec.program_application_id,
153 p_rec.program_id,
154 p_rec.program_update_date,
155 p_rec.object_version_number
156 );
157 --
158 ben_ecc_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 ben_ecc_shd.g_api_dml := false; -- Unset the api dml status
165 ben_ecc_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 ben_ecc_shd.g_api_dml := false; -- Unset the api dml status
170 ben_ecc_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 ben_ecc_shd.g_api_dml := false; -- Unset the api dml status
175 ben_ecc_shd.constraint_error
176 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
177 When Others Then
178 ben_ecc_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 nocopy ben_ecc_shd.g_rec_type) is
220 --
221 l_proc varchar2(72) := g_package||'pre_insert';
222 --
223 Cursor C_Sel1 is select ben_elctbl_chc_ctfn_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.elctbl_chc_ctfn_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(
271 p_effective_date in date,p_rec in ben_ecc_shd.g_rec_type) is
272 --
273 l_proc varchar2(72) := g_package||'post_insert';
274 --
275 Begin
276 hr_utility.set_location('Entering:'||l_proc, 5);
277 --
278 --
279 -- Start of API User Hook for post_insert.
280 --
281 begin
282 --
283 ben_ecc_rki.after_insert
284 (
285 p_elctbl_chc_ctfn_id =>p_rec.elctbl_chc_ctfn_id
286 ,p_enrt_ctfn_typ_cd =>p_rec.enrt_ctfn_typ_cd
287 ,p_rqd_flag =>p_rec.rqd_flag
288 ,p_elig_per_elctbl_chc_id =>p_rec.elig_per_elctbl_chc_id
289 ,p_enrt_bnft_id =>p_rec.enrt_bnft_id
290 ,p_business_group_id =>p_rec.business_group_id
291 ,p_ecc_attribute_category =>p_rec.ecc_attribute_category
292 ,p_ecc_attribute1 =>p_rec.ecc_attribute1
293 ,p_ecc_attribute2 =>p_rec.ecc_attribute2
294 ,p_ecc_attribute3 =>p_rec.ecc_attribute3
295 ,p_ecc_attribute4 =>p_rec.ecc_attribute4
296 ,p_ecc_attribute5 =>p_rec.ecc_attribute5
297 ,p_ecc_attribute6 =>p_rec.ecc_attribute6
298 ,p_ecc_attribute7 =>p_rec.ecc_attribute7
299 ,p_ecc_attribute8 =>p_rec.ecc_attribute8
300 ,p_ecc_attribute9 =>p_rec.ecc_attribute9
301 ,p_ecc_attribute10 =>p_rec.ecc_attribute10
302 ,p_ecc_attribute11 =>p_rec.ecc_attribute11
303 ,p_ecc_attribute12 =>p_rec.ecc_attribute12
304 ,p_ecc_attribute13 =>p_rec.ecc_attribute13
305 ,p_ecc_attribute14 =>p_rec.ecc_attribute14
306 ,p_ecc_attribute15 =>p_rec.ecc_attribute15
307 ,p_ecc_attribute16 =>p_rec.ecc_attribute16
308 ,p_ecc_attribute17 =>p_rec.ecc_attribute17
309 ,p_ecc_attribute18 =>p_rec.ecc_attribute18
310 ,p_ecc_attribute19 =>p_rec.ecc_attribute19
311 ,p_ecc_attribute20 =>p_rec.ecc_attribute20
312 ,p_ecc_attribute21 =>p_rec.ecc_attribute21
313 ,p_ecc_attribute22 =>p_rec.ecc_attribute22
314 ,p_ecc_attribute23 =>p_rec.ecc_attribute23
315 ,p_ecc_attribute24 =>p_rec.ecc_attribute24
316 ,p_ecc_attribute25 =>p_rec.ecc_attribute25
317 ,p_ecc_attribute26 =>p_rec.ecc_attribute26
318 ,p_ecc_attribute27 =>p_rec.ecc_attribute27
319 ,p_ecc_attribute28 =>p_rec.ecc_attribute28
320 ,p_ecc_attribute29 =>p_rec.ecc_attribute29
321 ,p_ecc_attribute30 =>p_rec.ecc_attribute30
322 ,p_susp_if_ctfn_not_prvd_flag =>p_rec.susp_if_ctfn_not_prvd_flag
323 ,p_ctfn_determine_cd =>p_rec.ctfn_determine_cd
324 ,p_request_id =>p_rec.request_id
325 ,p_program_application_id =>p_rec.program_application_id
326 ,p_program_id =>p_rec.program_id
327 ,p_program_update_date =>p_rec.program_update_date
328 ,p_object_version_number =>p_rec.object_version_number
329 ,p_effective_date =>p_effective_date
330 );
331 --
332 exception
333 --
334 when hr_api.cannot_find_prog_unit then
335 --
336 hr_api.cannot_find_prog_unit_error
337 (p_module_name => 'ben_elctbl_chc_ctfn'
338 ,p_hook_type => 'AI');
339 --
340 end;
341 --
342 -- End of API User Hook for post_insert.
343 --
344 --
345 hr_utility.set_location(' Leaving:'||l_proc, 10);
346 End post_insert;
347 --
348 -- ----------------------------------------------------------------------------
349 -- |---------------------------------< ins >----------------------------------|
350 -- ----------------------------------------------------------------------------
351 Procedure ins
352 (
353 p_effective_date in date,
354 p_rec in out nocopy ben_ecc_shd.g_rec_type
355 ) is
356 --
357 l_proc varchar2(72) := g_package||'ins';
358 --
359 Begin
360 hr_utility.set_location('Entering:'||l_proc, 5);
361 --
362 -- Call the supporting insert validate operations
363 --
364 ben_ecc_bus.insert_validate(p_rec
365 ,p_effective_date);
366 --
367 -- Call the supporting pre-insert operation
368 --
369 pre_insert(p_rec);
370 --
371 -- Insert the row
372 --
373 insert_dml(p_rec);
374 --
375 -- Call the supporting post-insert operation
376 --
377 post_insert(
378 p_effective_date,p_rec);
379 end ins;
380 --
381 -- ----------------------------------------------------------------------------
382 -- |---------------------------------< ins >----------------------------------|
383 -- ----------------------------------------------------------------------------
384 Procedure ins
385 (
386 p_effective_date in date,
387 p_elctbl_chc_ctfn_id out nocopy number,
388 p_enrt_ctfn_typ_cd in varchar2,
389 p_rqd_flag in varchar2,
390 p_elig_per_elctbl_chc_id in number default null,
391 p_enrt_bnft_id in number default null,
392 p_business_group_id in number,
393 p_ecc_attribute_category in varchar2 default null,
394 p_ecc_attribute1 in varchar2 default null,
395 p_ecc_attribute2 in varchar2 default null,
396 p_ecc_attribute3 in varchar2 default null,
397 p_ecc_attribute4 in varchar2 default null,
398 p_ecc_attribute5 in varchar2 default null,
399 p_ecc_attribute6 in varchar2 default null,
400 p_ecc_attribute7 in varchar2 default null,
401 p_ecc_attribute8 in varchar2 default null,
402 p_ecc_attribute9 in varchar2 default null,
403 p_ecc_attribute10 in varchar2 default null,
404 p_ecc_attribute11 in varchar2 default null,
405 p_ecc_attribute12 in varchar2 default null,
406 p_ecc_attribute13 in varchar2 default null,
407 p_ecc_attribute14 in varchar2 default null,
408 p_ecc_attribute15 in varchar2 default null,
409 p_ecc_attribute16 in varchar2 default null,
410 p_ecc_attribute17 in varchar2 default null,
411 p_ecc_attribute18 in varchar2 default null,
412 p_ecc_attribute19 in varchar2 default null,
413 p_ecc_attribute20 in varchar2 default null,
414 p_ecc_attribute21 in varchar2 default null,
415 p_ecc_attribute22 in varchar2 default null,
416 p_ecc_attribute23 in varchar2 default null,
417 p_ecc_attribute24 in varchar2 default null,
418 p_ecc_attribute25 in varchar2 default null,
419 p_ecc_attribute26 in varchar2 default null,
420 p_ecc_attribute27 in varchar2 default null,
421 p_ecc_attribute28 in varchar2 default null,
422 p_ecc_attribute29 in varchar2 default null,
423 p_ecc_attribute30 in varchar2 default null,
424 p_susp_if_ctfn_not_prvd_flag in varchar2 default 'Y',
425 p_ctfn_determine_cd in varchar2 default null,
426 p_request_id in number default null,
427 p_program_application_id in number default null,
428 p_program_id in number default null,
429 p_program_update_date in date default null,
430 p_object_version_number out nocopy number
431 ) is
432 --
433 l_rec ben_ecc_shd.g_rec_type;
434 l_proc varchar2(72) := g_package||'ins';
435 --
436 Begin
437 hr_utility.set_location('Entering:'||l_proc, 5);
438 --
439 -- Call conversion function to turn arguments into the
440 -- p_rec structure.
441 --
442 l_rec :=
443 ben_ecc_shd.convert_args
444 (
445 null,
446 p_enrt_ctfn_typ_cd,
447 p_rqd_flag,
448 p_elig_per_elctbl_chc_id,
449 p_enrt_bnft_id,
450 p_business_group_id,
451 p_ecc_attribute_category,
452 p_ecc_attribute1,
453 p_ecc_attribute2,
454 p_ecc_attribute3,
455 p_ecc_attribute4,
456 p_ecc_attribute5,
457 p_ecc_attribute6,
458 p_ecc_attribute7,
459 p_ecc_attribute8,
460 p_ecc_attribute9,
461 p_ecc_attribute10,
462 p_ecc_attribute11,
463 p_ecc_attribute12,
464 p_ecc_attribute13,
465 p_ecc_attribute14,
466 p_ecc_attribute15,
467 p_ecc_attribute16,
468 p_ecc_attribute17,
469 p_ecc_attribute18,
470 p_ecc_attribute19,
471 p_ecc_attribute20,
472 p_ecc_attribute21,
473 p_ecc_attribute22,
474 p_ecc_attribute23,
475 p_ecc_attribute24,
476 p_ecc_attribute25,
477 p_ecc_attribute26,
478 p_ecc_attribute27,
479 p_ecc_attribute28,
480 p_ecc_attribute29,
481 p_ecc_attribute30,
482 p_susp_if_ctfn_not_prvd_flag,
483 p_ctfn_determine_cd,
484 p_request_id,
485 p_program_application_id,
486 p_program_id,
487 p_program_update_date,
488 null
489 );
490 --
491 -- Having converted the arguments into the ben_ecc_rec
492 -- plsql record structure we call the corresponding record business process.
493 --
494 ins(
495 p_effective_date,l_rec);
496 --
497 -- As the primary key argument(s)
498 -- are specified as an OUT's we must set these values.
499 --
500 p_elctbl_chc_ctfn_id := l_rec.elctbl_chc_ctfn_id;
501 p_object_version_number := l_rec.object_version_number;
502 --
503 hr_utility.set_location(' Leaving:'||l_proc, 10);
504 End ins;
505 --
506 end ben_ecc_ins;