DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ORI_INS

Source


1 Package Body hr_ori_ins as
2 /* $Header: hrorirhi.pkb 120.3.12010000.2 2008/08/06 08:45:57 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_ori_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_org_information_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_org_information_id  in  number) is
20 --
21   l_proc       varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   hr_ori_ins.g_org_information_id_i := p_org_information_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 -- ----------------------------------------------------------------------------
32 -- |------------------------------< insert_dml >------------------------------|
33 -- ----------------------------------------------------------------------------
34 -- {Start Of Comments}
35 --
36 -- Description:
37 --   This procedure controls the actual dml insert logic. The processing of
38 --   this procedure are as follows:
39 --   1) Initialise the object_version_number to 1 if the object_version_number
40 --      is defined as an attribute for this entity.
41 --   2) To set and unset the g_api_dml status as required (as we are about to
42 --      perform dml).
43 --   3) To insert the row into the schema.
44 --   4) To trap any constraint violations that may have occurred.
45 --   5) To raise any other errors.
46 --
47 -- Prerequisites:
48 --   This is an internal private procedure which must be called from the ins
49 --   procedure and must have all mandatory attributes set (except the
50 --   object_version_number which is initialised within this procedure).
51 --
52 -- In Parameters:
53 --   A Pl/Sql record structre.
54 --
55 -- Post Success:
56 --   The specified row will be inserted into the schema.
57 --
58 -- Post Failure:
59 --   On the insert dml failure it is important to note that we always reset the
60 --   g_api_dml status to false.
61 --   If a check, unique or parent integrity constraint violation is raised the
62 --   constraint_error procedure will be called.
63 --   If any other error is reported, the error will be raised after the
64 --   g_api_dml status is reset.
65 --
66 -- Developer Implementation Notes:
67 --   None.
68 --
69 -- Access Status:
70 --   Internal Row Handler Use Only.
71 --
72 -- {End Of Comments}
73 -- ----------------------------------------------------------------------------
74 Procedure insert_dml
75   (p_rec in out nocopy hr_ori_shd.g_rec_type
76   ) is
77 --
78   l_proc  varchar2(72) := g_package||'insert_dml';
79 --
80 Begin
81   hr_utility.set_location('Entering:'||l_proc, 5);
82   p_rec.object_version_number := 1;  -- Initialise the object version
83   --
84   hr_ori_shd.g_api_dml := true;  -- Set the api dml status
85   --
86   -- Insert the row into: hr_organization_information
87   --
88   insert into hr_organization_information
89       (org_information_id
90       ,org_information_context
91       ,organization_id
92       ,org_information1
93       ,org_information10
94       ,org_information11
95       ,org_information12
96       ,org_information13
97       ,org_information14
98       ,org_information15
99       ,org_information16
100       ,org_information17
101       ,org_information18
102       ,org_information19
103       ,org_information2
104       ,org_information20
105       ,org_information3
106       ,org_information4
107       ,org_information5
108       ,org_information6
109       ,org_information7
110       ,org_information8
111       ,org_information9
112       ,attribute_category
113       ,attribute1
114       ,attribute2
115       ,attribute3
116       ,attribute4
117       ,attribute5
118       ,attribute6
119       ,attribute7
120       ,attribute8
121       ,attribute9
122       ,attribute10
123       ,attribute11
124       ,attribute12
125       ,attribute13
126       ,attribute14
127       ,attribute15
128       ,attribute16
129       ,attribute17
130       ,attribute18
131       ,attribute19
132       ,attribute20
133       ,object_version_number
134       )
135   Values
136     (p_rec.org_information_id
137     ,p_rec.org_information_context
138     ,p_rec.organization_id
139     ,p_rec.org_information1
140     ,p_rec.org_information10
141     ,p_rec.org_information11
142     ,p_rec.org_information12
143     ,p_rec.org_information13
144     ,p_rec.org_information14
145     ,p_rec.org_information15
146     ,p_rec.org_information16
147     ,p_rec.org_information17
148     ,p_rec.org_information18
149     ,p_rec.org_information19
150     ,p_rec.org_information2
151     ,p_rec.org_information20
152     ,p_rec.org_information3
153     ,p_rec.org_information4
154     ,p_rec.org_information5
155     ,p_rec.org_information6
156     ,p_rec.org_information7
157     ,p_rec.org_information8
158     ,p_rec.org_information9
159     ,p_rec.attribute_category
160     ,p_rec.attribute1
161     ,p_rec.attribute2
162     ,p_rec.attribute3
163     ,p_rec.attribute4
164     ,p_rec.attribute5
165     ,p_rec.attribute6
166     ,p_rec.attribute7
167     ,p_rec.attribute8
168     ,p_rec.attribute9
169     ,p_rec.attribute10
170     ,p_rec.attribute11
171     ,p_rec.attribute12
172     ,p_rec.attribute13
173     ,p_rec.attribute14
174     ,p_rec.attribute15
175     ,p_rec.attribute16
176     ,p_rec.attribute17
177     ,p_rec.attribute18
178     ,p_rec.attribute19
179     ,p_rec.attribute20
180     ,p_rec.object_version_number
181     );
182   --
183   hr_ori_shd.g_api_dml := false;   -- Unset the api dml status
184   --
185   hr_utility.set_location(' Leaving:'||l_proc, 10);
186 Exception
187   When hr_api.check_integrity_violated Then
188     -- A check constraint has been violated
189     hr_ori_shd.g_api_dml := false;   -- Unset the api dml status
190     hr_ori_shd.constraint_error
191       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
192   When hr_api.parent_integrity_violated Then
193     -- Parent integrity has been violated
194     hr_ori_shd.g_api_dml := false;   -- Unset the api dml status
195     hr_ori_shd.constraint_error
196       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
197   When hr_api.unique_integrity_violated Then
198     -- Unique integrity has been violated
199     hr_ori_shd.g_api_dml := false;   -- Unset the api dml status
200     hr_ori_shd.constraint_error
201       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
202   When Others Then
203     hr_ori_shd.g_api_dml := false;   -- Unset the api dml status
204     Raise;
205 End insert_dml;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |------------------------------< pre_insert >------------------------------|
209 -- ----------------------------------------------------------------------------
210 -- {Start Of Comments}
211 --
212 -- Description:
213 --   This private procedure contains any processing which is required before
214 --   the insert dml. Presently, if the entity has a corresponding primary
215 --   key which is maintained by an associating sequence, the primary key for
216 --   the entity will be populated with the next sequence value in
217 --   preparation for the insert dml.
218 --
219 -- Prerequisites:
220 --   This is an internal procedure which is called from the ins procedure.
221 --
222 -- In Parameters:
223 --   A Pl/Sql record structre.
224 --
225 -- Post Success:
226 --   Processing continues.
227 --
228 -- Post Failure:
229 --   If an error has occurred, an error message and exception will be raised
230 --   but not handled.
231 --
232 -- Developer Implementation Notes:
233 --   Any pre-processing required before the insert dml is issued should be
234 --   coded within this procedure. As stated above, a good example is the
235 --   generation of a primary key number via a corresponding sequence.
236 --   It is important to note that any 3rd party maintenance should be reviewed
237 --   before placing in this procedure.
238 --
239 -- Access Status:
240 --   Internal Row Handler Use Only.
241 --
242 -- {End Of Comments}
243 -- ----------------------------------------------------------------------------
244 Procedure pre_insert
245   (p_rec  in out nocopy hr_ori_shd.g_rec_type
246   ) is
247 --
248   l_proc  varchar2(72) := g_package||'pre_insert';
249 --
250   Cursor C_Sel1 is select hr_organization_information_s.nextval from sys.dual;
251 --
252 Begin
253   hr_utility.set_location('Entering:'||l_proc, 5);
254   --
255   --
256   -- Select the next sequence number
257   --
258   Open C_Sel1;
259   Fetch C_Sel1 Into p_rec.org_information_id;
260   Close C_Sel1;
261   --
262   hr_utility.set_location(' Leaving:'||l_proc, 10);
263 End pre_insert;
264 --
265 -- ----------------------------------------------------------------------------
266 -- |-----------------------------< post_insert >------------------------------|
267 -- ----------------------------------------------------------------------------
268 -- {Start Of Comments}
269 --
270 -- Description:
271 --   This private procedure contains any processing which is required after the
272 --   insert dml.
273 --
274 -- Prerequisites:
275 --   This is an internal procedure which is called from the ins procedure.
276 --
277 -- In Parameters:
278 --   A Pl/Sql record structre.
279 --
280 -- Post Success:
281 --   Processing continues.
282 --
283 -- Post Failure:
284 --   If an error has occurred, an error message and exception will be raised
285 --   but not handled.
286 --
287 -- Developer Implementation Notes:
288 --   Any post-processing required after the insert dml is issued should be
289 --   coded within this procedure. It is important to note that any 3rd party
290 --   maintenance should be reviewed before placing in this procedure.
291 --
292 -- Access Status:
293 --   Internal Row Handler Use Only.
294 --
295 -- {End Of Comments}
296 -- ----------------------------------------------------------------------------
297 Procedure post_insert
298   (p_effective_date               in date
299   ,p_rec                          in hr_ori_shd.g_rec_type
300   ) is
301 --
302   l_proc  varchar2(72) := g_package||'post_insert';
303 --
304 Begin
305   hr_utility.set_location('Entering:'||l_proc, 5);
306   begin
307     --
308     hr_ori_rki.after_insert
309       (p_effective_date              => p_effective_date
310       ,p_org_information_id
311       => p_rec.org_information_id
312       ,p_org_information_context
313       => p_rec.org_information_context
314       ,p_organization_id
315       => p_rec.organization_id
316       ,p_org_information1
317       => p_rec.org_information1
318       ,p_org_information10
319       => p_rec.org_information10
320       ,p_org_information11
321       => p_rec.org_information11
322       ,p_org_information12
323       => p_rec.org_information12
324       ,p_org_information13
325       => p_rec.org_information13
326       ,p_org_information14
327       => p_rec.org_information14
328       ,p_org_information15
329       => p_rec.org_information15
330       ,p_org_information16
331       => p_rec.org_information16
332       ,p_org_information17
333       => p_rec.org_information17
334       ,p_org_information18
335       => p_rec.org_information18
336       ,p_org_information19
337       => p_rec.org_information19
338       ,p_org_information2
339       => p_rec.org_information2
340       ,p_org_information20
341       => p_rec.org_information20
342       ,p_org_information3
343       => p_rec.org_information3
344       ,p_org_information4
345       => p_rec.org_information4
346       ,p_org_information5
347       => p_rec.org_information5
348       ,p_org_information6
349       => p_rec.org_information6
350       ,p_org_information7
351       => p_rec.org_information7
352       ,p_org_information8
353       => p_rec.org_information8
354       ,p_org_information9
355       => p_rec.org_information9
356       ,p_attribute_category
357       => p_rec.attribute_category
358       ,p_attribute1
359       => p_rec.attribute1
360       ,p_attribute2
361       => p_rec.attribute2
362       ,p_attribute3
363       => p_rec.attribute3
364       ,p_attribute4
365       => p_rec.attribute4
366       ,p_attribute5
367       => p_rec.attribute5
368       ,p_attribute6
369       => p_rec.attribute6
370       ,p_attribute7
371       => p_rec.attribute7
372       ,p_attribute8
373       => p_rec.attribute8
374       ,p_attribute9
375       => p_rec.attribute9
376       ,p_attribute10
377       => p_rec.attribute10
378       ,p_attribute11
379       => p_rec.attribute11
380       ,p_attribute12
381       => p_rec.attribute12
382       ,p_attribute13
383       => p_rec.attribute13
384       ,p_attribute14
385       => p_rec.attribute14
386       ,p_attribute15
387       => p_rec.attribute15
388       ,p_attribute16
389       => p_rec.attribute16
390       ,p_attribute17
391       => p_rec.attribute17
392       ,p_attribute18
393       => p_rec.attribute18
394       ,p_attribute19
395       => p_rec.attribute19
396       ,p_attribute20
397       => p_rec.attribute20
398       ,p_object_version_number
399       => p_rec.object_version_number
400       );
401     --
402   exception
403     --
404     when hr_api.cannot_find_prog_unit then
405       --
406       hr_api.cannot_find_prog_unit_error
407         (p_module_name => 'HR_ORGANIZATION_INFORMATION'
408         ,p_hook_type   => 'AI');
409       --
410   end;
411   --
412   hr_utility.set_location(' Leaving:'||l_proc, 10);
413 End post_insert;
414 --
415 -- ----------------------------------------------------------------------------
416 -- |---------------------------------< ins >----------------------------------|
417 -- ----------------------------------------------------------------------------
418 Procedure ins
419   (p_effective_date               in date
420   ,p_rec                          in out nocopy hr_ori_shd.g_rec_type
421   ) is
422 --
423   l_proc  varchar2(72) := g_package||'ins';
424 --
425 Begin
426   hr_utility.set_location('Entering:'||l_proc, 5);
427   --
428   -- Call the supporting insert validate operations
429   --
430   hr_ori_bus.insert_validate
431      (p_effective_date
432      ,p_rec
433      );
434   --
435   -- Call the supporting pre-insert operation
436   --
437   hr_ori_ins.pre_insert(p_rec);
438   --
439   -- Insert the row
440   --
441   hr_ori_ins.insert_dml(p_rec);
442   --
443   -- Call the supporting post-insert operation
444   --
445   hr_ori_ins.post_insert
446      (p_effective_date
447      ,p_rec
448      );
449   --
450   hr_utility.set_location('Leaving:'||l_proc, 20);
451 end ins;
452 --
453 -- ----------------------------------------------------------------------------
454 -- |---------------------------------< ins >----------------------------------|
455 -- ----------------------------------------------------------------------------
456 Procedure ins
457   (p_effective_date               in     date
458   ,p_org_information_context        in     varchar2
459   ,p_organization_id                in     number
460   ,p_org_information1               in     varchar2 -- default null -- r115.21
461   ,p_org_information10              in     varchar2 -- default null -- r115.21
462   ,p_org_information11              in     varchar2 -- default null -- r115.21
463   ,p_org_information12              in     varchar2 -- default null -- r115.21
464   ,p_org_information13              in     varchar2 -- default null -- r115.21
465   ,p_org_information14              in     varchar2 -- default null -- r115.21
466   ,p_org_information15              in     varchar2 -- default null -- r115.21
467   ,p_org_information16              in     varchar2 -- default null -- r115.21
468   ,p_org_information17              in     varchar2 -- default null -- r115.21
469   ,p_org_information18              in     varchar2 -- default null -- r115.21
470   ,p_org_information19              in     varchar2 -- default null -- r115.21
471   ,p_org_information2               in     varchar2 -- default null -- r115.21
472   ,p_org_information20              in     varchar2 -- default null -- r115.21
473   ,p_org_information3               in     varchar2 -- default null -- r115.21
474   ,p_org_information4               in     varchar2 -- default null -- r115.21
475   ,p_org_information5               in     varchar2 -- default null -- r115.21
476   ,p_org_information6               in     varchar2 -- default null -- r115.21
477   ,p_org_information7               in     varchar2 -- default null -- r115.21
478   ,p_org_information8               in     varchar2 -- default null -- r115.21
479   ,p_org_information9               in     varchar2 -- default null -- r115.21
480   ,p_attribute_category             in     varchar2 -- default null -- r115.21
481   ,p_attribute1                     in     varchar2 -- default null -- r115.21
482   ,p_attribute2                     in     varchar2 -- default null -- r115.21
483   ,p_attribute3                     in     varchar2 -- default null -- r115.21
484   ,p_attribute4                     in     varchar2 -- default null -- r115.21
485   ,p_attribute5                     in     varchar2 -- default null -- r115.21
486   ,p_attribute6                     in     varchar2 -- default null -- r115.21
487   ,p_attribute7                     in     varchar2 -- default null -- r115.21
488   ,p_attribute8                     in     varchar2 -- default null -- r115.21
489   ,p_attribute9                     in     varchar2 -- default null -- r115.21
490   ,p_attribute10                    in     varchar2 -- default null -- r115.21
491   ,p_attribute11                    in     varchar2 -- default null -- r115.21
492   ,p_attribute12                    in     varchar2 -- default null -- r115.21
493   ,p_attribute13                    in     varchar2 -- default null -- r115.21
494   ,p_attribute14                    in     varchar2 -- default null -- r115.21
495   ,p_attribute15                    in     varchar2 -- default null -- r115.21
496   ,p_attribute16                    in     varchar2 -- default null -- r115.21
497   ,p_attribute17                    in     varchar2 -- default null -- r115.21
498   ,p_attribute18                    in     varchar2 -- default null -- r115.21
499   ,p_attribute19                    in     varchar2 -- default null -- r115.21
500   ,p_attribute20                    in     varchar2 -- default null -- r115.21
501   ,p_org_information_id                out nocopy number
502   ,p_object_version_number             out nocopy number
503   ) is
504 --
505   l_rec    hr_ori_shd.g_rec_type;
506   l_proc  varchar2(72) := g_package||'ins';
507 --
508 Begin
509   hr_utility.set_location('Entering:'||l_proc, 5);
510   --
511   -- Call conversion function to turn arguments into the
512   -- p_rec structure.
513   --
514   l_rec :=
515   hr_ori_shd.convert_args
516     (null
517     ,p_org_information_context
518     ,p_organization_id
519     ,p_org_information1
520     ,p_org_information10
521     ,p_org_information11
522     ,p_org_information12
523     ,p_org_information13
524     ,p_org_information14
525     ,p_org_information15
526     ,p_org_information16
527     ,p_org_information17
528     ,p_org_information18
529     ,p_org_information19
530     ,p_org_information2
531     ,p_org_information20
532     ,p_org_information3
533     ,p_org_information4
534     ,p_org_information5
535     ,p_org_information6
536     ,p_org_information7
537     ,p_org_information8
538     ,p_org_information9
539     ,null
540     ,null
541     ,null
542     ,null
543     ,p_attribute_category
544     ,p_attribute1
545     ,p_attribute2
546     ,p_attribute3
547     ,p_attribute4
548     ,p_attribute5
549     ,p_attribute6
550     ,p_attribute7
551     ,p_attribute8
552     ,p_attribute9
553     ,p_attribute10
554     ,p_attribute11
555     ,p_attribute12
556     ,p_attribute13
557     ,p_attribute14
558     ,p_attribute15
559     ,p_attribute16
560     ,p_attribute17
561     ,p_attribute18
562     ,p_attribute19
563     ,p_attribute20
564     ,null
565     );
566   --
567   -- Having converted the arguments into the hr_ori_rec
568   -- plsql record structure we call the corresponding record business process.
569   --
570   hr_ori_ins.ins
571      (p_effective_date
572      ,l_rec
573      );
574   --
575   -- As the primary key argument(s)
576   -- are specified as an OUT's we must set these values.
577   --
578   p_org_information_id := l_rec.org_information_id;
579   p_object_version_number := l_rec.object_version_number;
580   --
581   hr_utility.set_location(' Leaving:'||l_proc, 10);
582 End ins;
583 --
584 end hr_ori_ins;