1 Package Body per_cpn_del as
2 /* $Header: pecpnrhi.pkb 120.0 2005/05/31 07:14:07 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_cpn_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 delete the specified row from the schema using the primary key in
19 -- the predicates.
20 -- 2) To trap any constraint violations that may have occurred.
21 -- 3) To raise any other errors.
22 --
23 -- Pre Conditions:
24 -- This is an internal private procedure which must be called from the del
25 -- procedure.
26 --
27 -- In Parameters:
28 -- A Pl/Sql record structre.
29 --
30 -- Post Success:
31 -- The specified row will be delete from the schema.
32 --
33 -- Post Failure:
34 -- If a child integrity constraint violation is raised the
35 -- constraint_error procedure will be called.
36 -- If any other error is reported, the error will be raised
37 --
38 -- Developer Implementation Notes:
39 -- None.
40 --
41 -- Access Status:
42 -- Internal Table Handler Use Only.
43 --
44 -- {End Of Comments}
45 -- ----------------------------------------------------------------------------
46 Procedure delete_dml(p_rec in per_cpn_shd.g_rec_type) is
47 --
48 l_proc varchar2(72) := g_package||'delete_dml';
49 --
50 Begin
51 hr_utility.set_location('Entering:'||l_proc, 5);
52 --
53 -- Delete the per_competences row.
54 --
55 delete from per_competences
56 where competence_id = p_rec.competence_id;
57
58 --
59 hr_utility.set_location(' Leaving:'||l_proc, 10);
60 --
61 Exception
62 When hr_api.child_integrity_violated then
63 -- Child integrity has been violated
64 per_cpn_shd.constraint_error
65 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
66 When Others Then
67 Raise;
68 End delete_dml;
69 --
70 -- ----------------------------------------------------------------------------
71 -- |------------------------------< pre_delete >------------------------------|
72 -- ----------------------------------------------------------------------------
73 -- {Start Of Comments}
74 --
75 -- Description:
76 -- This private procedure contains any processing which is required before
77 -- the delete dml.
78 --
79 -- Pre Conditions:
80 -- This is an internal procedure which is called from the del procedure.
81 --
82 -- In Parameters:
83 -- A Pl/Sql record structre.
84 --
85 -- Post Success:
86 -- Processing continues.
87 --
88 -- Post Failure:
89 -- If an error has occurred, an error message and exception will be raised
90 -- but not handled.
91 --
92 -- Developer Implementation Notes:
93 -- Any pre-processing required before the delete dml is issued should be
94 -- coded within this procedure. It is important to note that any 3rd party
95 -- maintenance should be reviewed before placing in this procedure.
96 --
97 -- Access Status:
98 -- Internal Table Handler Use Only.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure pre_delete(p_rec in per_cpn_shd.g_rec_type) is
103 --
104 l_proc varchar2(72) := g_package||'pre_delete';
105 --
106 Begin
107 hr_utility.set_location('Entering:'||l_proc, 5);
108 --
109 hr_utility.set_location(' Leaving:'||l_proc, 10);
110 End pre_delete;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |-----------------------------< post_delete >------------------------------|
114 -- ----------------------------------------------------------------------------
115 -- {Start Of Comments}
116 --
117 -- Description:
118 -- This private procedure contains any processing which is required after the
119 -- delete dml.
120 --
121 -- Pre Conditions:
122 -- This is an internal procedure which is called from the del procedure.
123 --
124 -- In Parameters:
125 -- A Pl/Sql record structre.
126 --
127 -- Post Success:
128 -- Processing continues.
129 --
130 -- Post Failure:
131 -- If an error has occurred, an error message and exception will be raised
132 -- but not handled.
133 --
134 -- Developer Implementation Notes:
135 -- Any post-processing required after the delete dml is issued should be
136 -- coded within this procedure. It is important to note that any 3rd party
137 -- maintenance should be reviewed before placing in this procedure.
138 --
139 -- Access Status:
140 -- Internal table Handler Use Only.
141 --
142 -- {End Of Comments}
143 -- ----------------------------------------------------------------------------
144 Procedure post_delete(p_rec in per_cpn_shd.g_rec_type) is
145 --
146 l_proc varchar2(72) := g_package||'post_delete';
147 --
148 Begin
149 hr_utility.set_location('Entering:'||l_proc, 5);
150 --
151 -- This is a hook point and the user hook for post_delete is called here.
152 --
153 begin
154 per_cpn_rkd.after_delete (
155 p_competence_id => p_rec.competence_id ,
156 p_business_group_id_o => per_cpn_shd.g_old_rec.business_group_id ,
157 p_object_version_number_o => per_cpn_shd.g_old_rec.object_version_number ,
158 p_name_o => per_cpn_shd.g_old_rec.name ,
159 p_description_o => per_cpn_shd.g_old_rec.description ,
160 p_date_from_o => per_cpn_shd.g_old_rec.date_from ,
161 p_date_to_o => per_cpn_shd.g_old_rec.date_to ,
162 p_behavioural_indicator_o => per_cpn_shd.g_old_rec.behavioural_indicator ,
163 p_certification_required_o =>
164 per_cpn_shd.g_old_rec.certification_required ,
165 p_evaluation_method_o => per_cpn_shd.g_old_rec.evaluation_method ,
166 p_renewal_period_frequency_o =>
167 per_cpn_shd.g_old_rec.renewal_period_frequency ,
168 p_renewal_period_units_o => per_cpn_shd.g_old_rec.renewal_period_units ,
169 p_max_level_o => per_cpn_shd.g_old_rec.max_level ,
170 p_min_level_o => per_cpn_shd.g_old_rec.min_level ,
171 p_rating_scale_id_o => per_cpn_shd.g_old_rec.rating_scale_id ,
172 p_attribute_category_o => per_cpn_shd.g_old_rec.attribute_category ,
173 p_attribute1_o => per_cpn_shd.g_old_rec.attribute1 ,
174 p_attribute2_o => per_cpn_shd.g_old_rec.attribute2 ,
175 p_attribute3_o => per_cpn_shd.g_old_rec.attribute3 ,
176 p_attribute4_o => per_cpn_shd.g_old_rec.attribute4 ,
177 p_attribute5_o => per_cpn_shd.g_old_rec.attribute5 ,
178 p_attribute6_o => per_cpn_shd.g_old_rec.attribute6 ,
179 p_attribute7_o => per_cpn_shd.g_old_rec.attribute7 ,
180 p_attribute8_o => per_cpn_shd.g_old_rec.attribute8 ,
181 p_attribute9_o => per_cpn_shd.g_old_rec.attribute9 ,
182 p_attribute10_o => per_cpn_shd.g_old_rec.attribute10 ,
183 p_attribute11_o => per_cpn_shd.g_old_rec.attribute11 ,
184 p_attribute12_o => per_cpn_shd.g_old_rec.attribute12 ,
185 p_attribute13_o => per_cpn_shd.g_old_rec.attribute13 ,
186 p_attribute14_o => per_cpn_shd.g_old_rec.attribute14 ,
187 p_attribute15_o => per_cpn_shd.g_old_rec.attribute15 ,
188 p_attribute16_o => per_cpn_shd.g_old_rec.attribute16 ,
189 p_attribute17_o => per_cpn_shd.g_old_rec.attribute17 ,
190 p_attribute18_o => per_cpn_shd.g_old_rec.attribute18 ,
191 p_attribute19_o => per_cpn_shd.g_old_rec.attribute19 ,
192 p_attribute20_o => per_cpn_shd.g_old_rec.attribute20 ,
193 p_competence_alias_o => per_cpn_shd.g_old_rec.competence_alias,
194 p_competence_definition_id_o => per_cpn_shd.g_old_rec.competence_definition_id
195 ,p_competence_cluster_o => per_cpn_shd.g_old_rec.competence_cluster
196 ,p_unit_standard_id_o => per_cpn_shd.g_old_rec.unit_standard_id
197 ,p_credit_type_o => per_cpn_shd.g_old_rec.credit_type
198 ,p_credits_o => per_cpn_shd.g_old_rec.credits
199 ,p_level_type_o => per_cpn_shd.g_old_rec.level_type
200 ,p_level_number_o => per_cpn_shd.g_old_rec.level_number
201 ,p_field_o => per_cpn_shd.g_old_rec.field
202 ,p_sub_field_o => per_cpn_shd.g_old_rec.sub_field
203 ,p_provider_o => per_cpn_shd.g_old_rec.provider
204 ,p_qa_organization_o => per_cpn_shd.g_old_rec.qa_organization
205 ,p_information_category_o => per_cpn_shd.g_old_rec.information_category
206 ,p_information1_o => per_cpn_shd.g_old_rec.information1
207 ,p_information2_o => per_cpn_shd.g_old_rec.information2
208 ,p_information3_o => per_cpn_shd.g_old_rec.information3
209 ,p_information4_o => per_cpn_shd.g_old_rec.information4
210 ,p_information5_o => per_cpn_shd.g_old_rec.information5
211 ,p_information6_o => per_cpn_shd.g_old_rec.information6
212 ,p_information7_o => per_cpn_shd.g_old_rec.information7
213 ,p_information8_o => per_cpn_shd.g_old_rec.information8
214 ,p_information9_o => per_cpn_shd.g_old_rec.information9
215 ,p_information10_o => per_cpn_shd.g_old_rec.information10
216 ,p_information11_o => per_cpn_shd.g_old_rec.information11
217 ,p_information12_o => per_cpn_shd.g_old_rec.information12
218 ,p_information13_o => per_cpn_shd.g_old_rec.information13
219 ,p_information14_o => per_cpn_shd.g_old_rec.information14
220 ,p_information15_o => per_cpn_shd.g_old_rec.information15
221 ,p_information16_o => per_cpn_shd.g_old_rec.information16
222 ,p_information17_o => per_cpn_shd.g_old_rec.information17
223 ,p_information18_o => per_cpn_shd.g_old_rec.information18
224 ,p_information19_o => per_cpn_shd.g_old_rec.information19
225 ,p_information20_o => per_cpn_shd.g_old_rec.information20
226 );
227 exception
228 when hr_api.cannot_find_prog_unit then
229 hr_api.cannot_find_prog_unit_error
230 ( p_module_name => 'PER_COMPETENCES'
231 ,p_hook_type => 'AD'
232 );
233 end;
234 -- End of API User Hook for post_delete.
235 --
236 hr_utility.set_location(' Leaving:'||l_proc, 10);
237 End post_delete;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |---------------------------------< del >----------------------------------|
241 -- ----------------------------------------------------------------------------
242 Procedure del
243 (
244 p_rec in per_cpn_shd.g_rec_type,
245 p_validate in boolean default false
246 ) is
247 --
248 l_proc varchar2(72) := g_package||'del';
249 --
250 Begin
251 hr_utility.set_location('Entering:'||l_proc, 5);
252 --
253 -- Determine if the business process is to be validated.
254 --
255 If p_validate then
256 --
257 -- Issue the savepoint.
258 --
259 SAVEPOINT del_per_cpn;
260 End If;
261 --
262 -- We must lock the row which we need to delete.
263 --
264 per_cpn_shd.lck
265 (
266 p_rec.competence_id,
267 p_rec.object_version_number
268 );
269 --
270 -- Call the supporting delete validate operation
271 --
272 per_cpn_bus.delete_validate(p_rec);
273 --
274 -- Call the supporting pre-delete operation
275 --
276 pre_delete(p_rec);
277 --
278 -- Delete the row.
279 --
280 delete_dml(p_rec);
281 --
282 -- Call the supporting post-delete operation
283 --
284 post_delete(p_rec);
285 --
286 -- If we are validating then raise the Validate_Enabled exception
287 --
288 If p_validate then
289 Raise HR_Api.Validate_Enabled;
290 End If;
291 --
292 hr_utility.set_location(' Leaving:'||l_proc, 10);
293 Exception
294 When HR_Api.Validate_Enabled Then
295 --
296 -- As the Validate_Enabled exception has been raised
297 -- we must rollback to the savepoint
298 --
299 ROLLBACK TO del_per_cpn;
300 End del;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |---------------------------------< del >----------------------------------|
304 -- ----------------------------------------------------------------------------
305 Procedure del
306 (
307 p_competence_id in number,
308 p_object_version_number in number,
309 p_validate in boolean default false
310 ) is
311 --
312 l_rec per_cpn_shd.g_rec_type;
313 l_proc varchar2(72) := g_package||'del';
314 --
315 Begin
316 hr_utility.set_location('Entering:'||l_proc, 5);
317 --
318 -- As the delete procedure accepts a plsql record structure we do need to
319 -- convert the arguments into the record structure.
320 -- We don't need to call the supplied conversion argument routine as we
321 -- only need a few attributes.
322 --
323 l_rec.competence_id:= p_competence_id;
324 l_rec.object_version_number := p_object_version_number;
325 --
326 -- Having converted the arguments into the per_cpn_rec
327 -- plsql record structure we must call the corresponding entity
328 -- business process
329 --
330 del(l_rec, p_validate);
331 --
332 hr_utility.set_location(' Leaving:'||l_proc, 10);
333 End del;
334 --
335 end per_cpn_del;