DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PDM_INS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_pdm_ins as
2 /* $Header: pepdmrhi.pkb 115.8 2002/12/09 14:33:06 pkakar ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pdm_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 insert the row into the schema.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) 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_pdm_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_person_dlvry_methods
56   --
57   insert into per_person_dlvry_methods
58   (	delivery_method_id,
59         date_start,
60         date_end,
61 	person_id,
62 	comm_dlvry_method,
63 	preferred_flag,
64 	object_version_number,
65 	request_id,
66 	program_update_date,
67 	program_application_id,
68 	program_id,
69 	attribute_category,
70 	attribute1,
71 	attribute2,
72 	attribute3,
73 	attribute4,
74 	attribute5,
75 	attribute6,
76 	attribute7,
77 	attribute8,
78 	attribute9,
79 	attribute10,
80 	attribute11,
81 	attribute12,
82 	attribute13,
83 	attribute14,
84 	attribute15,
85 	attribute16,
86 	attribute17,
87 	attribute18,
88 	attribute19,
89 	attribute20
90   )
91   Values
92   (	p_rec.delivery_method_id,
93         p_rec.date_start,
94         p_rec.date_end,
95 	p_rec.person_id,
96 	p_rec.comm_dlvry_method,
97 	p_rec.preferred_flag,
98 	p_rec.object_version_number,
99 	p_rec.request_id,
100 	p_rec.program_update_date,
101 	p_rec.program_application_id,
102 	p_rec.program_id,
103 	p_rec.attribute_category,
104 	p_rec.attribute1,
105 	p_rec.attribute2,
106 	p_rec.attribute3,
107 	p_rec.attribute4,
108 	p_rec.attribute5,
109 	p_rec.attribute6,
110 	p_rec.attribute7,
111 	p_rec.attribute8,
112 	p_rec.attribute9,
113 	p_rec.attribute10,
114 	p_rec.attribute11,
115 	p_rec.attribute12,
116 	p_rec.attribute13,
117 	p_rec.attribute14,
118 	p_rec.attribute15,
119 	p_rec.attribute16,
120 	p_rec.attribute17,
121 	p_rec.attribute18,
122 	p_rec.attribute19,
123 	p_rec.attribute20
124   );
125   --
126   hr_utility.set_location(' Leaving:'||l_proc, 10);
127 Exception
128   When hr_api.check_integrity_violated Then
129     -- A check constraint has been violated
130     per_pdm_shd.constraint_error
131       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
132   When hr_api.parent_integrity_violated Then
133     -- Parent integrity has been violated
134     per_pdm_shd.constraint_error
135       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
136   When hr_api.unique_integrity_violated Then
137     -- Unique integrity has been violated
138     per_pdm_shd.constraint_error
139       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
140   When Others Then
141     Raise;
142 End insert_dml;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |------------------------------< pre_insert >------------------------------|
146 -- ----------------------------------------------------------------------------
147 -- {Start Of Comments}
148 --
149 -- Description:
150 --   This private procedure contains any processing which is required before
151 --   the insert dml. Presently, if the entity has a corresponding primary
155 --
152 --   key which is maintained by an associating sequence, the primary key for
153 --   the entity will be populated with the next sequence value in
154 --   preparation for the insert dml.
156 -- Prerequisites:
157 --   This is an internal procedure which is called from the ins procedure.
158 --
159 -- In Parameters:
160 --   A Pl/Sql record structre.
161 --
162 -- Post Success:
163 --   Processing continues.
164 --
165 -- Post Failure:
166 --   If an error has occurred, an error message and exception will be raised
167 --   but not handled.
168 --
169 -- Developer Implementation Notes:
170 --   Any pre-processing required before the insert dml is issued should be
171 --   coded within this procedure. As stated above, a good example is the
172 --   generation of a primary key number via a corresponding sequence.
173 --   It is important to note that any 3rd party maintenance should be reviewed
174 --   before placing in this procedure.
175 --
176 -- Access Status:
177 --   Internal Row Handler Use Only.
178 --
179 -- {End Of Comments}
180 -- ----------------------------------------------------------------------------
181 Procedure pre_insert(p_rec  in out nocopy per_pdm_shd.g_rec_type) is
182 --
183   l_proc  varchar2(72) := g_package||'pre_insert';
184 --
185   Cursor C_Sel1 is select per_person_dlvry_methods_s.nextval from sys.dual;
186 --
187 Begin
188   hr_utility.set_location('Entering:'||l_proc, 5);
189   --
190   --
191   -- Select the next sequence number
192   --
193   Open C_Sel1;
194   Fetch C_Sel1 Into p_rec.delivery_method_id;
195   Close C_Sel1;
196   --
197   hr_utility.set_location(' Leaving:'||l_proc, 10);
198 End pre_insert;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |-----------------------------< post_insert >------------------------------|
202 -- ----------------------------------------------------------------------------
203 -- {Start Of Comments}
204 --
205 -- Description:
206 --   This private procedure contains any processing which is required after the
207 --   insert dml.
208 --
209 -- Prerequisites:
210 --   This is an internal procedure which is called from the ins procedure.
211 --
212 -- In Parameters:
213 --   A Pl/Sql record structre.
214 --
215 -- Post Success:
216 --   Processing continues.
217 --
218 -- Post Failure:
219 --   If an error has occurred, an error message and exception will be raised
220 --   but not handled.
221 --
222 -- Developer Implementation Notes:
223 --   Any post-processing required after the insert dml is issued should be
224 --   coded within this procedure. It is important to note that any 3rd party
225 --   maintenance should be reviewed before placing in this procedure.
226 --
227 -- Access Status:
228 --   Internal Row Handler Use Only.
229 --
230 -- {End Of Comments}
231 -- ----------------------------------------------------------------------------
232 Procedure post_insert(
233 p_effective_date in date,p_rec in per_pdm_shd.g_rec_type) is
234 --
235   l_proc  varchar2(72) := g_package||'post_insert';
236 --
237 Begin
238   hr_utility.set_location('Entering:'||l_proc, 5);
239 --
240   --
241   -- Start of API User Hook for post_insert.
242   --
243   begin
244     --
245     per_pdm_rki.after_insert
246       (
247   p_delivery_method_id            =>p_rec.delivery_method_id
248  ,p_date_start                    =>p_rec.date_start
249  ,p_date_end                      =>p_rec.date_end
250  ,p_person_id                     =>p_rec.person_id
251  ,p_comm_dlvry_method             =>p_rec.comm_dlvry_method
252  ,p_preferred_flag                =>p_rec.preferred_flag
253  ,p_object_version_number         =>p_rec.object_version_number
254  ,p_request_id                    =>p_rec.request_id
255  ,p_program_update_date           =>p_rec.program_update_date
256  ,p_program_application_id        =>p_rec.program_application_id
257  ,p_program_id                    =>p_rec.program_id
258  ,p_attribute_category            =>p_rec.attribute_category
259  ,p_attribute1                    =>p_rec.attribute1
260  ,p_attribute2                    =>p_rec.attribute2
261  ,p_attribute3                    =>p_rec.attribute3
262  ,p_attribute4                    =>p_rec.attribute4
263  ,p_attribute5                    =>p_rec.attribute5
264  ,p_attribute6                    =>p_rec.attribute6
265  ,p_attribute7                    =>p_rec.attribute7
266  ,p_attribute8                    =>p_rec.attribute8
267  ,p_attribute9                    =>p_rec.attribute9
268  ,p_attribute10                   =>p_rec.attribute10
269  ,p_attribute11                   =>p_rec.attribute11
270  ,p_attribute12                   =>p_rec.attribute12
271  ,p_attribute13                   =>p_rec.attribute13
272  ,p_attribute14                   =>p_rec.attribute14
273  ,p_attribute15                   =>p_rec.attribute15
274  ,p_attribute16                   =>p_rec.attribute16
275  ,p_attribute17                   =>p_rec.attribute17
276  ,p_attribute18                   =>p_rec.attribute18
277  ,p_attribute19                   =>p_rec.attribute19
278  ,p_attribute20                   =>p_rec.attribute20
279  ,p_effective_date                =>p_effective_date
280       );
281     --
282   exception
283     --
284     when hr_api.cannot_find_prog_unit then
285       --
286       hr_api.cannot_find_prog_unit_error
287         (p_module_name => 'PER_PERSON_DLVRY_METHODS'
288         ,p_hook_type   => 'AI');
289       --
290   end;
291   --
292   -- End of API User Hook for post_insert.
293   --
297 --
294   --
295   hr_utility.set_location(' Leaving:'||l_proc, 10);
296 End post_insert;
298 -- ----------------------------------------------------------------------------
299 -- |---------------------------------< ins >----------------------------------|
300 -- ----------------------------------------------------------------------------
301 Procedure ins
302   (
303   p_effective_date in date,
304   p_rec        in out nocopy per_pdm_shd.g_rec_type
305   ) is
306 --
307   l_proc  varchar2(72) := g_package||'ins';
308 --
309 Begin
310   hr_utility.set_location('Entering:'||l_proc, 5);
311   --
312   -- Call the supporting insert validate operations
313   --
314   per_pdm_bus.insert_validate(p_rec, p_effective_date);
315   --
316   -- Call the supporting pre-insert operation
317   --
318   pre_insert(p_rec);
319   --
320   -- Insert the row
321   --
322   insert_dml(p_rec);
323   --
324   -- Call the supporting post-insert operation
325   --
326   post_insert( p_effective_date,p_rec);
327 end ins;
328 --
329 -- ----------------------------------------------------------------------------
330 -- |---------------------------------< ins >----------------------------------|
331 -- ----------------------------------------------------------------------------
332 Procedure ins
333   (
334   p_effective_date in date,
335   p_delivery_method_id           out nocopy number,
336   p_date_start                   in date,
337   p_date_end                     in date             default hr_api.g_eot,
338   p_person_id                    in number,
339   p_comm_dlvry_method            in varchar2,
340   p_preferred_flag               in varchar2         default null,
341   p_object_version_number        out nocopy number,
342   p_request_id                   in number           default null,
343   p_program_update_date          in date             default null,
344   p_program_application_id       in number           default null,
345   p_program_id                   in number           default null,
346   p_attribute_category           in varchar2         default null,
347   p_attribute1                   in varchar2         default null,
348   p_attribute2                   in varchar2         default null,
349   p_attribute3                   in varchar2         default null,
350   p_attribute4                   in varchar2         default null,
351   p_attribute5                   in varchar2         default null,
352   p_attribute6                   in varchar2         default null,
353   p_attribute7                   in varchar2         default null,
354   p_attribute8                   in varchar2         default null,
355   p_attribute9                   in varchar2         default null,
356   p_attribute10                  in varchar2         default null,
357   p_attribute11                  in varchar2         default null,
358   p_attribute12                  in varchar2         default null,
359   p_attribute13                  in varchar2         default null,
360   p_attribute14                  in varchar2         default null,
361   p_attribute15                  in varchar2         default null,
362   p_attribute16                  in varchar2         default null,
363   p_attribute17                  in varchar2         default null,
364   p_attribute18                  in varchar2         default null,
365   p_attribute19                  in varchar2         default null,
366   p_attribute20                  in varchar2         default null
367   ) is
368 --
369   l_rec	  per_pdm_shd.g_rec_type;
370   l_proc  varchar2(72) := g_package||'ins';
371 --
372 Begin
373   hr_utility.set_location('Entering:'||l_proc, 5);
374   --
375   -- Call conversion function to turn arguments into the
376   -- p_rec structure.
377   --
378   l_rec :=
379   per_pdm_shd.convert_args
380   (
381   null,
382   p_date_start,
383   p_date_end,
384   p_person_id,
385   p_comm_dlvry_method,
386   p_preferred_flag,
387   null,
388   p_request_id,
389   p_program_update_date,
390   p_program_application_id,
391   p_program_id,
392   p_attribute_category,
393   p_attribute1,
394   p_attribute2,
395   p_attribute3,
396   p_attribute4,
397   p_attribute5,
398   p_attribute6,
399   p_attribute7,
400   p_attribute8,
401   p_attribute9,
402   p_attribute10,
403   p_attribute11,
404   p_attribute12,
405   p_attribute13,
406   p_attribute14,
407   p_attribute15,
408   p_attribute16,
409   p_attribute17,
410   p_attribute18,
411   p_attribute19,
412   p_attribute20
413   );
414   --
415   -- Having converted the arguments into the per_pdm_rec
416   -- plsql record structure we call the corresponding record business process.
417   --
418   ins(
419     p_effective_date,l_rec);
420   --
421   -- As the primary key argument(s)
422   -- are specified as an OUT's we must set these values.
423   --
424   p_delivery_method_id := l_rec.delivery_method_id;
425   p_object_version_number := l_rec.object_version_number;
426   --
427   hr_utility.set_location(' Leaving:'||l_proc, 10);
428 End ins;
429 --
430 end per_pdm_ins;