DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_INC_DEL

Source


1 Package Body per_inc_del as
2 /* $Header: peincrhi.pkb 115.29 2003/08/31 00:49:48 kjagadee noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_inc_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml delete logic. The functions of
17 --   this procedure are as follows:
18 --   1) To set and unset the g_api_dml status as required (as we are about to
19 --      perform dml).
20 --   2) To delete the specified row from the schema using the primary key in
21 --      the predicates.
22 --   3) To trap any constraint violations that may have occurred.
23 --   4) To raise any other errors.
24 --
25 -- Prerequisites:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be delete from the schema.
34 --
35 -- Post Failure:
36 --   On the delete dml failure it is important to note that we always reset the
37 --   g_api_dml status to false.
38 --   If a child 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 delete_dml
52   (p_rec in per_inc_shd.g_rec_type
53   ) is
54 --
55   l_proc  varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   --
60   --
61   --
62   -- Delete the per_work_incidents row.
63   --
64   delete from per_work_incidents
65   where incident_id = p_rec.incident_id;
66   --
67   --
68   --
69   hr_utility.set_location(' Leaving:'||l_proc, 10);
70 --
71 Exception
72   When hr_api.child_integrity_violated then
73     -- Child integrity has been violated
74     --
75     per_inc_shd.constraint_error
76       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
77   When Others Then
78     --
79     Raise;
80 End delete_dml;
81 --
82 -- ----------------------------------------------------------------------------
83 -- |------------------------------< pre_delete >------------------------------|
84 -- ----------------------------------------------------------------------------
85 -- {Start Of Comments}
86 --
87 -- Description:
88 --   This private procedure contains any processing which is required before
89 --   the delete dml.
90 --
91 -- Prerequisites:
92 --   This is an internal procedure which is called from the del procedure.
93 --
94 -- In Parameters:
95 --   A Pl/Sql record structre.
96 --
97 -- Post Success:
98 --   Processing continues.
99 --
100 -- Post Failure:
101 --   If an error has occurred, an error message and exception will be raised
102 --   but not handled.
103 --
104 -- Developer Implementation Notes:
105 --   Any pre-processing required before the delete dml is issued should be
106 --   coded within this procedure. It is important to note that any 3rd party
107 --   maintenance should be reviewed before placing in this procedure.
108 --
109 -- Access Status:
110 --   Internal Row Handler Use Only.
111 --
112 -- {End Of Comments}
113 -- ----------------------------------------------------------------------------
114 Procedure pre_delete(p_rec in per_inc_shd.g_rec_type) is
115 --
116   l_proc  varchar2(72) := g_package||'pre_delete';
117 --
118 Begin
119   hr_utility.set_location('Entering:'||l_proc, 5);
120   --
121   hr_utility.set_location(' Leaving:'||l_proc, 10);
122 End pre_delete;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |-----------------------------< post_delete >------------------------------|
126 -- ----------------------------------------------------------------------------
127 -- {Start Of Comments}
128 --
129 -- Description:
130 --   This private procedure contains any processing which is required after the
131 --   delete dml.
132 --
133 -- Prerequistes:
134 --   This is an internal procedure which is called from the del procedure.
135 --
136 -- In Parameters:
137 --   A Pl/Sql record structure.
138 --
139 -- Post Success:
140 --   Processing continues.
141 --
142 -- Post Failure:
143 --   If an error has occurred, an error message and exception will be raised
144 --   but not handled.
145 --
146 -- Developer Implementation Notes:
147 --   Any post-processing required after the delete dml is issued should be
148 --   coded within this procedure. It is important to note that any 3rd party
149 --   maintenance should be reviewed before placing in this procedure.
150 --
151 -- Access Status:
152 --   Internal Row Handler Use Only.
153 --
154 -- {End Of Comments}
155 -- -----------------------------------------------------------------------------
156 Procedure post_delete(p_rec in per_inc_shd.g_rec_type) is
157 --
158   l_proc  varchar2(72) := g_package||'post_delete';
159 --
160 Begin
161   hr_utility.set_location('Entering:'||l_proc, 5);
162     begin
163     --
164     per_inc_rkd.after_delete
165       (p_incident_id
166       => p_rec.incident_id
167       ,p_person_id_o
168       => per_inc_shd.g_old_rec.person_id
169       ,p_incident_reference_o
170       => per_inc_shd.g_old_rec.incident_reference
171       ,p_incident_type_o
172       => per_inc_shd.g_old_rec.incident_type
173       ,p_incident_date_o
174       => per_inc_shd.g_old_rec.incident_date
175       ,p_incident_time_o
176       => per_inc_shd.g_old_rec.incident_time
177       ,p_org_notified_date_o
178       => per_inc_shd.g_old_rec.org_notified_date
179       ,p_assignment_id_o
180       => per_inc_shd.g_old_rec.assignment_id
181       ,p_location_o
182       => per_inc_shd.g_old_rec.location
183       ,p_at_work_flag_o
184       => per_inc_shd.g_old_rec.at_work_flag
185       ,p_report_date_o
186       => per_inc_shd.g_old_rec.report_date
187       ,p_report_time_o
188       => per_inc_shd.g_old_rec.report_time
189       ,p_report_method_o
190       => per_inc_shd.g_old_rec.report_method
191       ,p_person_reported_by_o
192       => per_inc_shd.g_old_rec.person_reported_by
193       ,p_person_reported_to_o
194       => per_inc_shd.g_old_rec.person_reported_to
195       ,p_witness_details_o
196       => per_inc_shd.g_old_rec.witness_details
197       ,p_description_o
198       => per_inc_shd.g_old_rec.description
199       ,p_injury_type_o
200       => per_inc_shd.g_old_rec.injury_type
201       ,p_disease_type_o
202       => per_inc_shd.g_old_rec.disease_type
206       => per_inc_shd.g_old_rec.body_part
203       ,p_hazard_type_o
204       => per_inc_shd.g_old_rec.hazard_type
205       ,p_body_part_o
207       ,p_treatment_received_flag_o
208       => per_inc_shd.g_old_rec.treatment_received_flag
209       ,p_hospital_details_o
210       => per_inc_shd.g_old_rec.hospital_details
211   ,p_emergency_code_o           => per_inc_shd.g_old_rec.emergency_code
212   ,p_hospitalized_flag_o        => per_inc_shd.g_old_rec.hospitalized_flag
213   ,p_hospital_address_o         => per_inc_shd.g_old_rec.hospital_address
214   ,p_activity_at_time_of_work_o => per_inc_shd.g_old_rec.activity_at_time_of_work
215   ,p_objects_involved_o         => per_inc_shd.g_old_rec.objects_involved
216   ,p_privacy_issue_o            => per_inc_shd.g_old_rec.privacy_issue
217   ,p_work_start_time_o          => per_inc_shd.g_old_rec.work_start_time
218   ,p_date_of_death_o            => per_inc_shd.g_old_rec.date_of_death
219   ,p_report_completed_by_o      => per_inc_shd.g_old_rec.report_completed_by
220   ,p_reporting_person_title_o   => per_inc_shd.g_old_rec.reporting_person_title
221   ,p_reporting_person_phone_o   => per_inc_shd.g_old_rec.reporting_person_phone
222   ,p_days_restricted_work_o     => per_inc_shd.g_old_rec.days_restricted_work
223   ,p_days_away_from_work_o      => per_inc_shd.g_old_rec.days_away_from_work
224       ,p_doctor_name_o
225       => per_inc_shd.g_old_rec.doctor_name
226       ,p_compensation_date_o
227       => per_inc_shd.g_old_rec.compensation_date
228       ,p_compensation_currency_o
229       => per_inc_shd.g_old_rec.compensation_currency
230       ,p_compensation_amount_o
231       => per_inc_shd.g_old_rec.compensation_amount
232       ,p_remedial_hs_action_o
233       => per_inc_shd.g_old_rec.remedial_hs_action
234       ,p_notified_hsrep_id_o
235       => per_inc_shd.g_old_rec.notified_hsrep_id
236       ,p_notified_hsrep_date_o
237       => per_inc_shd.g_old_rec.notified_hsrep_date
238       ,p_notified_rep_id_o
239       => per_inc_shd.g_old_rec.notified_rep_id
240       ,p_notified_rep_date_o
241       => per_inc_shd.g_old_rec.notified_rep_date
242       ,p_notified_rep_org_id_o
243       => per_inc_shd.g_old_rec.notified_rep_org_id
244       ,p_related_incident_id_o
245       => per_inc_shd.g_old_rec.related_incident_id
246       ,p_over_time_flag_o
247       => per_inc_shd.g_old_rec.over_time_flag
248       ,p_absence_exists_flag_o
249       => per_inc_shd.g_old_rec.absence_exists_flag
250       ,p_attribute_category_o
251       => per_inc_shd.g_old_rec.attribute_category
252       ,p_attribute1_o
253       => per_inc_shd.g_old_rec.attribute1
254       ,p_attribute2_o
255       => per_inc_shd.g_old_rec.attribute2
256       ,p_attribute3_o
257       => per_inc_shd.g_old_rec.attribute3
258       ,p_attribute4_o
259       => per_inc_shd.g_old_rec.attribute4
260       ,p_attribute5_o
261       => per_inc_shd.g_old_rec.attribute5
262       ,p_attribute6_o
263       => per_inc_shd.g_old_rec.attribute6
264       ,p_attribute7_o
265       => per_inc_shd.g_old_rec.attribute7
266       ,p_attribute8_o
267       => per_inc_shd.g_old_rec.attribute8
268       ,p_attribute9_o
269       => per_inc_shd.g_old_rec.attribute9
270       ,p_attribute10_o
271       => per_inc_shd.g_old_rec.attribute10
272       ,p_attribute11_o
273       => per_inc_shd.g_old_rec.attribute11
274       ,p_attribute12_o
275       => per_inc_shd.g_old_rec.attribute12
276       ,p_attribute13_o
277       => per_inc_shd.g_old_rec.attribute13
278       ,p_attribute14_o
279       => per_inc_shd.g_old_rec.attribute14
280       ,p_attribute15_o
281       => per_inc_shd.g_old_rec.attribute15
282       ,p_attribute16_o
283       => per_inc_shd.g_old_rec.attribute16
284       ,p_attribute17_o
285       => per_inc_shd.g_old_rec.attribute17
286       ,p_attribute18_o
287       => per_inc_shd.g_old_rec.attribute18
288       ,p_attribute19_o
289       => per_inc_shd.g_old_rec.attribute19
290       ,p_attribute20_o
291       => per_inc_shd.g_old_rec.attribute20
292       ,p_attribute21_o
293       => per_inc_shd.g_old_rec.attribute21
294       ,p_attribute22_o
295       => per_inc_shd.g_old_rec.attribute22
296       ,p_attribute23_o
297       => per_inc_shd.g_old_rec.attribute23
298       ,p_attribute24_o
299       => per_inc_shd.g_old_rec.attribute24
300       ,p_attribute25_o
301       => per_inc_shd.g_old_rec.attribute25
302       ,p_attribute26_o
303       => per_inc_shd.g_old_rec.attribute26
304       ,p_attribute27_o
305       => per_inc_shd.g_old_rec.attribute27
306       ,p_attribute28_o
307       => per_inc_shd.g_old_rec.attribute28
308       ,p_attribute29_o
309       => per_inc_shd.g_old_rec.attribute29
310       ,p_attribute30_o
311       => per_inc_shd.g_old_rec.attribute30
312       ,p_inc_information_category_o
313       => per_inc_shd.g_old_rec.inc_information_category
314       ,p_inc_information1_o
315       => per_inc_shd.g_old_rec.inc_information1
316       ,p_inc_information2_o
317       => per_inc_shd.g_old_rec.inc_information2
318       ,p_inc_information3_o
319       => per_inc_shd.g_old_rec.inc_information3
320       ,p_inc_information4_o
321       => per_inc_shd.g_old_rec.inc_information4
322       ,p_inc_information5_o
323       => per_inc_shd.g_old_rec.inc_information5
324       ,p_inc_information6_o
325       => per_inc_shd.g_old_rec.inc_information6
326       ,p_inc_information7_o
327       => per_inc_shd.g_old_rec.inc_information7
328       ,p_inc_information8_o
329       => per_inc_shd.g_old_rec.inc_information8
330       ,p_inc_information9_o
331       => per_inc_shd.g_old_rec.inc_information9
332       ,p_inc_information10_o
333       => per_inc_shd.g_old_rec.inc_information10
334       ,p_inc_information11_o
335       => per_inc_shd.g_old_rec.inc_information11
336       ,p_inc_information12_o
337       => per_inc_shd.g_old_rec.inc_information12
338       ,p_inc_information13_o
339       => per_inc_shd.g_old_rec.inc_information13
340       ,p_inc_information14_o
341       => per_inc_shd.g_old_rec.inc_information14
342       ,p_inc_information15_o
343       => per_inc_shd.g_old_rec.inc_information15
344       ,p_inc_information16_o
345       => per_inc_shd.g_old_rec.inc_information16
346       ,p_inc_information17_o
347       => per_inc_shd.g_old_rec.inc_information17
348       ,p_inc_information18_o
349       => per_inc_shd.g_old_rec.inc_information18
350       ,p_inc_information19_o
351       => per_inc_shd.g_old_rec.inc_information19
352       ,p_inc_information20_o
353       => per_inc_shd.g_old_rec.inc_information20
354       ,p_inc_information21_o
355       => per_inc_shd.g_old_rec.inc_information21
356       ,p_inc_information22_o
357       => per_inc_shd.g_old_rec.inc_information22
358       ,p_inc_information23_o
359       => per_inc_shd.g_old_rec.inc_information23
360       ,p_inc_information24_o
361       => per_inc_shd.g_old_rec.inc_information24
362       ,p_inc_information25_o
363       => per_inc_shd.g_old_rec.inc_information25
364       ,p_inc_information26_o
365       => per_inc_shd.g_old_rec.inc_information26
366       ,p_inc_information27_o
367       => per_inc_shd.g_old_rec.inc_information27
368       ,p_inc_information28_o
369       => per_inc_shd.g_old_rec.inc_information28
370       ,p_inc_information29_o
371       => per_inc_shd.g_old_rec.inc_information29
372       ,p_inc_information30_o
373       => per_inc_shd.g_old_rec.inc_information30
374       ,p_object_version_number_o
375       => per_inc_shd.g_old_rec.object_version_number
376       );
377     --
378   exception
379     --
380     when hr_api.cannot_find_prog_unit then
381       --
382       hr_api.cannot_find_prog_unit_error
383         (p_module_name => 'PER_WORK_INCIDENTS'
384         ,p_hook_type   => 'AD');
385       --
386   end;
387   --
388   hr_utility.set_location(' Leaving:'||l_proc, 10);
389 End post_delete;
390 --
391 -- ----------------------------------------------------------------------------
392 -- |---------------------------------< del >----------------------------------|
393 -- ----------------------------------------------------------------------------
394 Procedure del
395   (p_rec	      in per_inc_shd.g_rec_type
396   ) is
397 --
398   l_proc  varchar2(72) := g_package||'del';
399 --
400 Begin
401   hr_utility.set_location('Entering:'||l_proc, 5);
402   --
403   -- We must lock the row which we need to delete.
404   --
405   per_inc_shd.lck
406     (p_rec.incident_id
407     ,p_rec.object_version_number
408     );
409   --
410   -- Call the supporting delete validate operation
411   --
412   per_inc_bus.delete_validate(p_rec);
413   --
414   -- Call the supporting pre-delete operation
415   --
416   per_inc_del.pre_delete(p_rec);
417   --
418   -- Delete the row.
419   --
420   per_inc_del.delete_dml(p_rec);
421   --
422   -- Call the supporting post-delete operation
423   --
424   per_inc_del.post_delete(p_rec);
425   --
426 End del;
427 --
428 -- ----------------------------------------------------------------------------
429 -- |---------------------------------< del >----------------------------------|
430 -- ----------------------------------------------------------------------------
431 Procedure del
432   (p_incident_id                          in     number
433   ,p_object_version_number                in     number
434   ) is
435 --
436   l_rec	  per_inc_shd.g_rec_type;
437   l_proc  varchar2(72) := g_package||'del';
438 --
439 Begin
440   hr_utility.set_location('Entering:'||l_proc, 5);
441   --
442   -- As the delete procedure accepts a plsql record structure we do need to
443   -- convert the  arguments into the record structure.
444   -- We don't need to call the supplied conversion argument routine as we
445   -- only need a few attributes.
446   --
447   l_rec.incident_id := p_incident_id;
448   l_rec.object_version_number := p_object_version_number;
449   --
450   -- Having converted the arguments into the per_inc_rec
451   -- plsql record structure we must call the corresponding entity
452   -- business process
453   --
454   per_inc_del.del(l_rec);
455   --
456   hr_utility.set_location(' Leaving:'||l_proc, 10);
457 End del;
458 --
459 end per_inc_del;