1 Package Body per_sol_del as
2 /* $Header: pesolrhi.pkb 120.3 2011/06/20 06:28:22 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sol_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_sol_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 --
62 -- Added the following code as a part of Zero Downtime Patching Project.
63 -- Code Starts Here.
64 --
65 PER_RIC_PKG.chk_integrity(
66 p_entity_name=>'PER_SOLUTIONS',
67 p_ref_entity_info=>
68 PER_RIC_PKG.ref_entity_tbl(
69 PER_RIC_PKG.ref_info_rec('PER_SOLUTIONS_SELECTED',PER_RIC_PKG.column_info_tbl(
70 PER_RIC_PKG.col_info_rec('SOLUTION_ID',NULL, p_rec.solution_id,NULL))),
71 PER_RIC_PKG.ref_info_rec('PER_SOLUTION_CMPT_NAMES',PER_RIC_PKG.column_info_tbl(
72 PER_RIC_PKG.col_info_rec('SOLUTION_ID', NULL,p_rec.solution_id, NULL)))),
73 p_ref_type=>'DEL');
74 --
75 -- Code Ends Here
76 --
77 --
78 -- Delete the per_solutions row.
79 --
80 delete from per_solutions
81 where solution_id = p_rec.solution_id;
82 --
83 --
84 --
85 hr_utility.set_location(' Leaving:'||l_proc, 10);
86 --
87 Exception
88 When hr_api.child_integrity_violated then
89 -- Child integrity has been violated
90 --
91 per_sol_shd.constraint_error
92 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
93 When Others Then
94 --
95 Raise;
96 End delete_dml;
97 --
98 -- ----------------------------------------------------------------------------
99 -- |------------------------------< pre_delete >------------------------------|
100 -- ----------------------------------------------------------------------------
101 -- {Start Of Comments}
102 --
103 -- Description:
104 -- This private procedure contains any processing which is required before
105 -- the delete dml.
106 --
107 -- Prerequisites:
108 -- This is an internal procedure which is called from the del procedure.
109 --
110 -- In Parameters:
111 -- A Pl/Sql record structre.
112 --
113 -- Post Success:
114 -- Processing continues.
115 --
116 -- Post Failure:
117 -- If an error has occurred, an error message and exception will be raised
118 -- but not handled.
119 --
120 -- Developer Implementation Notes:
121 -- Any pre-processing required before the delete dml is issued should be
122 -- coded within this procedure. It is important to note that any 3rd party
123 -- maintenance should be reviewed before placing in this procedure.
124 --
125 -- Access Status:
126 -- Internal Row Handler Use Only.
127 --
128 -- {End Of Comments}
129 -- ----------------------------------------------------------------------------
130 Procedure pre_delete(p_rec in per_sol_shd.g_rec_type) is
131 --
132 l_proc varchar2(72) := g_package||'pre_delete';
133 --
134 Begin
135 hr_utility.set_location('Entering:'||l_proc, 5);
136 --
137 hr_utility.set_location(' Leaving:'||l_proc, 10);
138 End pre_delete;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |-----------------------------< post_delete >------------------------------|
142 -- ----------------------------------------------------------------------------
143 -- {Start Of Comments}
144 --
145 -- Description:
146 -- This private procedure contains any processing which is required after
147 -- the delete dml.
148 --
149 -- Prerequistes:
150 -- This is an internal procedure which is called from the del procedure.
151 --
152 -- In Parameters:
153 -- A Pl/Sql record structure.
154 --
155 -- Post Success:
156 -- Processing continues.
157 --
158 -- Post Failure:
159 -- If an error has occurred, an error message and exception will be raised
160 -- but not handled.
161 --
162 -- Developer Implementation Notes:
163 -- Any post-processing required after the delete dml is issued should be
164 -- coded within this procedure. It is important to note that any 3rd party
165 -- maintenance should be reviewed before placing in this procedure.
166 --
167 -- Access Status:
168 -- Internal Row Handler Use Only.
169 --
170 -- {End Of Comments}
171 -- -----------------------------------------------------------------------------
172 Procedure post_delete(p_rec in per_sol_shd.g_rec_type) is
173 --
174 l_proc varchar2(72) := g_package||'post_delete';
175 --
176 Begin
177 hr_utility.set_location('Entering:'||l_proc, 5);
178 begin
179 --
180 per_sol_rkd.after_delete
181 (p_solution_id
182 => p_rec.solution_id
183 ,p_solution_name_o
184 => per_sol_shd.g_old_rec.solution_name
185 ,p_description_o
186 => per_sol_shd.g_old_rec.description
187 ,p_link_to_full_description_o
188 => per_sol_shd.g_old_rec.link_to_full_description
189 ,p_solution_type_name_o
190 => per_sol_shd.g_old_rec.solution_type_name
191 ,p_vertical_o
192 => per_sol_shd.g_old_rec.vertical
193 ,p_legislation_code_o
194 => per_sol_shd.g_old_rec.legislation_code
195 ,p_user_id_o
196 => per_sol_shd.g_old_rec.user_id
197 ,p_object_version_number_o
198 => per_sol_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_SOLUTIONS'
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_sol_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_sol_shd.lck
229 (p_rec.solution_id
230 ,p_rec.object_version_number
231 );
232 --
233 -- Call the supporting delete validate operation
234 --
235 per_sol_bus.delete_validate(p_rec);
236 --
237 -- Call to raise any errors on multi-message list
238 hr_multi_message.end_validation_set;
239 --
240 -- Call the supporting pre-delete operation
241 --
242 per_sol_del.pre_delete(p_rec);
243 --
244 -- Delete the row.
245 --
246 per_sol_del.delete_dml(p_rec);
247 --
248 -- Call the supporting post-delete operation
249 --
250 per_sol_del.post_delete(p_rec);
251 --
252 -- Call to raise any errors on multi-message list
253 hr_multi_message.end_validation_set;
254 --
255 End del;
256 --
257 -- ----------------------------------------------------------------------------
258 -- |---------------------------------< del >----------------------------------|
259 -- ----------------------------------------------------------------------------
260 Procedure del
261 (p_solution_id in number
262 ,p_object_version_number in number
263 ) is
264 --
265 l_rec per_sol_shd.g_rec_type;
266 l_proc varchar2(72) := g_package||'del';
267 --
268 Begin
269 hr_utility.set_location('Entering:'||l_proc, 5);
270 --
271 -- As the delete procedure accepts a plsql record structure we do need to
272 -- convert the arguments into the record structure.
273 -- We don't need to call the supplied conversion argument routine as we
274 -- only need a few attributes.
275 --
276 l_rec.solution_id := p_solution_id;
277 l_rec.object_version_number := p_object_version_number;
278 --
279 -- Having converted the arguments into the per_sol_rec
280 -- plsql record structure we must call the corresponding entity
281 -- business process
282 --
283 per_sol_del.del(l_rec);
284 --
285 hr_utility.set_location(' Leaving:'||l_proc, 10);
286 End del;
287 --
288 end per_sol_del;