1 Package Body ota_nhs_del as
2 /* $Header: otnhsrhi.pkb 120.1 2005/09/30 05:00:04 ssur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_nhs_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(p_rec in ota_nhs_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 ota_nhs_shd.g_api_dml := true; -- Set the api dml status
59 --
60 -- Delete the ota_notrng_histories row.
61 --
62 delete from ota_notrng_histories
63 where nota_history_id = p_rec.nota_history_id;
64 --
65 ota_nhs_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 ota_nhs_shd.g_api_dml := false; -- Unset the api dml status
73 ota_nhs_shd.constraint_error
74 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75 When Others Then
76 ota_nhs_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 -- Prerequisites:
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 Row Handler Use Only.
109 --
110 -- {End Of Comments}
111 -- ----------------------------------------------------------------------------
112 Procedure pre_delete(p_rec in ota_nhs_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 -- Prerequisites:
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 ota_nhs_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 ota_nhs_rkd.after_delete
162 (p_nota_history_id
163 => p_rec.nota_history_id
164 ,p_person_id_o
165 => ota_nhs_shd.g_old_rec.person_id
166 ,p_contact_id_o
167 => ota_nhs_shd.g_old_rec.contact_id
168 ,p_trng_title_o
169 => ota_nhs_shd.g_old_rec.trng_title
170 ,p_provider_o
171 => ota_nhs_shd.g_old_rec.provider
172 ,p_type_o
173 => ota_nhs_shd.g_old_rec.type
174 ,p_centre_o
175 => ota_nhs_shd.g_old_rec.centre
176 ,p_completion_date_o
177 => ota_nhs_shd.g_old_rec.completion_date
178 ,p_award_o
179 => ota_nhs_shd.g_old_rec.award
180 ,p_rating_o
181 => ota_nhs_shd.g_old_rec.rating
182 ,p_duration_o
183 => ota_nhs_shd.g_old_rec.duration
184 ,p_duration_units_o
185 => ota_nhs_shd.g_old_rec.duration_units
186 ,p_activity_version_id_o
187 => ota_nhs_shd.g_old_rec.activity_version_id
188 ,p_status_o
189 => ota_nhs_shd.g_old_rec.status
190 ,p_verified_by_id_o
191 => ota_nhs_shd.g_old_rec.verified_by_id
192 ,p_nth_information_category_o
193 => ota_nhs_shd.g_old_rec.nth_information_category
194 ,p_nth_information1_o
195 => ota_nhs_shd.g_old_rec.nth_information1
196 ,p_nth_information2_o
197 => ota_nhs_shd.g_old_rec.nth_information2
198 ,p_nth_information3_o
199 => ota_nhs_shd.g_old_rec.nth_information3
200 ,p_nth_information4_o
201 => ota_nhs_shd.g_old_rec.nth_information4
202 ,p_nth_information5_o
203 => ota_nhs_shd.g_old_rec.nth_information5
204 ,p_nth_information6_o
205 => ota_nhs_shd.g_old_rec.nth_information6
206 ,p_nth_information7_o
207 => ota_nhs_shd.g_old_rec.nth_information7
208 ,p_nth_information8_o
209 => ota_nhs_shd.g_old_rec.nth_information8
210 ,p_nth_information9_o
211 => ota_nhs_shd.g_old_rec.nth_information9
212 ,p_nth_information10_o
213 => ota_nhs_shd.g_old_rec.nth_information10
214 ,p_nth_information11_o
215 => ota_nhs_shd.g_old_rec.nth_information11
216 ,p_nth_information12_o
217 => ota_nhs_shd.g_old_rec.nth_information12
218 ,p_nth_information13_o
219 => ota_nhs_shd.g_old_rec.nth_information13
220 ,p_nth_information15_o
221 => ota_nhs_shd.g_old_rec.nth_information15
222 ,p_nth_information16_o
223 => ota_nhs_shd.g_old_rec.nth_information16
224 ,p_nth_information17_o
225 => ota_nhs_shd.g_old_rec.nth_information17
226 ,p_nth_information18_o
227 => ota_nhs_shd.g_old_rec.nth_information18
228 ,p_nth_information19_o
229 => ota_nhs_shd.g_old_rec.nth_information19
230 ,p_nth_information20_o
231 => ota_nhs_shd.g_old_rec.nth_information20
232 ,p_org_id_o
233 => ota_nhs_shd.g_old_rec.org_id
234 ,p_object_version_number_o
235 => ota_nhs_shd.g_old_rec.object_version_number
236 ,p_business_group_id_o
237 => ota_nhs_shd.g_old_rec.business_group_id
238 ,p_nth_information14_o
239 => ota_nhs_shd.g_old_rec.nth_information14
240 ,p_customer_id_o
241 => ota_nhs_shd.g_old_rec.customer_id
242 ,p_organization_id_o
243 => ota_nhs_shd.g_old_rec.organization_id
244 );
245 --
246 exception
247 --
248 when hr_api.cannot_find_prog_unit then
249 --
250 hr_api.cannot_find_prog_unit_error
251 (p_module_name => 'OTA_NOTRNG_HISTORIES'
252 ,p_hook_type => 'AD');
253 --
254 -- end;
255
256 hr_utility.set_location(' Leaving:'||l_proc, 10);
257 End post_delete;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |---------------------------------< del >----------------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure del
263 (
264 p_rec in ota_nhs_shd.g_rec_type
265 ) is
266 --
267 l_proc varchar2(72) := g_package||'del';
268 --
269 Begin
270 hr_utility.set_location('Entering:'||l_proc, 5);
271 --
272 -- We must lock the row which we need to delete.
273 --
274 ota_nhs_shd.lck
275 (
276 p_rec.nota_history_id,
277 p_rec.object_version_number
278 );
279 --
280 -- Call the supporting delete validate operation
281 --
282 ota_nhs_bus.delete_validate(p_rec);
283 --
284 -- Call the supporting pre-delete operation
285 --
286 pre_delete(p_rec);
287 --
288 -- Delete the row.
289 --
290 delete_dml(p_rec);
291 --
292 -- Call the supporting post-delete operation
293 --
294 post_delete(p_rec);
295 End del;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |---------------------------------< del >----------------------------------|
299 -- ----------------------------------------------------------------------------
300 Procedure del
301 (
302 p_nota_history_id in number,
303 p_object_version_number in number
304 ) is
305 --
306 l_rec ota_nhs_shd.g_rec_type;
307 l_proc varchar2(72) := g_package||'del';
308 --
309 Begin
310 hr_utility.set_location('Entering:'||l_proc, 5);
311 --
312 -- As the delete procedure accepts a plsql record structure we do need to
313 -- convert the arguments into the record structure.
314 -- We don't need to call the supplied conversion argument routine as we
315 -- only need a few attributes.
316 --
317 l_rec.nota_history_id:= p_nota_history_id;
318 l_rec.object_version_number := p_object_version_number;
319 --
320 -- Having converted the arguments into the ota_nhs_rec
321 -- plsql record structure we must call the corresponding entity
322 -- business process
323 --
324 del(l_rec);
325 --
326 hr_utility.set_location(' Leaving:'||l_proc, 10);
327 End del;
328 --
329 end ota_nhs_del;