1 Package Body hr_lei_del as
2 /* $Header: hrleirhi.pkb 120.0.12000000.2 2007/08/13 08:41:45 ghshanka ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_lei_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 -- Pre Conditions:
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 Table Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in hr_lei_shd.g_rec_type) is
52 --
53 l_proc varchar2(72) := g_package||'delete_dml';
54 --
55 Begin
56 hr_utility.set_location('Entering:'||l_proc, 5);
57 --
58 -- hr_lei_shd.g_api_dml := true; -- Set the api dml status
59 --
60 -- Delete the hr_location_extra_info row.
61 --
62 delete from hr_location_extra_info
63 where location_extra_info_id = p_rec.location_extra_info_id;
64 --
65 -- hr_lei_shd.g_api_dml := false; -- Unset the api dml status
66 --
67 hr_utility.set_location(' Leaving:'||l_proc, 10);
68 --
69 Exception
70 When hr_api.child_integrity_violated then
71 -- Child integrity has been violated
72 -- hr_lei_shd.g_api_dml := false; -- Unset the api dml status
73 hr_lei_shd.constraint_error
74 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75 When Others Then
76 -- hr_lei_shd.g_api_dml := false; -- Unset the api dml status
77 Raise;
78 End delete_dml;
79 --
80 -- ----------------------------------------------------------------------------
81 -- |------------------------------< pre_delete >------------------------------|
82 -- ----------------------------------------------------------------------------
83 -- {Start Of Comments}
84 --
85 -- Description:
86 -- This private procedure contains any processing which is required before
87 -- the delete dml.
88 --
89 -- Pre Conditions:
90 -- This is an internal procedure which is called from the del procedure.
91 --
92 -- In Parameters:
93 -- A Pl/Sql record structre.
94 --
95 -- Post Success:
96 -- Processing continues.
97 --
98 -- Post Failure:
99 -- If an error has occurred, an error message and exception will be raised
100 -- but not handled.
101 --
102 -- Developer Implementation Notes:
103 -- Any pre-processing required before the delete dml is issued should be
104 -- coded within this procedure. It is important to note that any 3rd party
105 -- maintenance should be reviewed before placing in this procedure.
106 --
107 -- Access Status:
108 -- Internal Table Handler Use Only.
109 --
110 -- {End Of Comments}
111 -- ----------------------------------------------------------------------------
112 Procedure pre_delete(p_rec in hr_lei_shd.g_rec_type) is
113 --
114 l_proc varchar2(72) := g_package||'pre_delete';
115 --
116 Begin
117 hr_utility.set_location('Entering:'||l_proc, 5);
118 --
119 hr_utility.set_location(' Leaving:'||l_proc, 10);
120 End pre_delete;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |-----------------------------< post_delete >------------------------------|
124 -- ----------------------------------------------------------------------------
125 -- {Start Of Comments}
126 --
127 -- Description:
128 -- This private procedure contains any processing which is required after the
129 -- delete dml.
130 --
131 -- Pre Conditions:
132 -- This is an internal procedure which is called from the del procedure.
133 --
134 -- In Parameters:
135 -- A Pl/Sql record structre.
136 --
137 -- Post Success:
138 -- Processing continues.
139 --
140 -- Post Failure:
141 -- If an error has occurred, an error message and exception will be raised
142 -- but not handled.
143 --
144 -- Developer Implementation Notes:
145 -- Any post-processing required after the delete dml is issued should be
146 -- coded within this procedure. It is important to note that any 3rd party
147 -- maintenance should be reviewed before placing in this procedure.
148 --
149 -- Access Status:
150 -- Internal table Handler Use Only.
151 --
152 -- {End Of Comments}
153 -- ----------------------------------------------------------------------------
154 Procedure post_delete(p_rec in hr_lei_shd.g_rec_type) is
155 --
156 l_proc varchar2(72) := g_package||'post_delete';
157 --
158 Begin
159 hr_utility.set_location('Entering:'||l_proc, 5);
160 --
161 -- This is a hook point and the user hook for post_delete is called here.
162 --
163 begin
164 hr_lei_rkd.after_delete (
165 p_location_extra_info_id_o => hr_lei_shd.g_old_rec.location_extra_info_id,
166 p_information_type_o => hr_lei_shd.g_old_rec.information_type,
167 p_location_id_o => hr_lei_shd.g_old_rec.location_id,
168 p_request_id_o => hr_lei_shd.g_old_rec.request_id ,
169 p_program_application_id_o => hr_lei_shd.g_old_rec.program_application_id,
170 p_program_id_o => hr_lei_shd.g_old_rec.program_id ,
171 p_program_update_date_o => hr_lei_shd.g_old_rec.program_update_date,
172 p_lei_attribute_category_o => hr_lei_shd.g_old_rec.lei_attribute_category,
173 p_lei_attribute1_o => hr_lei_shd.g_old_rec.lei_attribute1,
174 p_lei_attribute2_o => hr_lei_shd.g_old_rec.lei_attribute2,
175 p_lei_attribute3_o => hr_lei_shd.g_old_rec.lei_attribute3,
176 p_lei_attribute4_o => hr_lei_shd.g_old_rec.lei_attribute4,
177 p_lei_attribute5_o => hr_lei_shd.g_old_rec.lei_attribute5,
178 p_lei_attribute6_o => hr_lei_shd.g_old_rec.lei_attribute6,
179 p_lei_attribute7_o => hr_lei_shd.g_old_rec.lei_attribute7,
180 p_lei_attribute8_o => hr_lei_shd.g_old_rec.lei_attribute8,
181 p_lei_attribute9_o => hr_lei_shd.g_old_rec.lei_attribute9,
182 p_lei_attribute10_o => hr_lei_shd.g_old_rec.lei_attribute10,
183 p_lei_attribute11_o => hr_lei_shd.g_old_rec.lei_attribute11,
184 p_lei_attribute12_o => hr_lei_shd.g_old_rec.lei_attribute12,
185 p_lei_attribute13_o => hr_lei_shd.g_old_rec.lei_attribute13,
186 p_lei_attribute14_o => hr_lei_shd.g_old_rec.lei_attribute14,
187 p_lei_attribute15_o => hr_lei_shd.g_old_rec.lei_attribute15,
188 p_lei_attribute16_o => hr_lei_shd.g_old_rec.lei_attribute16,
189 p_lei_attribute17_o => hr_lei_shd.g_old_rec.lei_attribute17,
190 p_lei_attribute18_o => hr_lei_shd.g_old_rec.lei_attribute18,
191 p_lei_attribute19_o => hr_lei_shd.g_old_rec.lei_attribute19,
192 p_lei_attribute20_o => hr_lei_shd.g_old_rec.lei_attribute20,
193 p_lei_information_category_o => hr_lei_shd.g_old_rec.lei_information_category,
194 p_lei_information1_o => hr_lei_shd.g_old_rec.lei_information1,
195 p_lei_information2_o => hr_lei_shd.g_old_rec.lei_information2,
196 p_lei_information3_o => hr_lei_shd.g_old_rec.lei_information3,
197 p_lei_information4_o => hr_lei_shd.g_old_rec.lei_information4,
198 p_lei_information5_o => hr_lei_shd.g_old_rec.lei_information5,
199 p_lei_information6_o => hr_lei_shd.g_old_rec.lei_information6,
200 p_lei_information7_o => hr_lei_shd.g_old_rec.lei_information7,
201 p_lei_information8_o => hr_lei_shd.g_old_rec.lei_information8,
202 p_lei_information9_o => hr_lei_shd.g_old_rec.lei_information9,
203 p_lei_information10_o => hr_lei_shd.g_old_rec.lei_information10,
204 p_lei_information11_o => hr_lei_shd.g_old_rec.lei_information11,
205 p_lei_information12_o => hr_lei_shd.g_old_rec.lei_information12,
206 p_lei_information13_o => hr_lei_shd.g_old_rec.lei_information13,
207 p_lei_information14_o => hr_lei_shd.g_old_rec.lei_information14,
208 p_lei_information15_o => hr_lei_shd.g_old_rec.lei_information15,
209 p_lei_information16_o => hr_lei_shd.g_old_rec.lei_information16,
210 p_lei_information17_o => hr_lei_shd.g_old_rec.lei_information17,
211 p_lei_information18_o => hr_lei_shd.g_old_rec.lei_information18,
212 p_lei_information19_o => hr_lei_shd.g_old_rec.lei_information19,
213 p_lei_information20_o => hr_lei_shd.g_old_rec.lei_information20,
214 p_lei_information21_o => hr_lei_shd.g_old_rec.lei_information21,
215 p_lei_information22_o => hr_lei_shd.g_old_rec.lei_information22,
216 p_lei_information23_o => hr_lei_shd.g_old_rec.lei_information23,
217 p_lei_information24_o => hr_lei_shd.g_old_rec.lei_information24,
218 p_lei_information25_o => hr_lei_shd.g_old_rec.lei_information25,
219 p_lei_information26_o => hr_lei_shd.g_old_rec.lei_information26,
220 p_lei_information27_o => hr_lei_shd.g_old_rec.lei_information27,
221 p_lei_information28_o => hr_lei_shd.g_old_rec.lei_information28,
222 p_lei_information29_o => hr_lei_shd.g_old_rec.lei_information29,
223 p_lei_information30_o => hr_lei_shd.g_old_rec.lei_information30
224 );
225 exception
226 when hr_api.cannot_find_prog_unit then
227 hr_api.cannot_find_prog_unit_error
228 ( p_module_name => 'HR_LOCATION_EXTRA_INFO'
229 ,p_hook_type => 'AD'
230 );
231 end;
232 -- End of API User Hook for post_delete.
233 --
234 hr_utility.set_location(' Leaving:'||l_proc, 10);
235 End post_delete;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |---------------------------------< del >----------------------------------|
239 -- ----------------------------------------------------------------------------
240 Procedure del
241 (
242 p_rec in hr_lei_shd.g_rec_type,
243 p_validate in boolean default false
244 ) is
245 --
246 l_proc varchar2(72) := g_package||'del';
247 --
248 Begin
249 hr_utility.set_location('Entering:'||l_proc, 5);
250 --
251 -- Determine if the business process is to be validated.
252 --
253 If p_validate then
254 --
255 -- Issue the savepoint.
256 --
257 SAVEPOINT del_hr_lei;
258 End If;
259 --
260 -- We must lock the row which we need to delete.
261 --
262 hr_lei_shd.lck
263 (
264 p_rec.location_extra_info_id,
265 p_rec.object_version_number
266 );
267 --
268 -- Call the supporting delete validate operation
269 --
270 hr_lei_bus.delete_validate(p_rec);
271 --
272 -- Call the supporting pre-delete operation
273 --
274 pre_delete(p_rec);
275 --
276 -- Delete the row.
277 --
278 delete_dml(p_rec);
279 --
280 -- Call the supporting post-delete operation
281 --
282 post_delete(p_rec);
283 --
284 -- If we are validating then raise the Validate_Enabled exception
285 --
286 If p_validate then
287 Raise HR_Api.Validate_Enabled;
288 End If;
289 --
290 hr_utility.set_location(' Leaving:'||l_proc, 10);
291 Exception
292 When HR_Api.Validate_Enabled Then
293 --
294 -- As the Validate_Enabled exception has been raised
295 -- we must rollback to the savepoint
296 --
297 ROLLBACK TO del_hr_lei;
298 End del;
299 --
300 -- ----------------------------------------------------------------------------
301 -- |---------------------------------< del >----------------------------------|
302 -- ----------------------------------------------------------------------------
303 Procedure del
304 (
305 p_location_extra_info_id in number,
306 p_object_version_number in number,
307 p_validate in boolean default false
308 ) is
309 --
310 l_rec hr_lei_shd.g_rec_type;
311 l_proc varchar2(72) := g_package||'del';
312 --
313 Begin
314 hr_utility.set_location('Entering:'||l_proc, 5);
315 --
316 -- As the delete procedure accepts a plsql record structure we do need to
317 -- convert the arguments into the record structure.
318 -- We don't need to call the supplied conversion argument routine as we
319 -- only need a few attributes.
320 --
321 l_rec.location_extra_info_id:= p_location_extra_info_id;
322 l_rec.object_version_number := p_object_version_number;
323 --
324 -- Having converted the arguments into the hr_lei_rec
325 -- plsql record structure we must call the corresponding entity
326 -- business process
327 --
328 del(l_rec, p_validate);
329 --
330 hr_utility.set_location(' Leaving:'||l_proc, 10);
331 End del;
332 --
333 end hr_lei_del;