1 Package Body ben_psq_ins as
2 /* $Header: bepsqrhi.pkb 120.0 2005/05/28 11:20:15 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_psq_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_psq_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_psq_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_pymt_sched_py_freq
64 --
65 insert into ben_pymt_sched_py_freq
66 ( pymt_sched_py_freq_id,
67 py_freq_cd,
68 dflt_flag,
69 business_group_id,
70 acty_rt_pymt_sched_id,
71 psq_attribute_category,
72 psq_attribute1,
73 psq_attribute2,
74 psq_attribute3,
75 psq_attribute4,
76 psq_attribute5,
77 psq_attribute6,
78 psq_attribute7,
79 psq_attribute8,
80 psq_attribute9,
81 psq_attribute10,
82 psq_attribute11,
83 psq_attribute12,
84 psq_attribute13,
85 psq_attribute14,
86 psq_attribute15,
87 psq_attribute16,
88 psq_attribute17,
89 psq_attribute18,
90 psq_attribute19,
91 psq_attribute20,
92 psq_attribute21,
93 psq_attribute22,
94 psq_attribute23,
95 psq_attribute24,
96 psq_attribute25,
97 psq_attribute26,
98 psq_attribute27,
99 psq_attribute28,
100 psq_attribute29,
101 psq_attribute30,
102 object_version_number
103 )
104 Values
105 ( p_rec.pymt_sched_py_freq_id,
106 p_rec.py_freq_cd,
107 p_rec.dflt_flag,
108 p_rec.business_group_id,
109 p_rec.acty_rt_pymt_sched_id,
110 p_rec.psq_attribute_category,
111 p_rec.psq_attribute1,
112 p_rec.psq_attribute2,
113 p_rec.psq_attribute3,
114 p_rec.psq_attribute4,
115 p_rec.psq_attribute5,
116 p_rec.psq_attribute6,
117 p_rec.psq_attribute7,
118 p_rec.psq_attribute8,
119 p_rec.psq_attribute9,
120 p_rec.psq_attribute10,
121 p_rec.psq_attribute11,
122 p_rec.psq_attribute12,
123 p_rec.psq_attribute13,
124 p_rec.psq_attribute14,
125 p_rec.psq_attribute15,
126 p_rec.psq_attribute16,
127 p_rec.psq_attribute17,
128 p_rec.psq_attribute18,
129 p_rec.psq_attribute19,
130 p_rec.psq_attribute20,
131 p_rec.psq_attribute21,
135 p_rec.psq_attribute25,
132 p_rec.psq_attribute22,
133 p_rec.psq_attribute23,
134 p_rec.psq_attribute24,
136 p_rec.psq_attribute26,
137 p_rec.psq_attribute27,
138 p_rec.psq_attribute28,
139 p_rec.psq_attribute29,
140 p_rec.psq_attribute30,
141 p_rec.object_version_number
142 );
143 --
144 ben_psq_shd.g_api_dml := false; -- Unset the api dml status
145 --
146 hr_utility.set_location(' Leaving:'||l_proc, 10);
147 Exception
148 When hr_api.check_integrity_violated Then
149 -- A check constraint has been violated
150 ben_psq_shd.g_api_dml := false; -- Unset the api dml status
151 ben_psq_shd.constraint_error
152 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153 When hr_api.parent_integrity_violated Then
154 -- Parent integrity has been violated
155 ben_psq_shd.g_api_dml := false; -- Unset the api dml status
156 ben_psq_shd.constraint_error
157 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158 When hr_api.unique_integrity_violated Then
159 -- Unique integrity has been violated
160 ben_psq_shd.g_api_dml := false; -- Unset the api dml status
161 ben_psq_shd.constraint_error
162 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163 When Others Then
164 ben_psq_shd.g_api_dml := false; -- Unset the api dml status
165 Raise;
166 End insert_dml;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |------------------------------< pre_insert >------------------------------|
170 -- ----------------------------------------------------------------------------
171 -- {Start Of Comments}
172 --
173 -- Description:
174 -- This private procedure contains any processing which is required before
175 -- the insert dml. Presently, if the entity has a corresponding primary
176 -- key which is maintained by an associating sequence, the primary key for
177 -- the entity will be populated with the next sequence value in
178 -- preparation for the insert dml.
179 --
180 -- Prerequisites:
181 -- This is an internal procedure which is called from the ins procedure.
182 --
183 -- In Parameters:
184 -- A Pl/Sql record structre.
185 --
186 -- Post Success:
187 -- Processing continues.
188 --
189 -- Post Failure:
190 -- If an error has occurred, an error message and exception will be raised
191 -- but not handled.
192 --
193 -- Developer Implementation Notes:
194 -- Any pre-processing required before the insert dml is issued should be
195 -- coded within this procedure. As stated above, a good example is the
196 -- generation of a primary key number via a corresponding sequence.
197 -- It is important to note that any 3rd party maintenance should be reviewed
198 -- before placing in this procedure.
199 --
200 -- Access Status:
201 -- Internal Row Handler Use Only.
202 --
203 -- {End Of Comments}
204 -- ----------------------------------------------------------------------------
205 Procedure pre_insert(p_rec in out nocopy ben_psq_shd.g_rec_type) is
206 --
207 l_proc varchar2(72) := g_package||'pre_insert';
208 --
209 cursor c1 is
210 select BEN_PYMT_SCHED_PY_FREQ_S.nextval
211 from sys.dual;
212 --
213 --
214 Begin
215 hr_utility.set_location('Entering:'||l_proc, 5);
216 --
217 --
218 open c1;
219 --
220 fetch c1 into p_rec.PYMT_SCHED_PY_FREQ_id;
221 --
222 close c1;
223 --
224 hr_utility.set_location(' Leaving:'||l_proc, 10);
225 End pre_insert;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |-----------------------------< post_insert >------------------------------|
229 -- ----------------------------------------------------------------------------
230 -- {Start Of Comments}
231 --
232 -- Description:
233 -- This private procedure contains any processing which is required after the
234 -- insert dml.
235 --
236 -- Prerequisites:
237 -- This is an internal procedure which is called from the ins procedure.
238 --
239 -- In Parameters:
240 -- A Pl/Sql record structre.
241 --
242 -- Post Success:
243 -- Processing continues.
244 --
245 -- Post Failure:
246 -- If an error has occurred, an error message and exception will be raised
247 -- but not handled.
248 --
249 -- Developer Implementation Notes:
250 -- Any post-processing required after the insert dml is issued should be
251 -- coded within this procedure. It is important to note that any 3rd party
252 -- maintenance should be reviewed before placing in this procedure.
253 --
254 -- Access Status:
255 -- Internal Row Handler Use Only.
256 --
257 -- {End Of Comments}
258 -- ----------------------------------------------------------------------------
259 Procedure post_insert(
260 p_effective_date in date,p_rec in ben_psq_shd.g_rec_type) is
261 --
262 l_proc varchar2(72) := g_package||'post_insert';
263 --
264 Begin
265 hr_utility.set_location('Entering:'||l_proc, 5);
266 --
267 --
268 -- Start of API User Hook for post_insert.
269 --
270 begin
271 --
272 ben_psq_rki.after_insert
273 (
274 p_pymt_sched_py_freq_id =>p_rec.pymt_sched_py_freq_id
275 ,p_py_freq_cd =>p_rec.py_freq_cd
276 ,p_dflt_flag =>p_rec.dflt_flag
277 ,p_business_group_id =>p_rec.business_group_id
278 ,p_acty_rt_pymt_sched_id =>p_rec.acty_rt_pymt_sched_id
279 ,p_psq_attribute_category =>p_rec.psq_attribute_category
280 ,p_psq_attribute1 =>p_rec.psq_attribute1
284 ,p_psq_attribute5 =>p_rec.psq_attribute5
281 ,p_psq_attribute2 =>p_rec.psq_attribute2
282 ,p_psq_attribute3 =>p_rec.psq_attribute3
283 ,p_psq_attribute4 =>p_rec.psq_attribute4
285 ,p_psq_attribute6 =>p_rec.psq_attribute6
286 ,p_psq_attribute7 =>p_rec.psq_attribute7
287 ,p_psq_attribute8 =>p_rec.psq_attribute8
288 ,p_psq_attribute9 =>p_rec.psq_attribute9
289 ,p_psq_attribute10 =>p_rec.psq_attribute10
290 ,p_psq_attribute11 =>p_rec.psq_attribute11
291 ,p_psq_attribute12 =>p_rec.psq_attribute12
292 ,p_psq_attribute13 =>p_rec.psq_attribute13
293 ,p_psq_attribute14 =>p_rec.psq_attribute14
294 ,p_psq_attribute15 =>p_rec.psq_attribute15
295 ,p_psq_attribute16 =>p_rec.psq_attribute16
296 ,p_psq_attribute17 =>p_rec.psq_attribute17
297 ,p_psq_attribute18 =>p_rec.psq_attribute18
298 ,p_psq_attribute19 =>p_rec.psq_attribute19
299 ,p_psq_attribute20 =>p_rec.psq_attribute20
300 ,p_psq_attribute21 =>p_rec.psq_attribute21
301 ,p_psq_attribute22 =>p_rec.psq_attribute22
302 ,p_psq_attribute23 =>p_rec.psq_attribute23
303 ,p_psq_attribute24 =>p_rec.psq_attribute24
304 ,p_psq_attribute25 =>p_rec.psq_attribute25
305 ,p_psq_attribute26 =>p_rec.psq_attribute26
306 ,p_psq_attribute27 =>p_rec.psq_attribute27
307 ,p_psq_attribute28 =>p_rec.psq_attribute28
308 ,p_psq_attribute29 =>p_rec.psq_attribute29
309 ,p_psq_attribute30 =>p_rec.psq_attribute30
310 ,p_object_version_number =>p_rec.object_version_number
311 ,p_effective_date =>p_effective_date
312 );
313 --
314 exception
315 --
316 when hr_api.cannot_find_prog_unit then
317 --
318 hr_api.cannot_find_prog_unit_error
319 (p_module_name => 'ben_pymt_sched_py_freq'
320 ,p_hook_type => 'AI');
321 --
322 end;
323 --
324 -- End of API User Hook for post_insert.
325 --
326 --
327 hr_utility.set_location(' Leaving:'||l_proc, 10);
328 End post_insert;
329 --
330 -- ----------------------------------------------------------------------------
331 -- |---------------------------------< ins >----------------------------------|
332 -- ----------------------------------------------------------------------------
333 Procedure ins
334 (
335 p_effective_date in date,
336 p_rec in out nocopy ben_psq_shd.g_rec_type
337 ) is
338 --
339 l_proc varchar2(72) := g_package||'ins';
340 --
341 Begin
342 hr_utility.set_location('Entering:'||l_proc, 5);
343 --
344 -- Call the supporting insert validate operations
345 --
346 ben_psq_bus.insert_validate(p_rec
347 ,p_effective_date);
348 --
349 -- Call the supporting pre-insert operation
350 --
351 pre_insert(p_rec);
352 --
353 -- Insert the row
354 --
355 insert_dml(p_rec);
356 --
357 -- Call the supporting post-insert operation
358 --
359 post_insert(
360 p_effective_date,p_rec);
361 end ins;
362 --
363 -- ----------------------------------------------------------------------------
364 -- |---------------------------------< ins >----------------------------------|
365 -- ----------------------------------------------------------------------------
366 Procedure ins
367 (
368 p_effective_date in date,
369 p_pymt_sched_py_freq_id out nocopy number,
370 p_py_freq_cd in varchar2,
371 p_dflt_flag in varchar2 default null,
372 p_business_group_id in number default null,
373 p_acty_rt_pymt_sched_id in number default null,
374 p_psq_attribute_category in varchar2 default null,
375 p_psq_attribute1 in varchar2 default null,
376 p_psq_attribute2 in varchar2 default null,
377 p_psq_attribute3 in varchar2 default null,
378 p_psq_attribute4 in varchar2 default null,
379 p_psq_attribute5 in varchar2 default null,
380 p_psq_attribute6 in varchar2 default null,
381 p_psq_attribute7 in varchar2 default null,
382 p_psq_attribute8 in varchar2 default null,
383 p_psq_attribute9 in varchar2 default null,
384 p_psq_attribute10 in varchar2 default null,
385 p_psq_attribute11 in varchar2 default null,
386 p_psq_attribute12 in varchar2 default null,
387 p_psq_attribute13 in varchar2 default null,
388 p_psq_attribute14 in varchar2 default null,
389 p_psq_attribute15 in varchar2 default null,
390 p_psq_attribute16 in varchar2 default null,
391 p_psq_attribute17 in varchar2 default null,
392 p_psq_attribute18 in varchar2 default null,
393 p_psq_attribute19 in varchar2 default null,
394 p_psq_attribute20 in varchar2 default null,
395 p_psq_attribute21 in varchar2 default null,
396 p_psq_attribute22 in varchar2 default null,
397 p_psq_attribute23 in varchar2 default null,
398 p_psq_attribute24 in varchar2 default null,
399 p_psq_attribute25 in varchar2 default null,
400 p_psq_attribute26 in varchar2 default null,
401 p_psq_attribute27 in varchar2 default null,
405 p_object_version_number out nocopy number
402 p_psq_attribute28 in varchar2 default null,
403 p_psq_attribute29 in varchar2 default null,
404 p_psq_attribute30 in varchar2 default null,
406 ) is
407 --
408 l_rec ben_psq_shd.g_rec_type;
409 l_proc varchar2(72) := g_package||'ins';
410 --
411 Begin
412 hr_utility.set_location('Entering:'||l_proc, 5);
413 --
414 -- Call conversion function to turn arguments into the
415 -- p_rec structure.
416 --
417 l_rec :=
418 ben_psq_shd.convert_args
419 (
420 null,
421 p_py_freq_cd,
422 p_dflt_flag,
423 p_business_group_id,
424 p_acty_rt_pymt_sched_id,
425 p_psq_attribute_category,
426 p_psq_attribute1,
427 p_psq_attribute2,
428 p_psq_attribute3,
429 p_psq_attribute4,
430 p_psq_attribute5,
431 p_psq_attribute6,
432 p_psq_attribute7,
433 p_psq_attribute8,
434 p_psq_attribute9,
435 p_psq_attribute10,
436 p_psq_attribute11,
437 p_psq_attribute12,
438 p_psq_attribute13,
439 p_psq_attribute14,
440 p_psq_attribute15,
441 p_psq_attribute16,
442 p_psq_attribute17,
443 p_psq_attribute18,
444 p_psq_attribute19,
445 p_psq_attribute20,
446 p_psq_attribute21,
447 p_psq_attribute22,
448 p_psq_attribute23,
449 p_psq_attribute24,
450 p_psq_attribute25,
451 p_psq_attribute26,
452 p_psq_attribute27,
453 p_psq_attribute28,
454 p_psq_attribute29,
455 p_psq_attribute30,
456 null
457 );
458 --
459 -- Having converted the arguments into the ben_psq_rec
460 -- plsql record structure we call the corresponding record business process.
461 --
462 ins(
463 p_effective_date,l_rec);
464 --
465 -- As the primary key argument(s)
466 -- are specified as an OUT's we must set these values.
467 --
468 p_pymt_sched_py_freq_id := l_rec.pymt_sched_py_freq_id;
469 p_object_version_number := l_rec.object_version_number;
470 --
471 hr_utility.set_location(' Leaving:'||l_proc, 10);
472 End ins;
473 --
474 end ben_psq_ins;