1 Package Body ota_tpm_del as
2 /* $Header: ottpmrhi.pkb 120.1 2005/12/14 15:33:09 asud noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_tpm_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 ota_tpm_shd.g_rec_type
53 ) is
54 --
55 l_proc varchar2(72) := g_package||'delete_dml';
56 l_boolean boolean := null;
57 --
58 Begin
59 hr_utility.set_location('Entering:'||l_proc, 5);
60 --
61 --Bug3507060
62 -- Set the Is_Per_Trng_Plan global variable
63 -- l_boolean := OTA_TRNG_PLAN_UTIL_SS.is_personal_trng_plan(p_rec.training_plan_id);
64 --
65 -- Delete the ota_training_plan_members row.
66 --
67 delete from ota_training_plan_members
68 where training_plan_member_id = p_rec.training_plan_member_id;
69 --
70 --
71 --
72 hr_utility.set_location(' Leaving:'||l_proc, 10);
73 --
74 Exception
75 When hr_api.child_integrity_violated then
76 -- Child integrity has been violated
77 --
78 ota_tpm_shd.constraint_error
79 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
80 When Others Then
81 --
82 Raise;
83 End delete_dml;
84 --
85 -- ----------------------------------------------------------------------------
86 -- |------------------------------< pre_delete >------------------------------|
87 -- ----------------------------------------------------------------------------
88 -- {Start Of Comments}
89 --
90 -- Description:
91 -- This private procedure contains any processing which is required before
92 -- the delete dml.
93 --
94 -- Prerequisites:
95 -- This is an internal procedure which is called from the del procedure.
96 --
97 -- In Parameters:
98 -- A Pl/Sql record structre.
99 --
100 -- Post Success:
101 -- Processing continues.
102 --
103 -- Post Failure:
104 -- If an error has occurred, an error message and exception will be raised
105 -- but not handled.
106 --
107 -- Developer Implementation Notes:
108 -- Any pre-processing required before the delete dml is issued should be
109 -- coded within this procedure. It is important to note that any 3rd party
110 -- maintenance should be reviewed before placing in this procedure.
111 --
112 -- Access Status:
113 -- Internal Row Handler Use Only.
114 --
115 -- {End Of Comments}
116 -- ----------------------------------------------------------------------------
117 Procedure pre_delete(p_rec in ota_tpm_shd.g_rec_type) is
118 --
119 l_proc varchar2(72) := g_package||'pre_delete';
120 --
121 Begin
122 hr_utility.set_location('Entering:'||l_proc, 5);
123 --
124 hr_utility.set_location(' Leaving:'||l_proc, 10);
125 End pre_delete;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |-----------------------------< post_delete >------------------------------|
129 -- ----------------------------------------------------------------------------
130 -- {Start Of Comments}
131 --
132 -- Description:
133 -- This private procedure contains any processing which is required after the
134 -- delete dml.
135 --
136 -- Prerequistes:
137 -- This is an internal procedure which is called from the del procedure.
138 --
139 -- In Parameters:
140 -- A Pl/Sql record structure.
141 --
142 -- Post Success:
143 -- Processing continues.
144 --
145 -- Post Failure:
146 -- If an error has occurred, an error message and exception will be raised
147 -- but not handled.
148 --
149 -- Developer Implementation Notes:
150 -- Any post-processing required after the delete dml is issued should be
151 -- coded within this procedure. It is important to note that any 3rd party
152 -- maintenance should be reviewed before placing in this procedure.
153 --
154 -- Access Status:
155 -- Internal Row Handler Use Only.
156 --
157 -- {End Of Comments}
158 -- -----------------------------------------------------------------------------
159 Procedure post_delete(p_rec in ota_tpm_shd.g_rec_type) is
160 --
161 l_proc varchar2(72) := g_package||'post_delete';
162 --
163 Begin
164 hr_utility.set_location('Entering:'||l_proc, 5);
165 begin
166 --
167 ota_tpm_rkd.after_delete
168 (p_training_plan_member_id
169 => p_rec.training_plan_member_id
170 ,p_training_plan_id_o
171 => ota_tpm_shd.g_old_rec.training_plan_id
172 ,p_activity_version_id_o
173 => ota_tpm_shd.g_old_rec.activity_version_id
174 ,p_activity_definition_id_o
175 => ota_tpm_shd.g_old_rec.activity_definition_id
176 ,p_member_status_type_id_o
177 => ota_tpm_shd.g_old_rec.member_status_type_id
178 ,p_target_completion_date_o
179 => ota_tpm_shd.g_old_rec.target_completion_date
180 ,p_business_group_id_o
181 => ota_tpm_shd.g_old_rec.business_group_id
182 ,p_object_version_number_o
183 => ota_tpm_shd.g_old_rec.object_version_number
184 ,p_attribute_category_o
185 => ota_tpm_shd.g_old_rec.attribute_category
186 ,p_attribute1_o
187 => ota_tpm_shd.g_old_rec.attribute1
188 ,p_attribute2_o
189 => ota_tpm_shd.g_old_rec.attribute2
190 ,p_attribute3_o
191 => ota_tpm_shd.g_old_rec.attribute3
192 ,p_attribute4_o
193 => ota_tpm_shd.g_old_rec.attribute4
194 ,p_attribute5_o
195 => ota_tpm_shd.g_old_rec.attribute5
196 ,p_attribute6_o
197 => ota_tpm_shd.g_old_rec.attribute6
198 ,p_attribute7_o
199 => ota_tpm_shd.g_old_rec.attribute7
200 ,p_attribute8_o
201 => ota_tpm_shd.g_old_rec.attribute8
202 ,p_attribute9_o
203 => ota_tpm_shd.g_old_rec.attribute9
204 ,p_attribute10_o
205 => ota_tpm_shd.g_old_rec.attribute10
206 ,p_attribute11_o
207 => ota_tpm_shd.g_old_rec.attribute11
208 ,p_attribute12_o
209 => ota_tpm_shd.g_old_rec.attribute12
210 ,p_attribute13_o
211 => ota_tpm_shd.g_old_rec.attribute13
212 ,p_attribute14_o
213 => ota_tpm_shd.g_old_rec.attribute14
214 ,p_attribute15_o
215 => ota_tpm_shd.g_old_rec.attribute15
216 ,p_attribute16_o
217 => ota_tpm_shd.g_old_rec.attribute16
218 ,p_attribute17_o
219 => ota_tpm_shd.g_old_rec.attribute17
220 ,p_attribute18_o
221 => ota_tpm_shd.g_old_rec.attribute18
222 ,p_attribute19_o
223 => ota_tpm_shd.g_old_rec.attribute19
224 ,p_attribute20_o
225 => ota_tpm_shd.g_old_rec.attribute20
226 ,p_attribute21_o
227 => ota_tpm_shd.g_old_rec.attribute21
228 ,p_attribute22_o
229 => ota_tpm_shd.g_old_rec.attribute22
230 ,p_attribute23_o
231 => ota_tpm_shd.g_old_rec.attribute23
232 ,p_attribute24_o
233 => ota_tpm_shd.g_old_rec.attribute24
234 ,p_attribute25_o
235 => ota_tpm_shd.g_old_rec.attribute25
236 ,p_attribute26_o
237 => ota_tpm_shd.g_old_rec.attribute26
238 ,p_attribute27_o
239 => ota_tpm_shd.g_old_rec.attribute27
240 ,p_attribute28_o
241 => ota_tpm_shd.g_old_rec.attribute28
242 ,p_attribute29_o
243 => ota_tpm_shd.g_old_rec.attribute29
244 ,p_attribute30_o
245 => ota_tpm_shd.g_old_rec.attribute30
246 ,p_assignment_id_o => ota_tpm_shd.g_old_rec.assignment_id
247 ,p_source_id_o => ota_tpm_shd.g_old_rec.source_id
248 ,p_source_function_o => ota_tpm_shd.g_old_rec.source_function
249 ,p_cancellation_reason_o => ota_tpm_shd.g_old_rec.cancellation_reason
250 ,p_earliest_start_date_o => ota_tpm_shd.g_old_rec.earliest_start_date
251 ,p_creator_person_id_o => ota_tpm_shd.g_old_rec.creator_person_id
252 );
253 --
254 exception
255 --
256 when hr_api.cannot_find_prog_unit then
257 --
258 hr_api.cannot_find_prog_unit_error
259 (p_module_name => 'OTA_TRAINING_PLAN_MEMBERS'
260 ,p_hook_type => 'AD');
261 --
262 end;
263 --
264 hr_utility.set_location(' Leaving:'||l_proc, 10);
265 End post_delete;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |---------------------------------< del >----------------------------------|
269 -- ----------------------------------------------------------------------------
270 Procedure del
271 (p_rec in ota_tpm_shd.g_rec_type
272 ) is
273 --
274 l_proc varchar2(72) := g_package||'del';
275 --
276 Begin
277 hr_utility.set_location('Entering:'||l_proc, 5);
278 --
279 -- We must lock the row which we need to delete.
280 --
281 ota_tpm_shd.lck
282 (p_rec.training_plan_member_id
283 ,p_rec.object_version_number
284 );
285 --
286 -- Call the supporting delete validate operation
287 --
288 ota_tpm_bus.delete_validate(p_rec);
289
290 hr_multi_message.end_validation_set;
291 --
292 -- Call the supporting pre-delete operation
293 --
294 ota_tpm_del.pre_delete(p_rec);
295 --
296 -- Delete the row.
297 --
298 ota_tpm_del.delete_dml(p_rec);
299 --
300 -- Call the supporting post-delete operation
301 --
302 ota_tpm_del.post_delete(p_rec);
303 --
304 hr_multi_message.end_validation_set;
305 End del;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |---------------------------------< del >----------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure del
311 (p_training_plan_member_id in number
312 ,p_object_version_number in number
313 ) is
314 --
315 l_rec ota_tpm_shd.g_rec_type;
316 l_proc varchar2(72) := g_package||'del';
317 --
318 Begin
319 hr_utility.set_location('Entering:'||l_proc, 5);
320 --
321 -- As the delete procedure accepts a plsql record structure we do need to
322 -- convert the arguments into the record structure.
323 -- We don't need to call the supplied conversion argument routine as we
324 -- only need a few attributes.
325 --
326 l_rec.training_plan_member_id := p_training_plan_member_id;
327 l_rec.object_version_number := p_object_version_number;
328 --
329 -- Having converted the arguments into the ota_tpm_rec
330 -- plsql record structure we must call the corresponding entity
331 -- business process
332 --
333 ota_tpm_del.del(l_rec);
334 --
335 hr_utility.set_location(' Leaving:'||l_proc, 10);
336 End del;
337 --
338 end ota_tpm_del;