DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_PCV_DEL

Source


1 Package Body pqp_pcv_del as
2 /* $Header: pqpcvrhi.pkb 120.0 2005/05/29 01:55:22 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqp_pcv_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- ----------------------< delete_app_ownerships >----------------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description:
15 --   Deletes row(s) from hr_application_ownerships depending on the mode that
16 --   the row handler has been called in.
17 --
18 -- ----------------------------------------------------------------------------
19 PROCEDURE delete_app_ownerships(p_pk_column  IN  varchar2
20                                ,p_pk_value   IN  varchar2) IS
21 --
22 BEGIN
23   --
24   IF (hr_startup_data_api_support.return_startup_mode
25                            IN ('STARTUP','GENERIC')) THEN
26      --
27      DELETE FROM hr_application_ownerships
28       WHERE key_name = p_pk_column
29         AND key_value = p_pk_value;
30      --
31   END IF;
32 END delete_app_ownerships;
33 --
34 -- ----------------------------------------------------------------------------
35 -- ----------------------< delete_app_ownerships >----------------------------|
36 -- ----------------------------------------------------------------------------
37 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
38                                ,p_pk_value  IN number) IS
39 --
40 BEGIN
41   delete_app_ownerships(p_pk_column, to_char(p_pk_value));
42 END delete_app_ownerships;
43 --
44 -- ----------------------------------------------------------------------------
45 -- |------------------------------< delete_dml >------------------------------|
46 -- ----------------------------------------------------------------------------
47 -- {Start Of Comments}
48 --
49 -- Description:
50 --   This procedure controls the actual dml delete logic. The functions of
51 --   this procedure are as follows:
52 --   1) To set and unset the g_api_dml status as required (as we are about to
53 --      perform dml).
54 --   2) To delete the specified row from the schema using the primary key in
55 --      the predicates.
56 --   3) To trap any constraint violations that may have occurred.
57 --   4) To raise any other errors.
58 --
59 -- Prerequisites:
60 --   This is an internal private procedure which must be called from the del
61 --   procedure.
62 --
63 -- In Parameters:
64 --   A Pl/Sql record structre.
65 --
66 -- Post Success:
67 --   The specified row will be delete from the schema.
68 --
69 -- Post Failure:
70 --   On the delete dml failure it is important to note that we always reset the
71 --   g_api_dml status to false.
72 --   If a child integrity constraint violation is raised the
73 --   constraint_error procedure will be called.
74 --   If any other error is reported, the error will be raised after the
75 --   g_api_dml status is reset.
76 --
77 -- Developer Implementation Notes:
78 --   None.
79 --
80 -- Access Status:
81 --   Internal Row Handler Use Only.
82 --
83 -- {End Of Comments}
84 -- ----------------------------------------------------------------------------
85 Procedure delete_dml
86   (p_rec in pqp_pcv_shd.g_rec_type
87   ) is
88 --
89   l_proc  varchar2(72) := g_package||'delete_dml';
90 --
91 Begin
92   hr_utility.set_location('Entering:'||l_proc, 5);
93   --
94   --
95   --
96   -- Delete the pqp_configuration_values row.
97   --
98   delete from pqp_configuration_values
99   where configuration_value_id = p_rec.configuration_value_id;
100   --
101   --
102   --
103   hr_utility.set_location(' Leaving:'||l_proc, 10);
104 --
105 Exception
106   When hr_api.child_integrity_violated then
107     -- Child integrity has been violated
108     --
109     pqp_pcv_shd.constraint_error
110       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
111   When Others Then
112     --
113     Raise;
114 End delete_dml;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |------------------------------< pre_delete >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 --   This private procedure contains any processing which is required before
123 --   the delete dml.
124 --
125 -- Prerequisites:
126 --   This is an internal procedure which is called from the del procedure.
127 --
128 -- In Parameters:
129 --   A Pl/Sql record structre.
130 --
131 -- Post Success:
132 --   Processing continues.
133 --
134 -- Post Failure:
135 --   If an error has occurred, an error message and exception will be raised
136 --   but not handled.
137 --
138 -- Developer Implementation Notes:
139 --   Any pre-processing required before the delete dml is issued should be
140 --   coded within this procedure. It is important to note that any 3rd party
141 --   maintenance should be reviewed before placing in this procedure.
142 --
143 -- Access Status:
144 --   Internal Row Handler Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure pre_delete(p_rec in pqp_pcv_shd.g_rec_type) is
149 --
150   l_proc  varchar2(72) := g_package||'pre_delete';
151 --
152 Begin
153   hr_utility.set_location('Entering:'||l_proc, 5);
154   --
155   hr_utility.set_location(' Leaving:'||l_proc, 10);
156 End pre_delete;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |-----------------------------< post_delete >------------------------------|
160 -- ----------------------------------------------------------------------------
161 -- {Start Of Comments}
162 --
163 -- Description:
164 --   This private procedure contains any processing which is required after
165 --   the delete dml.
166 --
167 -- Prerequistes:
168 --   This is an internal procedure which is called from the del procedure.
169 --
170 -- In Parameters:
171 --   A Pl/Sql record structure.
172 --
173 -- Post Success:
174 --   Processing continues.
175 --
176 -- Post Failure:
177 --   If an error has occurred, an error message and exception will be raised
178 --   but not handled.
179 --
180 -- Developer Implementation Notes:
181 --   Any post-processing required after the delete dml is issued should be
182 --   coded within this procedure. It is important to note that any 3rd party
183 --   maintenance should be reviewed before placing in this procedure.
184 --
185 -- Access Status:
186 --   Internal Row Handler Use Only.
187 --
188 -- {End Of Comments}
189 -- -----------------------------------------------------------------------------
190 Procedure post_delete(p_rec in pqp_pcv_shd.g_rec_type) is
191 --
192   l_proc  varchar2(72) := g_package||'post_delete';
193 --
194 Begin
195   hr_utility.set_location('Entering:'||l_proc, 5);
196   begin
197     --
198     -- Delete ownerships if applicable
199     delete_app_ownerships
200       ('CONFIGURATION_VALUE_ID', p_rec.configuration_value_id
201       );
202     --
203     pqp_pcv_rkd.after_delete
204       (p_configuration_value_id
205       => p_rec.configuration_value_id
206       ,p_business_group_id_o
207       => pqp_pcv_shd.g_old_rec.business_group_id
208       ,p_legislation_code_o
209       => pqp_pcv_shd.g_old_rec.legislation_code
210       ,p_pcv_attribute_category_o
211       => pqp_pcv_shd.g_old_rec.pcv_attribute_category
212       ,p_pcv_attribute1_o
213       => pqp_pcv_shd.g_old_rec.pcv_attribute1
214       ,p_pcv_attribute2_o
215       => pqp_pcv_shd.g_old_rec.pcv_attribute2
216       ,p_pcv_attribute3_o
217       => pqp_pcv_shd.g_old_rec.pcv_attribute3
218       ,p_pcv_attribute4_o
219       => pqp_pcv_shd.g_old_rec.pcv_attribute4
220       ,p_pcv_attribute5_o
221       => pqp_pcv_shd.g_old_rec.pcv_attribute5
222       ,p_pcv_attribute6_o
223       => pqp_pcv_shd.g_old_rec.pcv_attribute6
224       ,p_pcv_attribute7_o
225       => pqp_pcv_shd.g_old_rec.pcv_attribute7
226       ,p_pcv_attribute8_o
227       => pqp_pcv_shd.g_old_rec.pcv_attribute8
228       ,p_pcv_attribute9_o
229       => pqp_pcv_shd.g_old_rec.pcv_attribute9
230       ,p_pcv_attribute10_o
231       => pqp_pcv_shd.g_old_rec.pcv_attribute10
232       ,p_pcv_attribute11_o
233       => pqp_pcv_shd.g_old_rec.pcv_attribute11
234       ,p_pcv_attribute12_o
235       => pqp_pcv_shd.g_old_rec.pcv_attribute12
236       ,p_pcv_attribute13_o
237       => pqp_pcv_shd.g_old_rec.pcv_attribute13
238       ,p_pcv_attribute14_o
239       => pqp_pcv_shd.g_old_rec.pcv_attribute14
240       ,p_pcv_attribute15_o
241       => pqp_pcv_shd.g_old_rec.pcv_attribute15
242       ,p_pcv_attribute16_o
243       => pqp_pcv_shd.g_old_rec.pcv_attribute16
244       ,p_pcv_attribute17_o
245       => pqp_pcv_shd.g_old_rec.pcv_attribute17
246       ,p_pcv_attribute18_o
247       => pqp_pcv_shd.g_old_rec.pcv_attribute18
248       ,p_pcv_attribute19_o
249       => pqp_pcv_shd.g_old_rec.pcv_attribute19
250       ,p_pcv_attribute20_o
251       => pqp_pcv_shd.g_old_rec.pcv_attribute20
252       ,p_pcv_information_category_o
253       => pqp_pcv_shd.g_old_rec.pcv_information_category
254       ,p_pcv_information1_o
255       => pqp_pcv_shd.g_old_rec.pcv_information1
256       ,p_pcv_information2_o
257       => pqp_pcv_shd.g_old_rec.pcv_information2
258       ,p_pcv_information3_o
259       => pqp_pcv_shd.g_old_rec.pcv_information3
260       ,p_pcv_information4_o
261       => pqp_pcv_shd.g_old_rec.pcv_information4
262       ,p_pcv_information5_o
263       => pqp_pcv_shd.g_old_rec.pcv_information5
264       ,p_pcv_information6_o
265       => pqp_pcv_shd.g_old_rec.pcv_information6
266       ,p_pcv_information7_o
267       => pqp_pcv_shd.g_old_rec.pcv_information7
268       ,p_pcv_information8_o
269       => pqp_pcv_shd.g_old_rec.pcv_information8
270       ,p_pcv_information9_o
271       => pqp_pcv_shd.g_old_rec.pcv_information9
272       ,p_pcv_information10_o
273       => pqp_pcv_shd.g_old_rec.pcv_information10
274       ,p_pcv_information11_o
275       => pqp_pcv_shd.g_old_rec.pcv_information11
276       ,p_pcv_information12_o
277       => pqp_pcv_shd.g_old_rec.pcv_information12
278       ,p_pcv_information13_o
279       => pqp_pcv_shd.g_old_rec.pcv_information13
280       ,p_pcv_information14_o
281       => pqp_pcv_shd.g_old_rec.pcv_information14
282       ,p_pcv_information15_o
283       => pqp_pcv_shd.g_old_rec.pcv_information15
284       ,p_pcv_information16_o
285       => pqp_pcv_shd.g_old_rec.pcv_information16
286       ,p_pcv_information17_o
287       => pqp_pcv_shd.g_old_rec.pcv_information17
288       ,p_pcv_information18_o
289       => pqp_pcv_shd.g_old_rec.pcv_information18
290       ,p_pcv_information19_o
291       => pqp_pcv_shd.g_old_rec.pcv_information19
292       ,p_pcv_information20_o
293       => pqp_pcv_shd.g_old_rec.pcv_information20
294       ,p_object_version_number_o
295       => pqp_pcv_shd.g_old_rec.object_version_number
296       ,p_configuration_name_o
297       => pqp_pcv_shd.g_old_rec.configuration_name
298 
299       );
300     --
301   exception
302     --
303     when hr_api.cannot_find_prog_unit then
304       --
305       hr_api.cannot_find_prog_unit_error
306         (p_module_name => 'PQP_CONFIGURATION_VALUES'
307         ,p_hook_type   => 'AD');
308       --
309   end;
310   --
311   hr_utility.set_location(' Leaving:'||l_proc, 10);
312 End post_delete;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |---------------------------------< del >----------------------------------|
316 -- ----------------------------------------------------------------------------
317 Procedure del
318   (p_rec              in pqp_pcv_shd.g_rec_type
319   ) is
320 --
321   l_proc  varchar2(72) := g_package||'del';
322 --
323 Begin
324   hr_utility.set_location('Entering:'||l_proc, 5);
325   --
326   -- We must lock the row which we need to delete.
327   --
328   pqp_pcv_shd.lck
329     (p_rec.configuration_value_id
330     ,p_rec.object_version_number
331     );
332   --
333   -- Call the supporting delete validate operation
334   --
335   pqp_pcv_bus.delete_validate(p_rec);
336   --
337   -- Call to raise any errors on multi-message list
338   hr_multi_message.end_validation_set;
339   --
340   -- Call the supporting pre-delete operation
341   --
342   pqp_pcv_del.pre_delete(p_rec);
343   --
344   -- Delete the row.
345   --
346   pqp_pcv_del.delete_dml(p_rec);
347   --
348   -- Call the supporting post-delete operation
349   --
350   pqp_pcv_del.post_delete(p_rec);
351   --
352   -- Call to raise any errors on multi-message list
353   hr_multi_message.end_validation_set;
354   --
355 End del;
356 --
357 -- ----------------------------------------------------------------------------
358 -- |---------------------------------< del >----------------------------------|
359 -- ----------------------------------------------------------------------------
360 Procedure del
361   (p_configuration_value_id               in     number
362   ,p_object_version_number                in     number
363   ) is
364 --
365   l_rec   pqp_pcv_shd.g_rec_type;
366   l_proc  varchar2(72) := g_package||'del';
367 --
368 Begin
369   hr_utility.set_location('Entering:'||l_proc, 5);
370   --
371   -- As the delete procedure accepts a plsql record structure we do need to
372   -- convert the  arguments into the record structure.
373   -- We don't need to call the supplied conversion argument routine as we
374   -- only need a few attributes.
375   --
376   l_rec.configuration_value_id := p_configuration_value_id;
377   l_rec.object_version_number := p_object_version_number;
378   --
379   -- Having converted the arguments into the pqp_pcv_rec
380   -- plsql record structure we must call the corresponding entity
381   -- business process
382   --
383   pqp_pcv_del.del(l_rec);
384   --
385   hr_utility.set_location(' Leaving:'||l_proc, 10);
386 End del;
387 --
388 end pqp_pcv_del;