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