DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CLA_INS

Source


1 Package Body ben_cla_ins as
2 /* $Header: beclarhi.pkb 120.0 2005/05/28 01:03:20 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cla_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_cla_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_cla_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ben_cmbn_age_los_fctr
64   --
65   insert into ben_cmbn_age_los_fctr
66   (	cmbn_age_los_fctr_id,
67 	business_group_id,
68 	los_fctr_id,
69 	age_fctr_id,
70 	cmbnd_min_val,
71 	cmbnd_max_val,
72 	ordr_num,
73 	cla_attribute_category,
74 	cla_attribute1,
75 	cla_attribute2,
76 	cla_attribute3,
77 	cla_attribute4,
78 	cla_attribute5,
79 	cla_attribute6,
80 	cla_attribute7,
81 	cla_attribute8,
82 	cla_attribute9,
83 	cla_attribute10,
84 	cla_attribute11,
85 	cla_attribute12,
86 	cla_attribute13,
87 	cla_attribute14,
88 	cla_attribute15,
89 	cla_attribute16,
90 	cla_attribute17,
91 	cla_attribute18,
92 	cla_attribute19,
93 	cla_attribute20,
94 	cla_attribute21,
95 	cla_attribute22,
96 	cla_attribute23,
97 	cla_attribute24,
98 	cla_attribute25,
99 	cla_attribute26,
100 	cla_attribute27,
101 	cla_attribute28,
102 	cla_attribute29,
103 	cla_attribute30,
104 	object_version_number ,
105 	name
106   )
107   Values
108   (	p_rec.cmbn_age_los_fctr_id,
109 	p_rec.business_group_id,
110 	p_rec.los_fctr_id,
111 	p_rec.age_fctr_id,
112 	p_rec.cmbnd_min_val,
113 	p_rec.cmbnd_max_val,
114 	p_rec.ordr_num,
115 	p_rec.cla_attribute_category,
116 	p_rec.cla_attribute1,
117 	p_rec.cla_attribute2,
118 	p_rec.cla_attribute3,
119 	p_rec.cla_attribute4,
120 	p_rec.cla_attribute5,
121 	p_rec.cla_attribute6,
122 	p_rec.cla_attribute7,
123 	p_rec.cla_attribute8,
124 	p_rec.cla_attribute9,
125 	p_rec.cla_attribute10,
126 	p_rec.cla_attribute11,
127 	p_rec.cla_attribute12,
128 	p_rec.cla_attribute13,
129 	p_rec.cla_attribute14,
130 	p_rec.cla_attribute15,
131 	p_rec.cla_attribute16,
132 	p_rec.cla_attribute17,
133 	p_rec.cla_attribute18,
134 	p_rec.cla_attribute19,
135 	p_rec.cla_attribute20,
136 	p_rec.cla_attribute21,
137 	p_rec.cla_attribute22,
138 	p_rec.cla_attribute23,
139 	p_rec.cla_attribute24,
140 	p_rec.cla_attribute25,
141 	p_rec.cla_attribute26,
142 	p_rec.cla_attribute27,
143 	p_rec.cla_attribute28,
144 	p_rec.cla_attribute29,
145 	p_rec.cla_attribute30,
146 	p_rec.object_version_number ,
147 	p_rec.name
148   );
149   --
150   ben_cla_shd.g_api_dml := false;   -- Unset the api dml status
151   --
152   hr_utility.set_location(' Leaving:'||l_proc, 10);
153 Exception
154   When hr_api.check_integrity_violated Then
155     -- A check constraint has been violated
156     ben_cla_shd.g_api_dml := false;   -- Unset the api dml status
157     ben_cla_shd.constraint_error
158       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
159   When hr_api.parent_integrity_violated Then
160     -- Parent integrity has been violated
161     ben_cla_shd.g_api_dml := false;   -- Unset the api dml status
162     ben_cla_shd.constraint_error
163       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
164   When hr_api.unique_integrity_violated Then
165     -- Unique integrity has been violated
166     ben_cla_shd.g_api_dml := false;   -- Unset the api dml status
167     ben_cla_shd.constraint_error
168       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
169   When Others Then
170     ben_cla_shd.g_api_dml := false;   -- Unset the api dml status
171     Raise;
172 End insert_dml;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |------------------------------< pre_insert >------------------------------|
176 -- ----------------------------------------------------------------------------
177 -- {Start Of Comments}
178 --
179 -- Description:
180 --   This private procedure contains any processing which is required before
181 --   the insert dml. Presently, if the entity has a corresponding primary
182 --   key which is maintained by an associating sequence, the primary key for
183 --   the entity will be populated with the next sequence value in
184 --   preparation for the insert dml.
185 --
186 -- Prerequisites:
187 --   This is an internal procedure which is called from the ins procedure.
188 --
189 -- In Parameters:
190 --   A Pl/Sql record structre.
191 --
192 -- Post Success:
193 --   Processing continues.
194 --
195 -- Post Failure:
196 --   If an error has occurred, an error message and exception will be raised
197 --   but not handled.
198 --
199 -- Developer Implementation Notes:
200 --   Any pre-processing required before the insert dml is issued should be
201 --   coded within this procedure. As stated above, a good example is the
202 --   generation of a primary key number via a corresponding sequence.
203 --   It is important to note that any 3rd party maintenance should be reviewed
204 --   before placing in this procedure.
205 --
206 -- Access Status:
207 --   Internal Row Handler Use Only.
208 --
209 -- {End Of Comments}
210 -- ----------------------------------------------------------------------------
211 Procedure pre_insert(p_rec  in out nocopy ben_cla_shd.g_rec_type) is
212 --
213   l_proc  varchar2(72) := g_package||'pre_insert';
214 --
215   Cursor C_Sel1 is select ben_cmbn_age_los_fctr_s.nextval from sys.dual;
216 --
217 Begin
218   hr_utility.set_location('Entering:'||l_proc, 5);
219   --
220   --
221   -- Select the next sequence number
222   --
223   Open C_Sel1;
224   Fetch C_Sel1 Into p_rec.cmbn_age_los_fctr_id;
225   Close C_Sel1;
226   --
227   hr_utility.set_location(' Leaving:'||l_proc, 10);
228 End pre_insert;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |-----------------------------< post_insert >------------------------------|
232 -- ----------------------------------------------------------------------------
233 -- {Start Of Comments}
234 --
235 -- Description:
236 --   This private procedure contains any processing which is required after the
237 --   insert dml.
238 --
239 -- Prerequisites:
240 --   This is an internal procedure which is called from the ins procedure.
241 --
242 -- In Parameters:
243 --   A Pl/Sql record structre.
244 --
245 -- Post Success:
246 --   Processing continues.
247 --
248 -- Post Failure:
249 --   If an error has occurred, an error message and exception will be raised
250 --   but not handled.
251 --
252 -- Developer Implementation Notes:
253 --   Any post-processing required after the insert dml is issued should be
254 --   coded within this procedure. It is important to note that any 3rd party
255 --   maintenance should be reviewed before placing in this procedure.
256 --
257 -- Access Status:
258 --   Internal Row Handler Use Only.
259 --
260 -- {End Of Comments}
261 -- ----------------------------------------------------------------------------
262 Procedure post_insert(p_rec in ben_cla_shd.g_rec_type) is
263 --
264   l_proc  varchar2(72) := g_package||'post_insert';
265 --
266 Begin
267   hr_utility.set_location('Entering:'||l_proc, 5);
268 --
269   --
270   -- Start of API User Hook for post_insert.
271   --
272   begin
273     --
274     ben_cla_rki.after_insert
275       (
276   p_cmbn_age_los_fctr_id          =>p_rec.cmbn_age_los_fctr_id
277  ,p_business_group_id             =>p_rec.business_group_id
278  ,p_los_fctr_id                   =>p_rec.los_fctr_id
279  ,p_age_fctr_id                   =>p_rec.age_fctr_id
280  ,p_cmbnd_min_val                 =>p_rec.cmbnd_min_val
281  ,p_cmbnd_max_val                 =>p_rec.cmbnd_max_val
282  ,p_ordr_num                      =>p_rec.ordr_num
283  ,p_cla_attribute_category        =>p_rec.cla_attribute_category
284  ,p_cla_attribute1                =>p_rec.cla_attribute1
285  ,p_cla_attribute2                =>p_rec.cla_attribute2
286  ,p_cla_attribute3                =>p_rec.cla_attribute3
287  ,p_cla_attribute4                =>p_rec.cla_attribute4
288  ,p_cla_attribute5                =>p_rec.cla_attribute5
289  ,p_cla_attribute6                =>p_rec.cla_attribute6
290  ,p_cla_attribute7                =>p_rec.cla_attribute7
291  ,p_cla_attribute8                =>p_rec.cla_attribute8
292  ,p_cla_attribute9                =>p_rec.cla_attribute9
293  ,p_cla_attribute10               =>p_rec.cla_attribute10
294  ,p_cla_attribute11               =>p_rec.cla_attribute11
295  ,p_cla_attribute12               =>p_rec.cla_attribute12
296  ,p_cla_attribute13               =>p_rec.cla_attribute13
297  ,p_cla_attribute14               =>p_rec.cla_attribute14
298  ,p_cla_attribute15               =>p_rec.cla_attribute15
299  ,p_cla_attribute16               =>p_rec.cla_attribute16
300  ,p_cla_attribute17               =>p_rec.cla_attribute17
301  ,p_cla_attribute18               =>p_rec.cla_attribute18
302  ,p_cla_attribute19               =>p_rec.cla_attribute19
303  ,p_cla_attribute20               =>p_rec.cla_attribute20
304  ,p_cla_attribute21               =>p_rec.cla_attribute21
305  ,p_cla_attribute22               =>p_rec.cla_attribute22
306  ,p_cla_attribute23               =>p_rec.cla_attribute23
307  ,p_cla_attribute24               =>p_rec.cla_attribute24
308  ,p_cla_attribute25               =>p_rec.cla_attribute25
309  ,p_cla_attribute26               =>p_rec.cla_attribute26
310  ,p_cla_attribute27               =>p_rec.cla_attribute27
311  ,p_cla_attribute28               =>p_rec.cla_attribute28
312  ,p_cla_attribute29               =>p_rec.cla_attribute29
313  ,p_cla_attribute30               =>p_rec.cla_attribute30
314  ,p_object_version_number         =>p_rec.object_version_number
315  ,p_name                          =>p_rec.name
316       );
317     --
318   exception
319     --
320     when hr_api.cannot_find_prog_unit then
321       --
322       hr_api.cannot_find_prog_unit_error
323         (p_module_name => 'ben_cmbn_age_los_fctr'
324         ,p_hook_type   => 'AI');
325       --
326   end;
327   --
328   -- End of API User Hook for post_insert.
329   --
330   --
331   hr_utility.set_location(' Leaving:'||l_proc, 10);
332 End post_insert;
333 --
334 -- ----------------------------------------------------------------------------
335 -- |---------------------------------< ins >----------------------------------|
336 -- ----------------------------------------------------------------------------
337 Procedure ins
338   (
339   p_rec        in out nocopy ben_cla_shd.g_rec_type
340   ) is
341 --
342   l_proc  varchar2(72) := g_package||'ins';
343 --
344 Begin
345   hr_utility.set_location('Entering:'||l_proc, 5);
346   --
347   -- Call the supporting insert validate operations
348   --
349   ben_cla_bus.insert_validate(p_rec);
350   --
351   -- Call the supporting pre-insert operation
352   --
353   pre_insert(p_rec);
354   --
355   -- Insert the row
356   --
357   insert_dml(p_rec);
358   --
359   -- Call the supporting post-insert operation
360   --
361   post_insert(p_rec);
362 end ins;
363 --
364 -- ----------------------------------------------------------------------------
365 -- |---------------------------------< ins >----------------------------------|
366 -- ----------------------------------------------------------------------------
367 Procedure ins
368   (
369   p_cmbn_age_los_fctr_id         out nocopy number,
370   p_business_group_id            in number,
371   p_los_fctr_id                  in number,
372   p_age_fctr_id                  in number,
373   p_cmbnd_min_val                in number           default null,
374   p_cmbnd_max_val                in number           default null,
375   p_ordr_num                     in number           default null,
376   p_cla_attribute_category       in varchar2         default null,
377   p_cla_attribute1               in varchar2         default null,
378   p_cla_attribute2               in varchar2         default null,
379   p_cla_attribute3               in varchar2         default null,
380   p_cla_attribute4               in varchar2         default null,
381   p_cla_attribute5               in varchar2         default null,
382   p_cla_attribute6               in varchar2         default null,
383   p_cla_attribute7               in varchar2         default null,
384   p_cla_attribute8               in varchar2         default null,
385   p_cla_attribute9               in varchar2         default null,
386   p_cla_attribute10              in varchar2         default null,
387   p_cla_attribute11              in varchar2         default null,
388   p_cla_attribute12              in varchar2         default null,
389   p_cla_attribute13              in varchar2         default null,
390   p_cla_attribute14              in varchar2         default null,
391   p_cla_attribute15              in varchar2         default null,
392   p_cla_attribute16              in varchar2         default null,
393   p_cla_attribute17              in varchar2         default null,
394   p_cla_attribute18              in varchar2         default null,
395   p_cla_attribute19              in varchar2         default null,
396   p_cla_attribute20              in varchar2         default null,
397   p_cla_attribute21              in varchar2         default null,
398   p_cla_attribute22              in varchar2         default null,
399   p_cla_attribute23              in varchar2         default null,
400   p_cla_attribute24              in varchar2         default null,
401   p_cla_attribute25              in varchar2         default null,
402   p_cla_attribute26              in varchar2         default null,
403   p_cla_attribute27              in varchar2         default null,
404   p_cla_attribute28              in varchar2         default null,
405   p_cla_attribute29              in varchar2         default null,
406   p_cla_attribute30              in varchar2         default null,
407   p_object_version_number        out nocopy number ,
408   p_name                         in varchar2
409   ) is
410 --
411   l_rec	  ben_cla_shd.g_rec_type;
412   l_proc  varchar2(72) := g_package||'ins';
413 --
414 Begin
415   hr_utility.set_location('Entering:'||l_proc, 5);
416   --
417   -- Call conversion function to turn arguments into the
418   -- p_rec structure.
419   --
420   l_rec :=
421   ben_cla_shd.convert_args
422   (
423   null,
424   p_business_group_id,
425   p_los_fctr_id,
426   p_age_fctr_id,
427   p_cmbnd_min_val,
428   p_cmbnd_max_val,
429   p_ordr_num,
430   p_cla_attribute_category,
431   p_cla_attribute1,
432   p_cla_attribute2,
433   p_cla_attribute3,
434   p_cla_attribute4,
435   p_cla_attribute5,
436   p_cla_attribute6,
437   p_cla_attribute7,
438   p_cla_attribute8,
439   p_cla_attribute9,
440   p_cla_attribute10,
441   p_cla_attribute11,
442   p_cla_attribute12,
443   p_cla_attribute13,
444   p_cla_attribute14,
445   p_cla_attribute15,
446   p_cla_attribute16,
447   p_cla_attribute17,
448   p_cla_attribute18,
449   p_cla_attribute19,
450   p_cla_attribute20,
451   p_cla_attribute21,
452   p_cla_attribute22,
453   p_cla_attribute23,
454   p_cla_attribute24,
455   p_cla_attribute25,
456   p_cla_attribute26,
457   p_cla_attribute27,
458   p_cla_attribute28,
459   p_cla_attribute29,
460   p_cla_attribute30,
461   null ,
462   p_name
463   );
464   --
465   -- Having converted the arguments into the ben_cla_rec
466   -- plsql record structure we call the corresponding record business process.
467   --
468   ins(l_rec);
469   --
470   -- As the primary key argument(s)
471   -- are specified as an OUT's we must set these values.
472   --
473   p_cmbn_age_los_fctr_id := l_rec.cmbn_age_los_fctr_id;
474   p_object_version_number := l_rec.object_version_number;
475   --
476   hr_utility.set_location(' Leaving:'||l_proc, 10);
477 End ins;
478 --
479 end ben_cla_ins;