1 Package Body pqp_erg_del as
2 /* $Header: pqergrhi.pkb 115.9 2003/02/19 02:25:55 sshetty noship $ */
3
4 --
5 -- ----------------------------------------------------------------------------
6 -- | Private Global Definitions |
7 -- ----------------------------------------------------------------------------
8 --
9 g_package varchar2(33) := ' pqp_erg_del.'; -- Global package name
10 --
11 -- ----------------------------------------------------------------------------
12 -- ----------------------< delete_app_ownerships >----------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description:
16 -- Deletes row(s) from hr_application_ownerships depending on the mode that
17 -- the row handler has been called in.
18 --
19 -- ----------------------------------------------------------------------------
20 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
21 ,p_pk_value IN varchar2) IS
22 --
23 BEGIN
24 --
25 IF (hr_startup_data_api_support.return_startup_mode
26 IN ('STARTUP','GENERIC')) THEN
27 --
28 DELETE FROM hr_application_ownerships
29 WHERE key_name = p_pk_column
30 AND key_value = p_pk_value;
31 --
32 END IF;
33 END delete_app_ownerships;
34 --
35 -- ----------------------------------------------------------------------------
36 -- ----------------------< delete_app_ownerships >----------------------------|
37 -- ----------------------------------------------------------------------------
38 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
39 ,p_pk_value IN number) IS
40 --
41 BEGIN
42 delete_app_ownerships(p_pk_column, to_char(p_pk_value));
43 END delete_app_ownerships;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |------------------------------< delete_dml >------------------------------|
47 -- ----------------------------------------------------------------------------
48 -- {Start Of Comments}
49 --
50 -- Description:
51 -- This procedure controls the actual dml delete logic. The functions of
52 -- this procedure are as follows:
53 -- 1) To set and unset the g_api_dml status as required (as we are about to
54 -- perform dml).
55 -- 2) To delete the specified row from the schema using the primary key in
56 -- the predicates.
57 -- 3) To trap any constraint violations that may have occurred.
58 -- 4) To raise any other errors.
59 --
60 -- Prerequisites:
61 -- This is an internal private procedure which must be called from the del
62 -- procedure.
63 --
64 -- In Parameters:
65 -- A Pl/Sql record structre.
66 --
67 -- Post Success:
68 -- The specified row will be delete from the schema.
69 --
70 -- Post Failure:
71 -- On the delete dml failure it is important to note that we always reset the
72 -- g_api_dml status to false.
73 -- If a child integrity constraint violation is raised the
74 -- constraint_error procedure will be called.
75 -- If any other error is reported, the error will be raised after the
76 -- g_api_dml status is reset.
77 --
78 -- Developer Implementation Notes:
79 -- None.
80 --
81 -- Access Status:
82 -- Internal Row Handler Use Only.
83 --
84 -- {End Of Comments}
85 -- ----------------------------------------------------------------------------
86 Procedure delete_dml
87 (p_rec in pqp_erg_shd.g_rec_type
88 ) is
89 --
90 l_proc varchar2(72) := g_package||'delete_dml';
91 --
92 Begin
93 hr_utility.set_location('Entering:'||l_proc, 5);
94 --
95 pqp_erg_shd.g_api_dml := true; -- Set the api dml status
96 --
97 -- Delete the pqp_exception_report_groups row.
98 --
99 delete from pqp_exception_report_groups
100 where exception_group_id = p_rec.exception_group_id;
101 --
102 pqp_erg_shd.g_api_dml := false; -- Unset the api dml status
103 --
104 hr_utility.set_location(' Leaving:'||l_proc, 10);
105 --
106 Exception
107 When hr_api.child_integrity_violated then
108 -- Child integrity has been violated
109 pqp_erg_shd.g_api_dml := false; -- Unset the api dml status
110 pqp_erg_shd.constraint_error
111 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
112 When Others Then
113 pqp_erg_shd.g_api_dml := false; -- Unset the api dml status
114 Raise;
115 End delete_dml;
116 --
117 -- ----------------------------------------------------------------------------
118 -- |------------------------------< pre_delete >------------------------------|
119 -- ----------------------------------------------------------------------------
120 -- {Start Of Comments}
121 --
122 -- Description:
123 -- This private procedure contains any processing which is required before
124 -- the delete dml.
125 --
126 -- Prerequisites:
127 -- This is an internal procedure which is called from the del procedure.
128 --
129 -- In Parameters:
130 -- A Pl/Sql record structre.
131 --
132 -- Post Success:
133 -- Processing continues.
134 --
135 -- Post Failure:
136 -- If an error has occurred, an error message and exception will be raised
137 -- but not handled.
138 --
139 -- Developer Implementation Notes:
140 -- Any pre-processing required before the delete dml is issued should be
141 -- coded within this procedure. It is important to note that any 3rd party
142 -- maintenance should be reviewed before placing in this procedure.
143 --
144 -- Access Status:
145 -- Internal Row Handler Use Only.
146 --
147 -- {End Of Comments}
148 -- ----------------------------------------------------------------------------
149 Procedure pre_delete(p_rec in pqp_erg_shd.g_rec_type) is
150 --
151 l_proc varchar2(72) := g_package||'pre_delete';
152 --
153 Begin
154 hr_utility.set_location('Entering:'||l_proc, 5);
155 --
156 hr_utility.set_location(' Leaving:'||l_proc, 10);
157 End pre_delete;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |-----------------------------< post_delete >------------------------------|
161 -- ----------------------------------------------------------------------------
162 -- {Start Of Comments}
163 --
164 -- Description:
165 -- This private procedure contains any processing which is required after
166 -- the delete dml.
167 --
168 -- Prerequistes:
169 -- This is an internal procedure which is called from the del procedure.
170 --
171 -- In Parameters:
172 -- A Pl/Sql record structure.
173 --
174 -- Post Success:
175 -- Processing continues.
176 --
177 -- Post Failure:
178 -- If an error has occurred, an error message and exception will be raised
179 -- but not handled.
180 --
181 -- Developer Implementation Notes:
182 -- Any post-processing required after the delete dml is issued should be
183 -- coded within this procedure. It is important to note that any 3rd party
184 -- maintenance should be reviewed before placing in this procedure.
185 --
186 -- Access Status:
187 -- Internal Row Handler Use Only.
188 --
189 -- {End Of Comments}
190 -- -----------------------------------------------------------------------------
191 Procedure post_delete(p_rec in pqp_erg_shd.g_rec_type) is
192 --
193 l_proc varchar2(72) := g_package||'post_delete';
194 --
195 Begin
196 hr_utility.set_location('Entering:'||l_proc, 5);
197 begin
198 --
199 pqp_erg_rkd.after_delete
200 (p_exception_group_id
201 => p_rec.exception_group_id
202 ,p_exception_group_name_o
203 => pqp_erg_shd.g_old_rec.exception_group_name
204 ,p_exception_report_id_o
205 => pqp_erg_shd.g_old_rec.exception_report_id
206 ,p_legislation_code_o
207 => pqp_erg_shd.g_old_rec.legislation_code
208 ,p_business_group_id_o
209 => pqp_erg_shd.g_old_rec.business_group_id
210 ,p_consolidation_set_id_o
211 => pqp_erg_shd.g_old_rec.consolidation_set_id
212 ,p_payroll_id_o
213 => pqp_erg_shd.g_old_rec.payroll_id
214 ,p_object_version_number_o
215 => pqp_erg_shd.g_old_rec.object_version_number
216 );
217 --
218 exception
219 --
220 when hr_api.cannot_find_prog_unit then
221 --
222 hr_api.cannot_find_prog_unit_error
223 (p_module_name => 'PQP_EXCEPTION_REPORT_GROUPS'
224 ,p_hook_type => 'AD');
225 --
226 end;
227 --
228 hr_utility.set_location(' Leaving:'||l_proc, 10);
229 End post_delete;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |---------------------------------< del >----------------------------------|
233 -- ----------------------------------------------------------------------------
234 Procedure del
235 (p_rec in pqp_erg_shd.g_rec_type
236 ) is
237 --
238 l_proc varchar2(72) := g_package||'del';
239 l_rec pqp_erg_shd.g_rec_type;
240 --
241 Begin
242 hr_utility.set_location('Entering:'||l_proc, 5);
243 --
244 -- We must lock the row which we need to delete.
245 --
246
247 pqp_erg_shd.lck
248 (p_rec.exception_group_id
249 ,p_rec.object_version_number
250 );
251 --
252 -- added by skutteti as the delete_validate needs the leg code and bg
253 --
254 l_rec := p_rec;
255 l_rec.business_group_id := pqp_erg_shd.g_old_rec.business_group_id;
256 l_rec.legislation_code := pqp_erg_shd.g_old_rec.legislation_code;
257 --
258 -- Call the supporting delete validate operation
259 --
260 pqp_erg_bus.delete_validate(l_rec);
261 --
262 -- Call the supporting pre-delete operation
263 --
264 pqp_erg_del.pre_delete(p_rec);
265 --
266 -- Delete the row.
267 --
268 pqp_erg_del.delete_dml(p_rec);
269 --
270 -- Call the supporting post-delete operation
271 --
272 pqp_erg_del.post_delete(p_rec);
273 --
274 End del;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |---------------------------------< del >----------------------------------|
278 -- ----------------------------------------------------------------------------
279 Procedure del
280 (p_exception_group_id in number
281 ,p_object_version_number in number
282 ) is
283 --
284 l_rec pqp_erg_shd.g_rec_type;
285 l_proc varchar2(72) := g_package||'del';
286 --
287 Begin
288 hr_utility.set_location('Entering:'||l_proc, 5);
289 --
290 -- As the delete procedure accepts a plsql record structure we do need to
291 -- convert the arguments into the record structure.
292 -- We don't need to call the supplied conversion argument routine as we
293 -- only need a few attributes.
294 --
295 l_rec.exception_group_id := p_exception_group_id;
296 l_rec.object_version_number := p_object_version_number;
297 --
298 -- Having converted the arguments into the pqp_erg_rec
299 -- plsql record structure we must call the corresponding entity
300 -- business process
301 --
302 pqp_erg_del.del(l_rec);
303 --
304 hr_utility.set_location(' Leaving:'||l_proc, 10);
305 End del;
306 --
307 end pqp_erg_del;