DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PTY_INS

Source


1 Package Body ben_pty_ins as
2 /* $Header: beptyrhi.pkb 115.7 2002/12/10 15:22:41 bmanyam noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_pty_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
54   (p_rec in out nocopy ben_pty_shd.g_rec_type
55   ) is
56 --
57   l_proc  varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60   hr_utility.set_location('Entering:'||l_proc, 5);
61   p_rec.object_version_number := 1;  -- Initialise the object version
62   --
63   ben_pty_shd.g_api_dml := true;  -- Set the api dml status
64   --
65   -- Insert the row into: ben_pl_pcp_typ
66   --
67   insert into ben_pl_pcp_typ
68       (pl_pcp_typ_id
69       ,pl_pcp_id
70       ,business_group_id
71       ,pcp_typ_cd
72       ,min_age
73       ,max_age
74       ,gndr_alwd_cd
75       ,pty_attribute_category
76       ,pty_attribute1
77       ,pty_attribute2
78       ,pty_attribute3
79       ,pty_attribute4
80       ,pty_attribute5
81       ,pty_attribute6
82       ,pty_attribute7
83       ,pty_attribute8
84       ,pty_attribute9
85       ,pty_attribute10
86       ,pty_attribute11
87       ,pty_attribute12
88       ,pty_attribute13
89       ,pty_attribute14
90       ,pty_attribute15
91       ,pty_attribute16
92       ,pty_attribute17
93       ,pty_attribute18
94       ,pty_attribute19
95       ,pty_attribute20
96       ,pty_attribute21
97       ,pty_attribute22
98       ,pty_attribute23
99       ,pty_attribute24
100       ,pty_attribute25
101       ,pty_attribute26
102       ,pty_attribute27
103       ,pty_attribute28
104       ,pty_attribute29
105       ,pty_attribute30
106       ,object_version_number
107       )
108   Values
109     (p_rec.pl_pcp_typ_id
110     ,p_rec.pl_pcp_id
111     ,p_rec.business_group_id
112     ,p_rec.pcp_typ_cd
113     ,p_rec.min_age
114     ,p_rec.max_age
115     ,p_rec.gndr_alwd_cd
116     ,p_rec.pty_attribute_category
117     ,p_rec.pty_attribute1
118     ,p_rec.pty_attribute2
119     ,p_rec.pty_attribute3
120     ,p_rec.pty_attribute4
121     ,p_rec.pty_attribute5
122     ,p_rec.pty_attribute6
123     ,p_rec.pty_attribute7
124     ,p_rec.pty_attribute8
125     ,p_rec.pty_attribute9
126     ,p_rec.pty_attribute10
127     ,p_rec.pty_attribute11
128     ,p_rec.pty_attribute12
129     ,p_rec.pty_attribute13
130     ,p_rec.pty_attribute14
131     ,p_rec.pty_attribute15
132     ,p_rec.pty_attribute16
133     ,p_rec.pty_attribute17
134     ,p_rec.pty_attribute18
135     ,p_rec.pty_attribute19
136     ,p_rec.pty_attribute20
137     ,p_rec.pty_attribute21
138     ,p_rec.pty_attribute22
139     ,p_rec.pty_attribute23
140     ,p_rec.pty_attribute24
141     ,p_rec.pty_attribute25
142     ,p_rec.pty_attribute26
143     ,p_rec.pty_attribute27
144     ,p_rec.pty_attribute28
145     ,p_rec.pty_attribute29
146     ,p_rec.pty_attribute30
147     ,p_rec.object_version_number
148     );
149   --
150   ben_pty_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_pty_shd.g_api_dml := false;   -- Unset the api dml status
157     ben_pty_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_pty_shd.g_api_dml := false;   -- Unset the api dml status
162     ben_pty_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_pty_shd.g_api_dml := false;   -- Unset the api dml status
167     ben_pty_shd.constraint_error
168       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
169   When Others Then
170     ben_pty_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
212   (p_rec  in out nocopy ben_pty_shd.g_rec_type
213   ) is
214 --
215   l_proc  varchar2(72) := g_package||'pre_insert';
216 --
217   Cursor C_Sel1 is select ben_pl_pcp_typ_s.nextval from sys.dual;
218 --
219 Begin
220   hr_utility.set_location('Entering:'||l_proc, 5);
221   --
222   --
223   -- Select the next sequence number
224   --
225   Open C_Sel1;
226   Fetch C_Sel1 Into p_rec.pl_pcp_typ_id;
227   Close C_Sel1;
228   --
229   hr_utility.set_location(' Leaving:'||l_proc, 10);
230 End pre_insert;
231 --
232 -- ----------------------------------------------------------------------------
233 -- |-----------------------------< post_insert >------------------------------|
234 -- ----------------------------------------------------------------------------
235 -- {Start Of Comments}
236 --
237 -- Description:
238 --   This private procedure contains any processing which is required after the
239 --   insert dml.
240 --
241 -- Prerequisites:
242 --   This is an internal procedure which is called from the ins procedure.
243 --
244 -- In Parameters:
245 --   A Pl/Sql record structre.
246 --
247 -- Post Success:
248 --   Processing continues.
249 --
250 -- Post Failure:
251 --   If an error has occurred, an error message and exception will be raised
252 --   but not handled.
253 --
254 -- Developer Implementation Notes:
255 --   Any post-processing required after the insert dml is issued should be
256 --   coded within this procedure. It is important to note that any 3rd party
257 --   maintenance should be reviewed before placing in this procedure.
258 --
259 -- Access Status:
260 --   Internal Row Handler Use Only.
261 --
262 -- {End Of Comments}
263 -- ----------------------------------------------------------------------------
264 Procedure post_insert
265   (p_rec                          in ben_pty_shd.g_rec_type
266   ) is
267 --
268   l_proc  varchar2(72) := g_package||'post_insert';
269 --
270 Begin
271   hr_utility.set_location('Entering:'||l_proc, 5);
272   begin
273     --
274     ben_pty_rki.after_insert
275       (p_pl_pcp_typ_id
276       => p_rec.pl_pcp_typ_id
277       ,p_pl_pcp_id
278       => p_rec.pl_pcp_id
279       ,p_business_group_id
280       => p_rec.business_group_id
281       ,p_pcp_typ_cd
282       => p_rec.pcp_typ_cd
283       ,p_min_age
284       => p_rec.min_age
285       ,p_max_age
286       => p_rec.max_age
287       ,p_gndr_alwd_cd
288       => p_rec.gndr_alwd_cd
289       ,p_pty_attribute_category
290       => p_rec.pty_attribute_category
291       ,p_pty_attribute1
292       => p_rec.pty_attribute1
293       ,p_pty_attribute2
294       => p_rec.pty_attribute2
295       ,p_pty_attribute3
296       => p_rec.pty_attribute3
297       ,p_pty_attribute4
298       => p_rec.pty_attribute4
299       ,p_pty_attribute5
300       => p_rec.pty_attribute5
301       ,p_pty_attribute6
302       => p_rec.pty_attribute6
303       ,p_pty_attribute7
304       => p_rec.pty_attribute7
305       ,p_pty_attribute8
306       => p_rec.pty_attribute8
307       ,p_pty_attribute9
308       => p_rec.pty_attribute9
309       ,p_pty_attribute10
310       => p_rec.pty_attribute10
311       ,p_pty_attribute11
312       => p_rec.pty_attribute11
313       ,p_pty_attribute12
314       => p_rec.pty_attribute12
315       ,p_pty_attribute13
316       => p_rec.pty_attribute13
317       ,p_pty_attribute14
318       => p_rec.pty_attribute14
319       ,p_pty_attribute15
320       => p_rec.pty_attribute15
321       ,p_pty_attribute16
322       => p_rec.pty_attribute16
323       ,p_pty_attribute17
324       => p_rec.pty_attribute17
325       ,p_pty_attribute18
326       => p_rec.pty_attribute18
327       ,p_pty_attribute19
328       => p_rec.pty_attribute19
329       ,p_pty_attribute20
330       => p_rec.pty_attribute20
331       ,p_pty_attribute21
332       => p_rec.pty_attribute21
333       ,p_pty_attribute22
334       => p_rec.pty_attribute22
335       ,p_pty_attribute23
336       => p_rec.pty_attribute23
337       ,p_pty_attribute24
338       => p_rec.pty_attribute24
339       ,p_pty_attribute25
340       => p_rec.pty_attribute25
341       ,p_pty_attribute26
342       => p_rec.pty_attribute26
343       ,p_pty_attribute27
344       => p_rec.pty_attribute27
345       ,p_pty_attribute28
346       => p_rec.pty_attribute28
347       ,p_pty_attribute29
348       => p_rec.pty_attribute29
349       ,p_pty_attribute30
350       => p_rec.pty_attribute30
351       ,p_object_version_number
352       => p_rec.object_version_number
353       );
354     --
355   exception
356     --
357     when hr_api.cannot_find_prog_unit then
358       --
359       hr_api.cannot_find_prog_unit_error
360         (p_module_name => 'BEN_PL_PCP_TYP'
361         ,p_hook_type   => 'AI');
362       --
363   end;
364   --
365   hr_utility.set_location(' Leaving:'||l_proc, 10);
366 End post_insert;
367 --
368 -- ----------------------------------------------------------------------------
369 -- |---------------------------------< ins >----------------------------------|
370 -- ----------------------------------------------------------------------------
371 Procedure ins
372   (p_effective_date in date,
373    p_rec                          in out nocopy ben_pty_shd.g_rec_type
374   ) is
375 --
376   l_proc  varchar2(72) := g_package||'ins';
377 --
378 Begin
379   hr_utility.set_location('Entering:'||l_proc, 5);
380   --
381   -- Call the supporting insert validate operations
382   --
383   ben_pty_bus.insert_validate
384      (p_rec,
385    p_effective_date);
386   --
387   -- Call the supporting pre-insert operation
388   --
389   ben_pty_ins.pre_insert(p_rec);
390   --
391   -- Insert the row
392   --
393   ben_pty_ins.insert_dml(p_rec);
394   --
395   -- Call the supporting post-insert operation
396   --
397   ben_pty_ins.post_insert
398      (p_rec
399      );
400   --
401   hr_utility.set_location('Leaving:'||l_proc, 20);
402 end ins;
403 --
404 -- ----------------------------------------------------------------------------
405 -- |---------------------------------< ins >----------------------------------|
406 -- ----------------------------------------------------------------------------
407 Procedure ins
408   (  p_effective_date in date
409   ,p_pl_pcp_id                      in     number
410   ,p_business_group_id              in     number
411   ,p_pcp_typ_cd                     in     varchar2 default null
412   ,p_min_age                        in     number   default null
413   ,p_max_age                        in     number   default null
414   ,p_gndr_alwd_cd                   in     varchar2 default null
415   ,p_pty_attribute_category         in     varchar2 default null
416   ,p_pty_attribute1                 in     varchar2 default null
417   ,p_pty_attribute2                 in     varchar2 default null
418   ,p_pty_attribute3                 in     varchar2 default null
419   ,p_pty_attribute4                 in     varchar2 default null
420   ,p_pty_attribute5                 in     varchar2 default null
421   ,p_pty_attribute6                 in     varchar2 default null
422   ,p_pty_attribute7                 in     varchar2 default null
423   ,p_pty_attribute8                 in     varchar2 default null
424   ,p_pty_attribute9                 in     varchar2 default null
425   ,p_pty_attribute10                in     varchar2 default null
426   ,p_pty_attribute11                in     varchar2 default null
427   ,p_pty_attribute12                in     varchar2 default null
428   ,p_pty_attribute13                in     varchar2 default null
429   ,p_pty_attribute14                in     varchar2 default null
430   ,p_pty_attribute15                in     varchar2 default null
431   ,p_pty_attribute16                in     varchar2 default null
432   ,p_pty_attribute17                in     varchar2 default null
433   ,p_pty_attribute18                in     varchar2 default null
434   ,p_pty_attribute19                in     varchar2 default null
435   ,p_pty_attribute20                in     varchar2 default null
436   ,p_pty_attribute21                in     varchar2 default null
437   ,p_pty_attribute22                in     varchar2 default null
438   ,p_pty_attribute23                in     varchar2 default null
439   ,p_pty_attribute24                in     varchar2 default null
440   ,p_pty_attribute25                in     varchar2 default null
441   ,p_pty_attribute26                in     varchar2 default null
442   ,p_pty_attribute27                in     varchar2 default null
443   ,p_pty_attribute28                in     varchar2 default null
444   ,p_pty_attribute29                in     varchar2 default null
445   ,p_pty_attribute30                in     varchar2 default null
446   ,p_pl_pcp_typ_id                     out nocopy number
447   ,p_object_version_number             out nocopy number
448   ) is
449 --
450   l_rec	  ben_pty_shd.g_rec_type;
451   l_proc  varchar2(72) := g_package||'ins';
452 --
453 Begin
454   hr_utility.set_location('Entering:'||l_proc, 5);
455   --
456   -- Call conversion function to turn arguments into the
457   -- p_rec structure.
458   --
459   l_rec :=
460   ben_pty_shd.convert_args
461     (null
462     ,p_pl_pcp_id
463     ,p_business_group_id
464     ,p_pcp_typ_cd
465     ,p_min_age
466     ,p_max_age
467     ,p_gndr_alwd_cd
468     ,p_pty_attribute_category
469     ,p_pty_attribute1
470     ,p_pty_attribute2
471     ,p_pty_attribute3
472     ,p_pty_attribute4
473     ,p_pty_attribute5
474     ,p_pty_attribute6
475     ,p_pty_attribute7
476     ,p_pty_attribute8
477     ,p_pty_attribute9
478     ,p_pty_attribute10
479     ,p_pty_attribute11
480     ,p_pty_attribute12
481     ,p_pty_attribute13
482     ,p_pty_attribute14
483     ,p_pty_attribute15
484     ,p_pty_attribute16
485     ,p_pty_attribute17
486     ,p_pty_attribute18
487     ,p_pty_attribute19
488     ,p_pty_attribute20
489     ,p_pty_attribute21
490     ,p_pty_attribute22
491     ,p_pty_attribute23
492     ,p_pty_attribute24
493     ,p_pty_attribute25
494     ,p_pty_attribute26
495     ,p_pty_attribute27
496     ,p_pty_attribute28
497     ,p_pty_attribute29
498     ,p_pty_attribute30
499     ,null
500     );
501   --
502   -- Having converted the arguments into the ben_pty_rec
503   -- plsql record structure we call the corresponding record business process.
504   --
505   ben_pty_ins.ins
506      (p_effective_date, l_rec
507      );
508   --
509   -- As the primary key argument(s)
510   -- are specified as an OUT's we must set these values.
511   --
512   p_pl_pcp_typ_id := l_rec.pl_pcp_typ_id;
513   p_object_version_number := l_rec.object_version_number;
514   --
515   hr_utility.set_location(' Leaving:'||l_proc, 10);
516 End ins;
517 --
518 end ben_pty_ins;