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