1 Package Body ben_gos_ins as
2 /* $Header: begosrhi.pkb 120.0 2005/05/28 03:08:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_gos_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_gos_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_gos_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ben_gd_or_svc_typ
64 --
65 insert into ben_gd_or_svc_typ
66 ( gd_or_svc_typ_id,
67 business_group_id,
68 name,
69 typ_cd,
70 description,
71 gos_attribute_category,
72 gos_attribute1,
73 gos_attribute2,
74 gos_attribute3,
75 gos_attribute4,
76 gos_attribute5,
77 gos_attribute6,
78 gos_attribute7,
79 gos_attribute8,
80 gos_attribute9,
81 gos_attribute10,
82 gos_attribute11,
83 gos_attribute12,
84 gos_attribute13,
85 gos_attribute14,
86 gos_attribute15,
87 gos_attribute16,
88 gos_attribute17,
89 gos_attribute18,
90 gos_attribute19,
91 gos_attribute20,
92 gos_attribute21,
93 gos_attribute22,
94 gos_attribute23,
95 gos_attribute24,
96 gos_attribute25,
97 gos_attribute26,
98 gos_attribute27,
99 gos_attribute28,
100 gos_attribute29,
101 gos_attribute30,
102 object_version_number
103 )
104 Values
105 ( p_rec.gd_or_svc_typ_id,
106 p_rec.business_group_id,
107 p_rec.name,
108 p_rec.typ_cd,
109 p_rec.description,
110 p_rec.gos_attribute_category,
111 p_rec.gos_attribute1,
112 p_rec.gos_attribute2,
113 p_rec.gos_attribute3,
114 p_rec.gos_attribute4,
115 p_rec.gos_attribute5,
116 p_rec.gos_attribute6,
117 p_rec.gos_attribute7,
118 p_rec.gos_attribute8,
119 p_rec.gos_attribute9,
120 p_rec.gos_attribute10,
121 p_rec.gos_attribute11,
122 p_rec.gos_attribute12,
123 p_rec.gos_attribute13,
124 p_rec.gos_attribute14,
125 p_rec.gos_attribute15,
126 p_rec.gos_attribute16,
127 p_rec.gos_attribute17,
128 p_rec.gos_attribute18,
129 p_rec.gos_attribute19,
130 p_rec.gos_attribute20,
131 p_rec.gos_attribute21,
132 p_rec.gos_attribute22,
133 p_rec.gos_attribute23,
134 p_rec.gos_attribute24,
135 p_rec.gos_attribute25,
136 p_rec.gos_attribute26,
137 p_rec.gos_attribute27,
138 p_rec.gos_attribute28,
139 p_rec.gos_attribute29,
140 p_rec.gos_attribute30,
141 p_rec.object_version_number
142 );
143 --
144 ben_gos_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_gos_shd.g_api_dml := false; -- Unset the api dml status
151 ben_gos_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_gos_shd.g_api_dml := false; -- Unset the api dml status
156 ben_gos_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_gos_shd.g_api_dml := false; -- Unset the api dml status
161 ben_gos_shd.constraint_error
162 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163 When Others Then
164 ben_gos_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_gos_shd.g_rec_type) is
206 --
207 l_proc varchar2(72) := g_package||'pre_insert';
208 --
209 Cursor C_Sel1 is select ben_gd_or_svc_typ_s.nextval from sys.dual;
210 --
211 Begin
212 hr_utility.set_location('Entering:'||l_proc, 5);
213 --
214 --
215 -- Select the next sequence number
216 --
217 Open C_Sel1;
218 Fetch C_Sel1 Into p_rec.gd_or_svc_typ_id;
219 Close C_Sel1;
220 --
221 hr_utility.set_location(' Leaving:'||l_proc, 10);
222 End pre_insert;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< post_insert >------------------------------|
226 -- ----------------------------------------------------------------------------
227 -- {Start Of Comments}
228 --
229 -- Description:
230 -- This private procedure contains any processing which is required after the
231 -- insert dml.
232 --
233 -- Prerequisites:
234 -- This is an internal procedure which is called from the ins procedure.
235 --
236 -- In Parameters:
237 -- A Pl/Sql record structre.
238 --
239 -- Post Success:
240 -- Processing continues.
241 --
242 -- Post Failure:
243 -- If an error has occurred, an error message and exception will be raised
244 -- but not handled.
245 --
246 -- Developer Implementation Notes:
247 -- Any post-processing required after the insert dml is issued should be
248 -- coded within this procedure. It is important to note that any 3rd party
249 -- maintenance should be reviewed before placing in this procedure.
250 --
251 -- Access Status:
252 -- Internal Row Handler Use Only.
253 --
254 -- {End Of Comments}
255 -- ----------------------------------------------------------------------------
256 Procedure post_insert(
257 p_effective_date in date,p_rec in ben_gos_shd.g_rec_type) is
258 --
259 l_proc varchar2(72) := g_package||'post_insert';
260 --
261 Begin
262 hr_utility.set_location('Entering:'||l_proc, 5);
263 --
264 --
265 -- Start of API User Hook for post_insert.
266 --
267 begin
268 --
269 ben_gos_rki.after_insert
270 (
271 p_gd_or_svc_typ_id =>p_rec.gd_or_svc_typ_id
272 ,p_business_group_id =>p_rec.business_group_id
273 ,p_name =>p_rec.name
274 ,p_typ_cd =>p_rec.typ_cd
275 ,p_description =>p_rec.description
276 ,p_gos_attribute_category =>p_rec.gos_attribute_category
277 ,p_gos_attribute1 =>p_rec.gos_attribute1
278 ,p_gos_attribute2 =>p_rec.gos_attribute2
279 ,p_gos_attribute3 =>p_rec.gos_attribute3
280 ,p_gos_attribute4 =>p_rec.gos_attribute4
281 ,p_gos_attribute5 =>p_rec.gos_attribute5
282 ,p_gos_attribute6 =>p_rec.gos_attribute6
283 ,p_gos_attribute7 =>p_rec.gos_attribute7
284 ,p_gos_attribute8 =>p_rec.gos_attribute8
285 ,p_gos_attribute9 =>p_rec.gos_attribute9
286 ,p_gos_attribute10 =>p_rec.gos_attribute10
287 ,p_gos_attribute11 =>p_rec.gos_attribute11
288 ,p_gos_attribute12 =>p_rec.gos_attribute12
289 ,p_gos_attribute13 =>p_rec.gos_attribute13
290 ,p_gos_attribute14 =>p_rec.gos_attribute14
291 ,p_gos_attribute15 =>p_rec.gos_attribute15
292 ,p_gos_attribute16 =>p_rec.gos_attribute16
293 ,p_gos_attribute17 =>p_rec.gos_attribute17
294 ,p_gos_attribute18 =>p_rec.gos_attribute18
295 ,p_gos_attribute19 =>p_rec.gos_attribute19
296 ,p_gos_attribute20 =>p_rec.gos_attribute20
297 ,p_gos_attribute21 =>p_rec.gos_attribute21
298 ,p_gos_attribute22 =>p_rec.gos_attribute22
299 ,p_gos_attribute23 =>p_rec.gos_attribute23
300 ,p_gos_attribute24 =>p_rec.gos_attribute24
301 ,p_gos_attribute25 =>p_rec.gos_attribute25
302 ,p_gos_attribute26 =>p_rec.gos_attribute26
303 ,p_gos_attribute27 =>p_rec.gos_attribute27
304 ,p_gos_attribute28 =>p_rec.gos_attribute28
305 ,p_gos_attribute29 =>p_rec.gos_attribute29
306 ,p_gos_attribute30 =>p_rec.gos_attribute30
307 ,p_object_version_number =>p_rec.object_version_number
308 ,p_effective_date =>p_effective_date
309 );
310 --
311 exception
312 --
313 when hr_api.cannot_find_prog_unit then
314 --
315 hr_api.cannot_find_prog_unit_error
316 (p_module_name => 'ben_gd_or_svc_typ'
317 ,p_hook_type => 'AI');
318 --
319 end;
320 --
321 -- End of API User Hook for post_insert.
322 --
323 --
324 hr_utility.set_location(' Leaving:'||l_proc, 10);
325 End post_insert;
326 --
327 -- ----------------------------------------------------------------------------
328 -- |---------------------------------< ins >----------------------------------|
329 -- ----------------------------------------------------------------------------
330 Procedure ins
331 (
332 p_effective_date in date,
333 p_rec in out nocopy ben_gos_shd.g_rec_type
334 ) is
335 --
336 l_proc varchar2(72) := g_package||'ins';
337 --
338 Begin
339 hr_utility.set_location('Entering:'||l_proc, 5);
340 --
341 -- Call the supporting insert validate operations
342 --
343 ben_gos_bus.insert_validate(p_rec
344 ,p_effective_date);
345 --
346 -- Call the supporting pre-insert operation
347 --
348 pre_insert(p_rec);
349 --
350 -- Insert the row
351 --
352 insert_dml(p_rec);
353 --
354 -- Call the supporting post-insert operation
355 --
356 post_insert(
357 p_effective_date,p_rec);
358 end ins;
359 --
360 -- ----------------------------------------------------------------------------
361 -- |---------------------------------< ins >----------------------------------|
362 -- ----------------------------------------------------------------------------
363 Procedure ins
364 (
365 p_effective_date in date,
366 p_gd_or_svc_typ_id out nocopy number,
367 p_business_group_id in number,
368 p_name in varchar2,
369 p_typ_cd in varchar2 default null,
370 p_description in varchar2 default null,
371 p_gos_attribute_category in varchar2 default null,
372 p_gos_attribute1 in varchar2 default null,
373 p_gos_attribute2 in varchar2 default null,
374 p_gos_attribute3 in varchar2 default null,
375 p_gos_attribute4 in varchar2 default null,
376 p_gos_attribute5 in varchar2 default null,
377 p_gos_attribute6 in varchar2 default null,
378 p_gos_attribute7 in varchar2 default null,
379 p_gos_attribute8 in varchar2 default null,
380 p_gos_attribute9 in varchar2 default null,
381 p_gos_attribute10 in varchar2 default null,
382 p_gos_attribute11 in varchar2 default null,
383 p_gos_attribute12 in varchar2 default null,
384 p_gos_attribute13 in varchar2 default null,
385 p_gos_attribute14 in varchar2 default null,
386 p_gos_attribute15 in varchar2 default null,
387 p_gos_attribute16 in varchar2 default null,
388 p_gos_attribute17 in varchar2 default null,
389 p_gos_attribute18 in varchar2 default null,
390 p_gos_attribute19 in varchar2 default null,
391 p_gos_attribute20 in varchar2 default null,
392 p_gos_attribute21 in varchar2 default null,
393 p_gos_attribute22 in varchar2 default null,
394 p_gos_attribute23 in varchar2 default null,
395 p_gos_attribute24 in varchar2 default null,
396 p_gos_attribute25 in varchar2 default null,
397 p_gos_attribute26 in varchar2 default null,
398 p_gos_attribute27 in varchar2 default null,
399 p_gos_attribute28 in varchar2 default null,
400 p_gos_attribute29 in varchar2 default null,
401 p_gos_attribute30 in varchar2 default null,
402 p_object_version_number out nocopy number
403 ) is
404 --
405 l_rec ben_gos_shd.g_rec_type;
406 l_proc varchar2(72) := g_package||'ins';
407 --
408 Begin
409 hr_utility.set_location('Entering:'||l_proc, 5);
410 --
411 -- Call conversion function to turn arguments into the
412 -- p_rec structure.
413 --
414 l_rec :=
415 ben_gos_shd.convert_args
416 (
417 null,
418 p_business_group_id,
419 p_name,
420 p_typ_cd,
421 p_description,
422 p_gos_attribute_category,
423 p_gos_attribute1,
424 p_gos_attribute2,
425 p_gos_attribute3,
426 p_gos_attribute4,
427 p_gos_attribute5,
428 p_gos_attribute6,
429 p_gos_attribute7,
430 p_gos_attribute8,
431 p_gos_attribute9,
432 p_gos_attribute10,
433 p_gos_attribute11,
434 p_gos_attribute12,
435 p_gos_attribute13,
436 p_gos_attribute14,
437 p_gos_attribute15,
438 p_gos_attribute16,
439 p_gos_attribute17,
440 p_gos_attribute18,
441 p_gos_attribute19,
442 p_gos_attribute20,
443 p_gos_attribute21,
444 p_gos_attribute22,
445 p_gos_attribute23,
446 p_gos_attribute24,
447 p_gos_attribute25,
448 p_gos_attribute26,
449 p_gos_attribute27,
450 p_gos_attribute28,
451 p_gos_attribute29,
452 p_gos_attribute30,
453 null
454 );
455 --
456 -- Having converted the arguments into the ben_gos_rec
457 -- plsql record structure we call the corresponding record business process.
458 --
459 hr_utility.set_location('In:'||l_proc, 7);
460 ins(
461 p_effective_date,l_rec);
462 --
463 -- As the primary key argument(s)
464 -- are specified as an OUT's we must set these values.
465 --
466 p_gd_or_svc_typ_id := l_rec.gd_or_svc_typ_id;
467 p_object_version_number := l_rec.object_version_number;
468 --
469 hr_utility.set_location(' Leaving:'||l_proc, 10);
470 End ins;
471 --
472 end ben_gos_ins;