DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TMT_INS

Source


1 Package Body ota_tmt_ins as
2 /* $Header: ottmtrhi.pkb 115.6 2002/11/26 17:09:48 hwinsor noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tmt_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 ota_tmt_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   --
64   --
65   -- Insert the row into: ota_tp_measurement_types
66   --
67   insert into ota_tp_measurement_types
68       (tp_measurement_type_id
69       ,tp_measurement_code
70       ,unit
71       ,reporting_sequence
72       ,budget_level
73       ,cost_level
74       ,many_budget_values_flag
75       ,item_type_usage_id
76       ,business_group_id
77       ,object_version_number
78       ,attribute_category
79       ,attribute1
80       ,attribute2
81       ,attribute3
82       ,attribute4
83       ,attribute5
84       ,attribute6
85       ,attribute7
86       ,attribute8
87       ,attribute9
88       ,attribute10
89       ,attribute11
90       ,attribute12
91       ,attribute13
92       ,attribute14
93       ,attribute15
94       ,attribute16
95       ,attribute17
96       ,attribute18
97       ,attribute19
98       ,attribute20
99       ,attribute21
100       ,attribute22
101       ,attribute23
102       ,attribute24
103       ,attribute25
104       ,attribute26
105       ,attribute27
106       ,attribute28
107       ,attribute29
108       ,attribute30
109       )
110   Values
111     (p_rec.tp_measurement_type_id
112     ,p_rec.tp_measurement_code
113     ,p_rec.unit
114     ,p_rec.reporting_sequence
115     ,p_rec.budget_level
116     ,p_rec.cost_level
117     ,p_rec.many_budget_values_flag
118     ,p_rec.item_type_usage_id
119     ,p_rec.business_group_id
120     ,p_rec.object_version_number
121     ,p_rec.attribute_category
122     ,p_rec.attribute1
123     ,p_rec.attribute2
124     ,p_rec.attribute3
125     ,p_rec.attribute4
126     ,p_rec.attribute5
127     ,p_rec.attribute6
128     ,p_rec.attribute7
129     ,p_rec.attribute8
130     ,p_rec.attribute9
131     ,p_rec.attribute10
132     ,p_rec.attribute11
133     ,p_rec.attribute12
134     ,p_rec.attribute13
135     ,p_rec.attribute14
136     ,p_rec.attribute15
137     ,p_rec.attribute16
138     ,p_rec.attribute17
139     ,p_rec.attribute18
140     ,p_rec.attribute19
141     ,p_rec.attribute20
142     ,p_rec.attribute21
143     ,p_rec.attribute22
144     ,p_rec.attribute23
145     ,p_rec.attribute24
146     ,p_rec.attribute25
147     ,p_rec.attribute26
148     ,p_rec.attribute27
149     ,p_rec.attribute28
150     ,p_rec.attribute29
151     ,p_rec.attribute30
152     );
153   --
154   --
155   --
156   hr_utility.set_location(' Leaving:'||l_proc, 10);
157 Exception
158   When hr_api.check_integrity_violated Then
159     -- A check constraint has been violated
160     --
161     ota_tmt_shd.constraint_error
162       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163   When hr_api.parent_integrity_violated Then
164     -- Parent integrity has been violated
165     --
166     ota_tmt_shd.constraint_error
167       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
168   When hr_api.unique_integrity_violated Then
169     -- Unique integrity has been violated
170     --
171     ota_tmt_shd.constraint_error
172       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
173   When Others Then
174     --
175     Raise;
176 End insert_dml;
177 --
178 -- ----------------------------------------------------------------------------
179 -- |------------------------------< pre_insert >------------------------------|
180 -- ----------------------------------------------------------------------------
181 -- {Start Of Comments}
182 --
183 -- Description:
184 --   This private procedure contains any processing which is required before
185 --   the insert dml. Presently, if the entity has a corresponding primary
186 --   key which is maintained by an associating sequence, the primary key for
187 --   the entity will be populated with the next sequence value in
188 --   preparation for the insert dml.
189 --
190 -- Prerequisites:
191 --   This is an internal procedure which is called from the ins procedure.
192 --
193 -- In Parameters:
194 --   A Pl/Sql record structre.
195 --
196 -- Post Success:
197 --   Processing continues.
198 --
199 -- Post Failure:
200 --   If an error has occurred, an error message and exception will be raised
201 --   but not handled.
202 --
203 -- Developer Implementation Notes:
204 --   Any pre-processing required before the insert dml is issued should be
205 --   coded within this procedure. As stated above, a good example is the
206 --   generation of a primary key number via a corresponding sequence.
207 --   It is important to note that any 3rd party maintenance should be reviewed
208 --   before placing in this procedure.
209 --
210 -- Access Status:
211 --   Internal Row Handler Use Only.
212 --
213 -- {End Of Comments}
214 -- ----------------------------------------------------------------------------
215 Procedure pre_insert
216   (p_rec  in out nocopy ota_tmt_shd.g_rec_type
217   ) is
218 --
219   l_proc  varchar2(72) := g_package||'pre_insert';
220 --
221   Cursor C_Sel1 is select ota_tp_measurement_types_s.nextval from sys.dual;
222 --
223 Begin
224   hr_utility.set_location('Entering:'||l_proc, 5);
225   --
226   --
227   -- Select the next sequence number
228   --
229   Open C_Sel1;
230   Fetch C_Sel1 Into p_rec.tp_measurement_type_id;
231   Close C_Sel1;
232   --
233   hr_utility.set_location(' Leaving:'||l_proc, 10);
234 End pre_insert;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |-----------------------------< post_insert >------------------------------|
238 -- ----------------------------------------------------------------------------
239 -- {Start Of Comments}
240 --
241 -- Description:
242 --   This private procedure contains any processing which is required after the
243 --   insert dml.
244 --
245 -- Prerequisites:
246 --   This is an internal procedure which is called from the ins procedure.
247 --
248 -- In Parameters:
249 --   A Pl/Sql record structre.
250 --
251 -- Post Success:
252 --   Processing continues.
253 --
254 -- Post Failure:
255 --   If an error has occurred, an error message and exception will be raised
256 --   but not handled.
257 --
258 -- Developer Implementation Notes:
259 --   Any post-processing required after the insert dml is issued should be
260 --   coded within this procedure. It is important to note that any 3rd party
261 --   maintenance should be reviewed before placing in this procedure.
262 --
263 -- Access Status:
264 --   Internal Row Handler Use Only.
265 --
266 -- {End Of Comments}
267 -- ----------------------------------------------------------------------------
268 Procedure post_insert
269   (p_effective_date               in date
270   ,p_rec                          in ota_tmt_shd.g_rec_type
271   ) is
272 --
273   l_proc  varchar2(72) := g_package||'post_insert';
274 --
275 Begin
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   begin
278     --
279     ota_tmt_rki.after_insert
280       (p_effective_date              => p_effective_date
281       ,p_tp_measurement_type_id
282       => p_rec.tp_measurement_type_id
283       ,p_tp_measurement_code
284       => p_rec.tp_measurement_code
285       ,p_unit
286       => p_rec.unit
287       ,p_reporting_sequence
288       => p_rec.reporting_sequence
289       ,p_budget_level
290       => p_rec.budget_level
291       ,p_cost_level
292       => p_rec.cost_level
293       ,p_many_budget_values_flag
294       => p_rec.many_budget_values_flag
295       ,p_item_type_usage_id
296       => p_rec.item_type_usage_id
297       ,p_business_group_id
298       => p_rec.business_group_id
299       ,p_object_version_number
300       => p_rec.object_version_number
301       ,p_attribute_category
302       => p_rec.attribute_category
303       ,p_attribute1
304       => p_rec.attribute1
305       ,p_attribute2
306       => p_rec.attribute2
307       ,p_attribute3
308       => p_rec.attribute3
309       ,p_attribute4
310       => p_rec.attribute4
311       ,p_attribute5
312       => p_rec.attribute5
313       ,p_attribute6
314       => p_rec.attribute6
315       ,p_attribute7
316       => p_rec.attribute7
317       ,p_attribute8
318       => p_rec.attribute8
319       ,p_attribute9
320       => p_rec.attribute9
321       ,p_attribute10
322       => p_rec.attribute10
323       ,p_attribute11
324       => p_rec.attribute11
325       ,p_attribute12
326       => p_rec.attribute12
327       ,p_attribute13
328       => p_rec.attribute13
329       ,p_attribute14
330       => p_rec.attribute14
331       ,p_attribute15
332       => p_rec.attribute15
333       ,p_attribute16
334       => p_rec.attribute16
335       ,p_attribute17
336       => p_rec.attribute17
337       ,p_attribute18
338       => p_rec.attribute18
339       ,p_attribute19
340       => p_rec.attribute19
341       ,p_attribute20
342       => p_rec.attribute20
343       ,p_attribute21
344       => p_rec.attribute21
345       ,p_attribute22
346       => p_rec.attribute22
347       ,p_attribute23
348       => p_rec.attribute23
349       ,p_attribute24
350       => p_rec.attribute24
351       ,p_attribute25
352       => p_rec.attribute25
353       ,p_attribute26
354       => p_rec.attribute26
355       ,p_attribute27
356       => p_rec.attribute27
357       ,p_attribute28
358       => p_rec.attribute28
359       ,p_attribute29
360       => p_rec.attribute29
361       ,p_attribute30
362       => p_rec.attribute30
363       );
364     --
365   exception
366     --
367     when hr_api.cannot_find_prog_unit then
368       --
369       hr_api.cannot_find_prog_unit_error
370         (p_module_name => 'OTA_TP_MEASUREMENT_TYPES'
371         ,p_hook_type   => 'AI');
372       --
373   end;
374   --
375   hr_utility.set_location(' Leaving:'||l_proc, 10);
376 End post_insert;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |---------------------------------< ins >----------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure ins
382   (p_effective_date               in date
383   ,p_rec                          in out nocopy ota_tmt_shd.g_rec_type
384   ) is
385 --
386   l_proc  varchar2(72) := g_package||'ins';
387 --
388 Begin
389   hr_utility.set_location('Entering:'||l_proc, 5);
390   --
391   -- Call the supporting insert validate operations
392   --
393   ota_tmt_bus.insert_validate
394      (p_effective_date
395      ,p_rec
396      );
397   --
398   -- Call the supporting pre-insert operation
399   --
400   ota_tmt_ins.pre_insert(p_rec);
401   --
402   -- Insert the row
403   --
404   ota_tmt_ins.insert_dml(p_rec);
405   --
406   -- Call the supporting post-insert operation
407   --
408   ota_tmt_ins.post_insert
409      (p_effective_date
410      ,p_rec
411      );
412   --
413   hr_utility.set_location('Leaving:'||l_proc, 20);
414 end ins;
415 --
416 -- ----------------------------------------------------------------------------
417 -- |---------------------------------< ins >----------------------------------|
418 -- ----------------------------------------------------------------------------
419 Procedure ins
420   (p_effective_date               in     date
421   ,p_tp_measurement_code            in     varchar2
422   ,p_unit                           in     varchar2
423   ,p_budget_level                   in     varchar2
424   ,p_cost_level                     in     varchar2
425   ,p_many_budget_values_flag        in     varchar2
426   ,p_business_group_id              in     number
427   ,p_reporting_sequence             in     number   default null
428   ,p_item_type_usage_id             in     number   default null
429   ,p_attribute_category             in     varchar2 default null
430   ,p_attribute1                     in     varchar2 default null
431   ,p_attribute2                     in     varchar2 default null
432   ,p_attribute3                     in     varchar2 default null
433   ,p_attribute4                     in     varchar2 default null
434   ,p_attribute5                     in     varchar2 default null
435   ,p_attribute6                     in     varchar2 default null
436   ,p_attribute7                     in     varchar2 default null
437   ,p_attribute8                     in     varchar2 default null
438   ,p_attribute9                     in     varchar2 default null
439   ,p_attribute10                    in     varchar2 default null
440   ,p_attribute11                    in     varchar2 default null
441   ,p_attribute12                    in     varchar2 default null
442   ,p_attribute13                    in     varchar2 default null
443   ,p_attribute14                    in     varchar2 default null
444   ,p_attribute15                    in     varchar2 default null
445   ,p_attribute16                    in     varchar2 default null
446   ,p_attribute17                    in     varchar2 default null
447   ,p_attribute18                    in     varchar2 default null
448   ,p_attribute19                    in     varchar2 default null
449   ,p_attribute20                    in     varchar2 default null
450   ,p_attribute21                    in     varchar2 default null
451   ,p_attribute22                    in     varchar2 default null
452   ,p_attribute23                    in     varchar2 default null
453   ,p_attribute24                    in     varchar2 default null
454   ,p_attribute25                    in     varchar2 default null
455   ,p_attribute26                    in     varchar2 default null
456   ,p_attribute27                    in     varchar2 default null
457   ,p_attribute28                    in     varchar2 default null
458   ,p_attribute29                    in     varchar2 default null
459   ,p_attribute30                    in     varchar2 default null
460   ,p_tp_measurement_type_id            out nocopy number
461   ,p_object_version_number             out nocopy number
462   ) is
463 --
464   l_rec	  ota_tmt_shd.g_rec_type;
465   l_proc  varchar2(72) := g_package||'ins';
466 --
467 Begin
468   hr_utility.set_location('Entering:'||l_proc, 5);
469   --
470   -- Call conversion function to turn arguments into the
471   -- p_rec structure.
472   --
473   l_rec :=
474   ota_tmt_shd.convert_args
475     (null
476     ,p_tp_measurement_code
477     ,p_unit
478     ,p_reporting_sequence
479     ,p_budget_level
480     ,p_cost_level
481     ,p_many_budget_values_flag
482     ,p_item_type_usage_id
483     ,p_business_group_id
484     ,null
485     ,p_attribute_category
486     ,p_attribute1
487     ,p_attribute2
488     ,p_attribute3
489     ,p_attribute4
490     ,p_attribute5
491     ,p_attribute6
492     ,p_attribute7
493     ,p_attribute8
494     ,p_attribute9
495     ,p_attribute10
496     ,p_attribute11
497     ,p_attribute12
498     ,p_attribute13
499     ,p_attribute14
500     ,p_attribute15
501     ,p_attribute16
502     ,p_attribute17
503     ,p_attribute18
504     ,p_attribute19
505     ,p_attribute20
506     ,p_attribute21
507     ,p_attribute22
508     ,p_attribute23
509     ,p_attribute24
510     ,p_attribute25
511     ,p_attribute26
512     ,p_attribute27
513     ,p_attribute28
514     ,p_attribute29
515     ,p_attribute30
516     );
517   --
518   -- Having converted the arguments into the ota_tmt_rec
519   -- plsql record structure we call the corresponding record business process.
520   --
521   ota_tmt_ins.ins
522      (p_effective_date
523      ,l_rec
524      );
525   --
526   -- As the primary key argument(s)
527   -- are specified as an OUT's we must set these values.
528   --
529   p_tp_measurement_type_id := l_rec.tp_measurement_type_id;
530   p_object_version_number := l_rec.object_version_number;
531   --
532   hr_utility.set_location(' Leaving:'||l_proc, 10);
533 End ins;
534 --
535 end ota_tmt_ins;