DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TAT_INS

Source


1 package body hxc_tat_ins as
2 /* $Header: hxtatrhi.pkb 120.2 2005/09/23 07:03:57 rchennur noship $ */
3 -- --------------------------------------------------------------------------
4 -- |                     Private Global Definitions                         |
5 -- --------------------------------------------------------------------------
6 g_package  varchar2(33)	:= '  hxc_tat_ins.';  -- global package name
7 g_debug boolean := hr_utility.debug_enabled;
8 -- --------------------------------------------------------------------------
9 -- |------------------------------< insert_dml >----------------------------|
10 -- --------------------------------------------------------------------------
11 -- {Start Of Comments}
12 --
13 -- Description:
14 --   This procedure controls the actual dml insert logic. The processing of
15 --   this procedure are as follows:
16 --   1) Initialise the object_version_number to 1 if the object_version_number
17 --      is defined as an attribute for this entity.
18 --   2) To set and unset the g_api_dml status as required (as we are about to
19 --      perform dml).
20 --   3) To insert the row into the schema.
21 --   4) To trap any constraint violations that may have occurred.
22 --   5) To raise any other errors.
23 --
24 -- Prerequisites:
25 --   This is an internal private procedure which must be called from the ins
26 --   procedure and must have all mandatory attributes set (except the
27 --   object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 --   On the insert dml failure it is important to note that we always reset the
37 --   g_api_dml status to false.
38 --   if a check, unique or parent integrity constraint violation is raised the
39 --   constraint_error procedure will be called.
40 --   if any other error is reported, the error will be raised after the
41 --   g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
44 --   None.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- {end Of Comments}
50 -- --------------------------------------------------------------------------
51 procedure insert_dml
52   (p_rec in out nocopy hxc_tat_shd.g_rec_type
53   ) is
54 
55 l_proc  varchar2(72) ;
56 
57 begin
58 
59   if g_debug then
60   	l_proc := g_package||'insert_dml';
61   	hr_utility.set_location('Entering:'||l_proc, 5);
62   end if;
63 
64   p_rec.object_version_number := 1;  -- initialise the object version
65 
66   -- insert the row into: hxc_time_attributes
67 
68   insert into hxc_time_attributes
69     (time_attribute_id
70     ,object_version_number
71     ,attribute_category
72     ,attribute1
73     ,attribute2
74     ,attribute3
75     ,attribute4
76     ,attribute5
77     ,attribute6
78     ,attribute7
79     ,attribute8
80     ,attribute9
81     ,attribute10
82     ,attribute11
83     ,attribute12
84     ,attribute13
85     ,attribute14
86     ,attribute15
87     ,attribute16
88     ,attribute17
89     ,attribute18
90     ,attribute19
91     ,attribute20
92     ,attribute21
93     ,attribute22
94     ,attribute23
95     ,attribute24
96     ,attribute25
97     ,attribute26
98     ,attribute27
99     ,attribute28
100     ,attribute29
101     ,attribute30
102     ,bld_blk_info_type_id
103     ,data_set_id
104     )
105   values
106     (hxc_time_attributes_s.nextval         --Fix for Bug#3062133
107     ,p_rec.object_version_number
108     ,p_rec.attribute_category
109     ,p_rec.attribute1
110     ,p_rec.attribute2
111     ,p_rec.attribute3
112     ,p_rec.attribute4
113     ,p_rec.attribute5
114     ,p_rec.attribute6
115     ,p_rec.attribute7
116     ,p_rec.attribute8
117     ,p_rec.attribute9
118     ,p_rec.attribute10
119     ,p_rec.attribute11
120     ,p_rec.attribute12
121     ,p_rec.attribute13
122     ,p_rec.attribute14
123     ,p_rec.attribute15
124     ,p_rec.attribute16
125     ,p_rec.attribute17
126     ,p_rec.attribute18
127     ,p_rec.attribute19
128     ,p_rec.attribute20
129     ,p_rec.attribute21
130     ,p_rec.attribute22
131     ,p_rec.attribute23
132     ,p_rec.attribute24
133     ,p_rec.attribute25
134     ,p_rec.attribute26
135     ,p_rec.attribute27
136     ,p_rec.attribute28
137     ,p_rec.attribute29
138     ,p_rec.attribute30
139     ,p_rec.bld_blk_info_type_id
140     ,p_rec.data_set_id
141     )
142     returning time_attribute_id into p_rec.time_attribute_id;  --Fix for Bug#3062133
143 
144   if g_debug then
145   	hr_utility.set_location(' Leaving:'||l_proc, 10);
146   end if;
147 
148 exception
149   when hr_api.check_integrity_violated then
150     hxc_tat_shd.constraint_error
151       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
152   when hr_api.parent_integrity_violated then
153     hxc_tat_shd.constraint_error
154       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
155   when hr_api.unique_integrity_violated Then
156     hxc_tat_shd.constraint_error
157       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158   when others then
159     raise;
160 
161 end insert_dml;
162 
163 -- --------------------------------------------------------------------------
164 -- |------------------------------< pre_insert >----------------------------|
165 -- --------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 --   This private procedure contains any processing which is required before
170 --   the insert dml. Presently, if the entity has a corresponding primary
171 --   key which is maintained by an associating sequence, the primary key for
172 --   the entity will be populated with the next sequence value in
173 --   preparation for the insert dml.
174 --
175 -- Prerequisites:
176 --   This is an internal procedure which is called from the ins procedure.
177 --
178 -- In Parameters:
179 --   A Pl/Sql record structre.
180 --
181 -- Post Success:
182 --   processing continues.
183 --
184 -- Post Failure:
185 --   if an error has occurred, an error message and exception will be raised
186 --   but not handled.
187 --
188 -- Developer Implementation Notes:
189 --   Any pre-processing required before the insert dml is issued should be
190 --   coded within this procedure. As stated above, a good example is the
191 --   generation of a primary key number via a corresponding sequence.
192 --   It is important to note that any 3rd party maintenance should be reviewed
193 --   before placing in this procedure.
194 --
195 -- Access Status:
196 --   Internal Row Handler Use Only.
197 --
198 -- {end Of Comments}
199 -- --------------------------------------------------------------------------
200 procedure pre_insert
201   (p_rec  in out nocopy hxc_tat_shd.g_rec_type
202   ) is
203 
204 l_proc  varchar2(72) ;
205 --cursor c_sel1 is select hxc_time_attributes_s.nextval from dual;  --Fix for Bug#3062133
206 
207 begin
208 
209   if g_debug then
210   	l_proc := g_package||'pre_insert';
211   	hr_utility.set_location('Entering:'||l_proc, 5);
212   end if;
213 
214  -- Fix for Bug#3062133 starts
215 
216   --open c_sel1;
217   --  fetch c_sel1 into p_rec.time_attribute_id;
218   --close c_Sel1;
219 
220 -- Fix for Bug#3062133 ends
221 
222   if g_debug then
223   	hr_utility.set_location(' Leaving:'||l_proc, 10);
224   end if;
225 
226 end pre_insert;
227 
228 -- --------------------------------------------------------------------------
229 -- |-----------------------------< post_insert >----------------------------|
230 -- --------------------------------------------------------------------------
231 -- {Start Of Comments}
232 --
233 -- Description:
234 --   This private procedure contains any processing which is required after the
235 --   insert dml.
236 --
237 -- Prerequisites:
238 --   This is an internal procedure which is called from the ins procedure.
239 --
240 -- In Parameters:
241 --   A Pl/Sql record structre.
242 --
243 -- Post Success:
244 --   processing continues.
245 --
246 -- Post Failure:
247 --   if an error has occurred, an error message and exception will be raised
248 --   but not handled.
249 --
250 -- Developer Implementation Notes:
251 --   Any post-processing required after the insert dml is issued should be
252 --   coded within this procedure. It is important to note that any 3rd party
253 --   maintenance should be reviewed before placing in this procedure.
254 --
255 -- Access Status:
256 --   Internal Row Handler Use Only.
257 --
258 -- {end Of Comments}
259 -- --------------------------------------------------------------------------
260 procedure post_insert
261   (p_effective_date in date
262   ,p_rec            in hxc_tat_shd.g_rec_type
263   ) is
264 
265 l_proc  varchar2(72) ;
266 
267 begin
268 
269   if g_debug then
270   	l_proc := g_package||'post_insert';
271   	hr_utility.set_location('Entering:'||l_proc, 5);
272   end if;
273 
274   begin
275 /*
276     hxc_tat_rki.after_insert
277       (p_effective_date
278       => p_effective_date
279       ,p_time_attribute_id
280       => p_rec.time_attribute_id
281       ,p_object_version_number
282       => p_rec.object_version_number
283       ,p_attribute_category
284       => p_rec.attribute_category
285       ,p_attribute1
286       => p_rec.attribute1
287       ,p_attribute2
288       => p_rec.attribute2
289       ,p_attribute3
290       => p_rec.attribute3
291       ,p_attribute4
292       => p_rec.attribute4
293       ,p_attribute5
294       => p_rec.attribute5
295       ,p_attribute6
296       => p_rec.attribute6
297       ,p_attribute7
298       => p_rec.attribute7
299       ,p_attribute8
300       => p_rec.attribute8
301       ,p_attribute9
302       => p_rec.attribute9
303       ,p_attribute10
304       => p_rec.attribute10
305       ,p_attribute11
306       => p_rec.attribute11
307       ,p_attribute12
308       => p_rec.attribute12
309       ,p_attribute13
310       => p_rec.attribute13
311       ,p_attribute14
312       => p_rec.attribute14
313       ,p_attribute15
314       => p_rec.attribute15
315       ,p_attribute16
316       => p_rec.attribute16
317       ,p_attribute17
318       => p_rec.attribute17
319       ,p_attribute18
320       => p_rec.attribute18
321       ,p_attribute19
322       => p_rec.attribute19
323       ,p_attribute20
324       => p_rec.attribute20
325       ,p_attribute21
326       => p_rec.attribute21
327       ,p_attribute22
328       => p_rec.attribute22
329       ,p_attribute23
330       => p_rec.attribute23
331       ,p_attribute24
332       => p_rec.attribute24
333       ,p_attribute25
334       => p_rec.attribute25
335       ,p_attribute26
336       => p_rec.attribute26
337       ,p_attribute27
338       => p_rec.attribute27
339       ,p_attribute28
340       => p_rec.attribute28
341       ,p_attribute29
342       => p_rec.attribute29
343       ,p_attribute30
344       => p_rec.attribute30
345       ,p_bld_blk_info_type_id
346       => p_rec.bld_blk_info_type_id
347       );
348 */null;
349   exception
350     when hr_api.cannot_find_prog_unit then
351       hr_api.cannot_find_prog_unit_error
352         (p_module_name => 'HXC_TIME_ATTRIBUTES'
353         ,p_hook_type   => 'AI');
354 
355   end;
356 
357   if g_debug then
358   	hr_utility.set_location(' Leaving:'||l_proc, 10);
359   end if;
360 
361 end post_insert;
362 
363 -- --------------------------------------------------------------------------
364 -- |---------------------------------< ins >--------------------------------|
365 -- --------------------------------------------------------------------------
366 procedure ins
367   (p_effective_date in date
368   ,p_rec            in out nocopy hxc_tat_shd.g_rec_type
369   ) is
370 
371 l_proc  varchar2(72) ;
372 
373 begin
374   g_debug :=hr_utility.debug_enabled;
375   if g_debug then
376   	l_proc := g_package||'ins';
377   	hr_utility.set_location('Entering:'||l_proc, 5);
378   end if;
379 
380   -- call the supporting insert validate operations
381 
382   hxc_tat_bus.insert_validate
383     (p_effective_date
384     ,p_rec
385     );
386 
387   -- call the supporting pre-insert operation
388 
389   hxc_tat_ins.pre_insert(p_rec);
390 
391   -- insert the row
392 
393   hxc_tat_ins.insert_dml(p_rec);
394 
395   -- call the supporting post-insert operation
396 
397   hxc_tat_ins.post_insert
398     (p_effective_date
399     ,p_rec
400     );
401 
402   if g_debug then
403   	hr_utility.set_location('Leaving:'||l_proc, 20);
404   end if;
405 
406 end ins;
407 
408 -- --------------------------------------------------------------------------
409 -- |---------------------------------< ins >--------------------------------|
410 -- --------------------------------------------------------------------------
411 procedure ins
412   (p_effective_date                 in     date
413   ,p_attribute_category             in     varchar2 default null
414   ,p_attribute1                     in     varchar2 default null
415   ,p_attribute2                     in     varchar2 default null
416   ,p_attribute3                     in     varchar2 default null
417   ,p_attribute4                     in     varchar2 default null
418   ,p_attribute5                     in     varchar2 default null
419   ,p_attribute6                     in     varchar2 default null
420   ,p_attribute7                     in     varchar2 default null
421   ,p_attribute8                     in     varchar2 default null
422   ,p_attribute9                     in     varchar2 default null
423   ,p_attribute10                    in     varchar2 default null
424   ,p_attribute11                    in     varchar2 default null
425   ,p_attribute12                    in     varchar2 default null
426   ,p_attribute13                    in     varchar2 default null
427   ,p_attribute14                    in     varchar2 default null
428   ,p_attribute15                    in     varchar2 default null
429   ,p_attribute16                    in     varchar2 default null
430   ,p_attribute17                    in     varchar2 default null
431   ,p_attribute18                    in     varchar2 default null
432   ,p_attribute19                    in     varchar2 default null
433   ,p_attribute20                    in     varchar2 default null
434   ,p_attribute21                    in     varchar2 default null
435   ,p_attribute22                    in     varchar2 default null
436   ,p_attribute23                    in     varchar2 default null
437   ,p_attribute24                    in     varchar2 default null
438   ,p_attribute25                    in     varchar2 default null
439   ,p_attribute26                    in     varchar2 default null
440   ,p_attribute27                    in     varchar2 default null
441   ,p_attribute28                    in     varchar2 default null
442   ,p_attribute29                    in     varchar2 default null
443   ,p_attribute30                    in     varchar2 default null
444   ,p_bld_blk_info_type_id           in     number   default null
445   ,p_data_set_id                    in     number   default null
446   ,p_time_attribute_id                 out nocopy number
447   ,p_object_version_number             out nocopy number
448   ) is
449 
450 l_rec	  hxc_tat_shd.g_rec_type;
451 l_proc  varchar2(72) ;
452 
453 begin
454   g_debug :=hr_utility.debug_enabled;
455   if g_debug then
456   	l_proc := g_package||'ins';
457   	hr_utility.set_location('Entering:'||l_proc, 5);
458   end if;
459 
460   -- call conversion function to turn arguments into the p_rec structure.
461 
462   l_rec :=
463   hxc_tat_shd.convert_args
464     (null
465     ,null
466     ,p_attribute_category
467     ,p_attribute1
468     ,p_attribute2
469     ,p_attribute3
470     ,p_attribute4
471     ,p_attribute5
472     ,p_attribute6
473     ,p_attribute7
474     ,p_attribute8
475     ,p_attribute9
476     ,p_attribute10
477     ,p_attribute11
478     ,p_attribute12
479     ,p_attribute13
480     ,p_attribute14
481     ,p_attribute15
482     ,p_attribute16
483     ,p_attribute17
484     ,p_attribute18
485     ,p_attribute19
486     ,p_attribute20
487     ,p_attribute21
488     ,p_attribute22
489     ,p_attribute23
490     ,p_attribute24
491     ,p_attribute25
492     ,p_attribute26
493     ,p_attribute27
494     ,p_attribute28
495     ,p_attribute29
496     ,p_attribute30
497     ,p_bld_blk_info_type_id
498     ,p_data_set_id
499     );
500 
501   -- having converted the arguments into the hxc_tat_rec
502   -- plsql record structure we call the corresponding record business process.
503 
504   hxc_tat_ins.ins
505     (p_effective_date
506     ,l_rec
507     );
508 
509   -- as the primary key argument(s) are specified as an out we must set
510   -- these values.
511 
512   p_time_attribute_id := l_rec.time_attribute_id;
513   p_object_version_number := l_rec.object_version_number;
514 
515   if g_debug then
516   	hr_utility.set_location(' Leaving:'||l_proc, 10);
517   end if;
518 
519 end ins;
520 
521 end hxc_tat_ins;