DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SHT_INS

Source


1 Package Body per_sht_ins as
2 /* $Header: peshtrhi.pkb 120.1 2011/04/28 09:50:48 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_sht_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 --   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 --   If a check, unique or parent integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 --   None.
41 --
42 -- Access Status:
43 --   Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy per_sht_shd.g_rec_type) is
48 --
49   l_proc  varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   p_rec.object_version_number := 1;  -- Initialise the object version
54   --
55   -- Insert the row into: per_shared_types
56   --
57   insert into per_shared_types
58   (	shared_type_id,
59 	business_group_id,
60 	shared_type_name,
61 	shared_type_code,
62 	system_type_cd,
63 	information1,
64 	information2,
65 	information3,
66 	information4,
67 	information5,
68 	information6,
69 	information7,
70 	information8,
71 	information9,
72 	information10,
73 	information11,
74 	information12,
75 	information13,
76 	information14,
77 	information15,
78 	information16,
79 	information17,
80 	information18,
81 	information19,
82 	information20,
83 	information21,
84 	information22,
85 	information23,
86 	information24,
87 	information25,
88 	information26,
89 	information27,
90 	information28,
91 	information29,
92 	information30,
93 	information_category,
94 	object_version_number,
95 	lookup_type
96   )
97   Values
98   (	p_rec.shared_type_id,
99 	p_rec.business_group_id,
100 	p_rec.shared_type_name,
101 	p_rec.shared_type_code,
102 	p_rec.system_type_cd,
103 	p_rec.information1,
104 	p_rec.information2,
105 	p_rec.information3,
106 	p_rec.information4,
107 	p_rec.information5,
108 	p_rec.information6,
109 	p_rec.information7,
110 	p_rec.information8,
111 	p_rec.information9,
112 	p_rec.information10,
113 	p_rec.information11,
114 	p_rec.information12,
115 	p_rec.information13,
116 	p_rec.information14,
117 	p_rec.information15,
118 	p_rec.information16,
119 	p_rec.information17,
120 	p_rec.information18,
121 	p_rec.information19,
122 	p_rec.information20,
123 	p_rec.information21,
127 	p_rec.information25,
124 	p_rec.information22,
125 	p_rec.information23,
126 	p_rec.information24,
128 	p_rec.information26,
129 	p_rec.information27,
130 	p_rec.information28,
131 	p_rec.information29,
132 	p_rec.information30,
133 	p_rec.information_category,
134 	p_rec.object_version_number,
135 	p_rec.lookup_type
136   );
137   --
138   hr_utility.set_location(' Leaving:'||l_proc, 10);
139 Exception
140   When hr_api.check_integrity_violated Then
141     -- A check constraint has been violated
142     per_sht_shd.constraint_error
143       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
144   When hr_api.parent_integrity_violated Then
145     -- Parent integrity has been violated
146     per_sht_shd.constraint_error
147       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148   When hr_api.unique_integrity_violated Then
149     -- Unique integrity has been violated
150     per_sht_shd.constraint_error
151       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
152   When Others Then
153     Raise;
154 End insert_dml;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< pre_insert >------------------------------|
158 -- ----------------------------------------------------------------------------
159 -- {Start Of Comments}
160 --
161 -- Description:
162 --   This private procedure contains any processing which is required before
163 --   the insert dml. Presently, if the entity has a corresponding primary
164 --   key which is maintained by an associating sequence, the primary key for
165 --   the entity will be populated with the next sequence value in
166 --   preparation for the insert dml.
167 --
168 -- Prerequisites:
169 --   This is an internal procedure which is called from the ins procedure.
170 --
171 -- In Parameters:
172 --   A Pl/Sql record structre.
173 --
174 -- Post Success:
175 --   Processing continues.
176 --
177 -- Post Failure:
178 --   If an error has occurred, an error message and exception will be raised
179 --   but not handled.
180 --
181 -- Developer Implementation Notes:
182 --   Any pre-processing required before the insert dml is issued should be
183 --   coded within this procedure. As stated above, a good example is the
184 --   generation of a primary key number via a corresponding sequence.
185 --   It is important to note that any 3rd party maintenance should be reviewed
186 --   before placing in this procedure.
187 --
188 -- Access Status:
189 --   Internal Row Handler Use Only.
190 --
191 -- {End Of Comments}
192 -- ----------------------------------------------------------------------------
193 Procedure pre_insert(p_rec  in out nocopy per_sht_shd.g_rec_type) is
194 --
195   l_proc  varchar2(72) := g_package||'pre_insert';
196 --
197   Cursor C_Sel1 is select per_shared_types_s.nextval from sys.dual;
198 --
199 Begin
200   hr_utility.set_location('Entering:'||l_proc, 5);
201   --
202   --
203   -- Select the next sequence number
204   --
205   Open C_Sel1;
206   Fetch C_Sel1 Into p_rec.shared_type_id;
207   Close C_Sel1;
208   --
209   hr_utility.set_location(' Leaving:'||l_proc, 10);
210 End pre_insert;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |-----------------------------< post_insert >------------------------------|
214 -- ----------------------------------------------------------------------------
215 -- {Start Of Comments}
216 --
217 -- Description:
218 --   This private procedure contains any processing which is required after the
219 --   insert dml.
220 --
221 -- Prerequisites:
222 --   This is an internal procedure which is called from the ins procedure.
223 --
224 -- In Parameters:
225 --   A Pl/Sql record structre.
226 --
227 -- Post Success:
228 --   Processing continues.
229 --
230 -- Post Failure:
231 --   If an error has occurred, an error message and exception will be raised
232 --   but not handled.
233 --
234 -- Developer Implementation Notes:
235 --   Any post-processing required after the insert dml is issued should be
236 --   coded within this procedure. It is important to note that any 3rd party
237 --   maintenance should be reviewed before placing in this procedure.
238 --
239 -- Access Status:
240 --   Internal Row Handler Use Only.
241 --
242 -- {End Of Comments}
243 -- ----------------------------------------------------------------------------
244 Procedure post_insert(
245 p_effective_date in date,p_rec in per_sht_shd.g_rec_type) is
246 --
247   l_proc  varchar2(72) := g_package||'post_insert';
248 --
249 Begin
250   hr_utility.set_location('Entering:'||l_proc, 5);
251 --
252   --
253   -- Start of API User Hook for post_insert.
254   --
255   begin
256     --
257     per_sht_rki.after_insert
258       (
259   p_shared_type_id                =>p_rec.shared_type_id
260  ,p_business_group_id             =>p_rec.business_group_id
261  ,p_shared_type_name              =>p_rec.shared_type_name
262  ,p_shared_type_code              =>p_rec.shared_type_code
263  ,p_system_type_cd                =>p_rec.system_type_cd
264  ,p_information1                  =>p_rec.information1
265  ,p_information2                  =>p_rec.information2
266  ,p_information3                  =>p_rec.information3
267  ,p_information4                  =>p_rec.information4
268  ,p_information5                  =>p_rec.information5
269  ,p_information6                  =>p_rec.information6
270  ,p_information7                  =>p_rec.information7
271  ,p_information8                  =>p_rec.information8
272  ,p_information9                  =>p_rec.information9
273  ,p_information10                 =>p_rec.information10
274  ,p_information11                 =>p_rec.information11
275  ,p_information12                 =>p_rec.information12
276  ,p_information13                 =>p_rec.information13
277  ,p_information14                 =>p_rec.information14
278  ,p_information15                 =>p_rec.information15
279  ,p_information16                 =>p_rec.information16
280  ,p_information17                 =>p_rec.information17
281  ,p_information18                 =>p_rec.information18
282  ,p_information19                 =>p_rec.information19
283  ,p_information20                 =>p_rec.information20
284  ,p_information21                 =>p_rec.information21
285  ,p_information22                 =>p_rec.information22
286  ,p_information23                 =>p_rec.information23
287  ,p_information24                 =>p_rec.information24
288  ,p_information25                 =>p_rec.information25
289  ,p_information26                 =>p_rec.information26
290  ,p_information27                 =>p_rec.information27
291  ,p_information28                 =>p_rec.information28
292  ,p_information29                 =>p_rec.information29
293  ,p_information30                 =>p_rec.information30
294  ,p_information_category          =>p_rec.information_category
295  ,p_object_version_number         =>p_rec.object_version_number
296  ,p_lookup_type                   =>p_rec.lookup_type
297  ,p_effective_date                =>p_effective_date
298       );
299     --
300   exception
301     --
302     when hr_api.cannot_find_prog_unit then
303       --
304       hr_api.cannot_find_prog_unit_error
305         (p_module_name => 'per_shared_types'
306         ,p_hook_type   => 'AI');
307       --
308   end;
309   --
310   -- End of API User Hook for post_insert.
311   --
312   --
313   hr_utility.set_location(' Leaving:'||l_proc, 10);
314 End post_insert;
315 --
316 -- ----------------------------------------------------------------------------
317 -- |---------------------------------< ins >----------------------------------|
318 -- ----------------------------------------------------------------------------
319 Procedure ins
320   (
321   p_effective_date in date,
322   p_rec        in out nocopy per_sht_shd.g_rec_type
323   ) is
324 --
325   l_proc  varchar2(72) := g_package||'ins';
326 --
327 Begin
328   hr_utility.set_location('Entering:'||l_proc, 5);
329   --
330   -- Call the supporting insert validate operations
331   --
332   per_sht_bus.insert_validate(p_rec
333   ,p_effective_date);
334   --
335   -- Call the supporting pre-insert operation
336   --
337   pre_insert(p_rec);
338   --
339   -- Insert the row
340   --
341   insert_dml(p_rec);
342   --
343   -- Call the supporting post-insert operation
344   --
345   post_insert(
346 p_effective_date,p_rec);
347 end ins;
348 --
349 -- ----------------------------------------------------------------------------
350 -- |---------------------------------< ins >----------------------------------|
351 -- ----------------------------------------------------------------------------
352 Procedure ins
353   (
354   p_effective_date in date,
355   p_shared_type_id               out nocopy number,
356   p_business_group_id            in number           default null,
357   p_shared_type_name             in varchar2,
358   p_shared_type_code             in varchar2,
359   p_system_type_cd               in varchar2,
360   p_information1                 in varchar2         default null,
361   p_information2                 in varchar2         default null,
362   p_information3                 in varchar2         default null,
363   p_information4                 in varchar2         default null,
364   p_information5                 in varchar2         default null,
365   p_information6                 in varchar2         default null,
366   p_information7                 in varchar2         default null,
367   p_information8                 in varchar2         default null,
368   p_information9                 in varchar2         default null,
369   p_information10                in varchar2         default null,
370   p_information11                in varchar2         default null,
371   p_information12                in varchar2         default null,
372   p_information13                in varchar2         default null,
373   p_information14                in varchar2         default null,
374   p_information15                in varchar2         default null,
375   p_information16                in varchar2         default null,
376   p_information17                in varchar2         default null,
377   p_information18                in varchar2         default null,
378   p_information19                in varchar2         default null,
379   p_information20                in varchar2         default null,
380   p_information21                in varchar2         default null,
381   p_information22                in varchar2         default null,
382   p_information23                in varchar2         default null,
383   p_information24                in varchar2         default null,
384   p_information25                in varchar2         default null,
385   p_information26                in varchar2         default null,
386   p_information27                in varchar2         default null,
387   p_information28                in varchar2         default null,
388   p_information29                in varchar2         default null,
389   p_information30                in varchar2         default null,
390   p_information_category         in varchar2         default null,
391   p_object_version_number        out nocopy number,
392   p_lookup_type                  in varchar2
393   ) is
394 --
395   l_rec	  per_sht_shd.g_rec_type;
396   l_proc  varchar2(72) := g_package||'ins';
397 --
398 Begin
399   hr_utility.set_location('Entering:'||l_proc, 5);
400   --
401   -- Call conversion function to turn arguments into the
402   -- p_rec structure.
403   --
404   l_rec :=
405   per_sht_shd.convert_args
406   (
407   null,
408   p_business_group_id,
409   p_shared_type_name,
410   p_shared_type_code,
411   p_system_type_cd,
412   p_information1,
413   p_information2,
414   p_information3,
415   p_information4,
416   p_information5,
417   p_information6,
418   p_information7,
419   p_information8,
420   p_information9,
421   p_information10,
422   p_information11,
423   p_information12,
424   p_information13,
425   p_information14,
426   p_information15,
427   p_information16,
428   p_information17,
429   p_information18,
430   p_information19,
431   p_information20,
432   p_information21,
433   p_information22,
434   p_information23,
435   p_information24,
436   p_information25,
437   p_information26,
438   p_information27,
439   p_information28,
440   p_information29,
441   p_information30,
442   p_information_category,
443   null,
444   p_lookup_type
445   );
446   --
447   -- Having converted the arguments into the per_sht_rec
448   -- plsql record structure we call the corresponding record business process.
449   --
450   ins(
451     p_effective_date,l_rec);
452   --
453   -- As the primary key argument(s)
454   -- are specified as an OUT's we must set these values.
455   --
456   p_shared_type_id := l_rec.shared_type_id;
457   p_object_version_number := l_rec.object_version_number;
458   --
459   hr_utility.set_location(' Leaving:'||l_proc, 10);
460 End ins;
461 --
462 end per_sht_ins;