1 Package Body per_stc_del as
2 /* $Header: pestcrhi.pkb 120.3 2011/06/17 15:21:44 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_stc_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
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 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml
52 (p_rec in per_stc_shd.g_rec_type
53 ) is
54 --
55 l_proc varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58 hr_utility.set_location('Entering:'||l_proc, 5);
59 --
60 --
61 -- Added the following code as a part of Zero Downtime Patching Project.
62 -- Code Starts Here.
63 --
64 --
65 per_ric_pkg.Chk_integrity(
66 p_entity_name=> 'PER_SOLUTION_TYPE_CMPTS',
67 p_ref_entity=>'PER_SOLUTIONS',
68 p_ref_column_name=>'SOLUTION_TYPE_NAME',
69 -- Start changes for bug 12639446
70 p_ref_col_value_number=>NULL,
71 p_ref_col_value_varchar=>p_rec.solution_type_name,
72 -- End changes for bug 12639446
73 p_ref_col_value_date=>NULL,
74 p_ref_type=>'DEL');
75 --
76 --
77 -- Code Ends Here
78 --
79 -- Delete the per_solution_type_cmpts row.
80 --
81 delete from per_solution_type_cmpts
82 where component_name = p_rec.component_name
83 and solution_type_name = p_rec.solution_type_name;
84 --
85 --
86 --
87 hr_utility.set_location(' Leaving:'||l_proc, 10);
88 --
89 Exception
90 When hr_api.child_integrity_violated then
91 -- Child integrity has been violated
92 --
93 per_stc_shd.constraint_error
94 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
95 When Others Then
96 --
97 Raise;
98 End delete_dml;
99 --
100 -- ----------------------------------------------------------------------------
101 -- |------------------------------< pre_delete >------------------------------|
102 -- ----------------------------------------------------------------------------
103 -- {Start Of Comments}
104 --
105 -- Description:
106 -- This private procedure contains any processing which is required before
107 -- the delete dml.
108 --
109 -- Prerequisites:
110 -- This is an internal procedure which is called from the del procedure.
111 --
112 -- In Parameters:
113 -- A Pl/Sql record structre.
114 --
115 -- Post Success:
116 -- Processing continues.
117 --
118 -- Post Failure:
119 -- If an error has occurred, an error message and exception will be raised
120 -- but not handled.
121 --
122 -- Developer Implementation Notes:
123 -- Any pre-processing required before the delete dml is issued should be
124 -- coded within this procedure. It is important to note that any 3rd party
125 -- maintenance should be reviewed before placing in this procedure.
126 --
127 -- Access Status:
128 -- Internal Row Handler Use Only.
129 --
130 -- {End Of Comments}
131 -- ----------------------------------------------------------------------------
132 Procedure pre_delete(p_rec in per_stc_shd.g_rec_type) is
133 --
134 l_proc varchar2(72) := g_package||'pre_delete';
135 --
136 Begin
137 hr_utility.set_location('Entering:'||l_proc, 5);
138 --
139 hr_utility.set_location(' Leaving:'||l_proc, 10);
140 End pre_delete;
141 --
142 -- ----------------------------------------------------------------------------
143 -- |-----------------------------< post_delete >------------------------------|
144 -- ----------------------------------------------------------------------------
145 -- {Start Of Comments}
146 --
147 -- Description:
148 -- This private procedure contains any processing which is required after
149 -- the delete dml.
150 --
151 -- Prerequistes:
152 -- This is an internal procedure which is called from the del procedure.
153 --
154 -- In Parameters:
155 -- A Pl/Sql record structure.
156 --
157 -- Post Success:
158 -- Processing continues.
159 --
160 -- Post Failure:
161 -- If an error has occurred, an error message and exception will be raised
162 -- but not handled.
163 --
164 -- Developer Implementation Notes:
165 -- Any post-processing required after the delete dml is issued should be
166 -- coded within this procedure. It is important to note that any 3rd party
167 -- maintenance should be reviewed before placing in this procedure.
168 --
169 -- Access Status:
170 -- Internal Row Handler Use Only.
171 --
172 -- {End Of Comments}
173 -- -----------------------------------------------------------------------------
174 Procedure post_delete(p_rec in per_stc_shd.g_rec_type) is
175 --
176 l_proc varchar2(72) := g_package||'post_delete';
177 --
178 Begin
179 hr_utility.set_location('Entering:'||l_proc, 5);
180 begin
181 --
182 per_stc_rkd.after_delete
183 (p_component_name
184 => p_rec.component_name
185 ,p_solution_type_name
186 => p_rec.solution_type_name
187 ,p_legislation_code
188 => p_rec.legislation_code
189 ,p_api_name_o
190 => per_stc_shd.g_old_rec.api_name
191 ,p_parent_component_name_o
192 => per_stc_shd.g_old_rec.parent_component_name
193 ,p_updateable_o
194 => per_stc_shd.g_old_rec.updateable
195 ,p_extensible_o
196 => per_stc_shd.g_old_rec.extensible
197 ,p_object_version_number_o
198 => per_stc_shd.g_old_rec.object_version_number
199 );
200 --
201 exception
202 --
203 when hr_api.cannot_find_prog_unit then
204 --
205 hr_api.cannot_find_prog_unit_error
206 (p_module_name => 'PER_SOLUTION_TYPE_CMPTS'
207 ,p_hook_type => 'AD');
208 --
209 end;
210 --
211 hr_utility.set_location(' Leaving:'||l_proc, 10);
212 End post_delete;
213 --
214 -- ----------------------------------------------------------------------------
215 -- |---------------------------------< del >----------------------------------|
216 -- ----------------------------------------------------------------------------
217 Procedure del
218 (p_rec in per_stc_shd.g_rec_type
219 ) is
220 --
221 l_proc varchar2(72) := g_package||'del';
222 --
223 Begin
224 hr_utility.set_location('Entering:'||l_proc, 5);
225 --
226 -- We must lock the row which we need to delete.
227 --
228 per_stc_shd.lck
229 (p_rec.component_name
230 ,p_rec.solution_type_name
231 ,p_rec.legislation_code
232 ,p_rec.object_version_number
233 );
234 --
235 -- Call the supporting delete validate operation
236 --
237 per_stc_bus.delete_validate(p_rec);
238 --
239 -- Call to raise any errors on multi-message list
240 hr_multi_message.end_validation_set;
241 --
242 -- Call the supporting pre-delete operation
243 --
244 per_stc_del.pre_delete(p_rec);
245 --
246 -- Delete the row.
247 --
248 per_stc_del.delete_dml(p_rec);
249 --
250 -- Call the supporting post-delete operation
251 --
252 per_stc_del.post_delete(p_rec);
253 --
254 -- Call to raise any errors on multi-message list
255 hr_multi_message.end_validation_set;
256 --
257 End del;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |---------------------------------< del >----------------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure del
263 (p_component_name in varchar2
264 ,p_solution_type_name in varchar2
265 ,p_legislation_code in varchar2
266 ,p_object_version_number in number
267 ) is
268 --
269 l_rec per_stc_shd.g_rec_type;
270 l_proc varchar2(72) := g_package||'del';
271 --
272 Begin
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275 -- As the delete procedure accepts a plsql record structure we do need to
276 -- convert the arguments into the record structure.
277 -- We don't need to call the supplied conversion argument routine as we
278 -- only need a few attributes.
279 --
280 l_rec.component_name := p_component_name;
281 l_rec.solution_type_name := p_solution_type_name;
282 l_rec.legislation_code := p_legislation_code;
283 l_rec.object_version_number := p_object_version_number;
284 --
285 -- Having converted the arguments into the per_stc_rec
286 -- plsql record structure we must call the corresponding entity
287 -- business process
288 --
289 per_stc_del.del(l_rec);
290 --
291 hr_utility.set_location(' Leaving:'||l_proc, 10);
292 End del;
293 --
294 end per_stc_del;