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