1 Package Body per_pss_del as
2 /* $Header: pepssrhi.pkb 120.1 2006/08/08 11:27:06 amigarg noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pss_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(p_rec in per_pss_shd.g_rec_type) is
52 --
53 l_proc varchar2(72) := g_package||'delete_dml';
54 --
55 Begin
56 hr_utility.set_location('Entering:'||l_proc, 5);
57 --
58 --
59 -- Delete the per_salary_surveys row.
60 --
61 delete from per_salary_surveys
62 where salary_survey_id = p_rec.salary_survey_id;
63 --
64 --
65 hr_utility.set_location(' Leaving:'||l_proc, 10);
66 --
67 Exception
68 When hr_api.child_integrity_violated then
69 -- Child integrity has been violated
70 per_pss_shd.constraint_error
71 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
72 When Others Then
73 Raise;
74 End delete_dml;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------------------------------< pre_delete >------------------------------|
78 -- ----------------------------------------------------------------------------
79 -- {Start Of Comments}
80 --
81 -- Description:
82 -- This private procedure contains any processing which is required before
83 -- the delete dml.
84 --
85 -- Prerequisites:
86 -- This is an internal procedure which is called from the del procedure.
87 --
88 -- In Parameters:
89 -- A Pl/Sql record structre.
90 --
91 -- Post Success:
92 -- Processing continues.
93 --
94 -- Post Failure:
95 -- If an error has occurred, an error message and exception will be raised
96 -- but not handled.
97 --
98 -- Developer Implementation Notes:
99 -- Any pre-processing required before the delete dml is issued should be
100 -- coded within this procedure. It is important to note that any 3rd party
101 -- maintenance should be reviewed before placing in this procedure.
102 --
103 -- Access Status:
104 -- Internal Row Handler Use Only.
105 --
106 -- {End Of Comments}
107 -- ----------------------------------------------------------------------------
108 Procedure pre_delete(p_rec in per_pss_shd.g_rec_type) is
109 --
110 l_proc varchar2(72) := g_package||'pre_delete';
111 --
112 Begin
113 hr_utility.set_location('Entering:'||l_proc, 5);
114 --
115 hr_utility.set_location(' Leaving:'||l_proc, 10);
116 End pre_delete;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |-----------------------------< post_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This private procedure contains any processing which is required after the
125 -- delete dml.
126 --
127 -- Prerequisites:
128 -- This is an internal procedure which is called from the del procedure.
129 --
130 -- In Parameters:
131 -- A Pl/Sql record structre.
132 --
133 -- Post Success:
134 -- Processing continues.
135 --
136 -- Post Failure:
137 -- If an error has occurred, an error message and exception will be raised
138 -- but not handled.
139 --
140 -- Developer Implementation Notes:
141 -- Any post-processing required after the delete dml is issued should be
142 -- coded within this procedure. It is important to note that any 3rd party
143 -- maintenance should be reviewed before placing in this procedure.
144 --
145 -- Access Status:
146 -- Internal table Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- ----------------------------------------------------------------------------
150 Procedure post_delete(p_rec in per_pss_shd.g_rec_type) is
151 --
152 l_proc varchar2(72) := g_package||'post_delete';
153 --
154 Begin
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 begin
158 per_pss_rkd.after_delete
159 (p_salary_survey_id
160 => p_rec.salary_survey_id,
161 p_object_version_number_o
162 => per_pss_shd.g_old_rec.object_version_number,
163 p_survey_name_o
164 => per_pss_shd.g_old_rec.survey_name,
165 p_survey_company_code_o
166 => p_rec.survey_company_code,
167 p_identifier_o
168 => p_rec.identifier,
169 --ras p_currency_code_o
170 --ras => per_pss_shd.g_old_rec.currency_code,
171 p_survey_type_code_o
172 => per_pss_shd.g_old_rec.survey_type_code,
173 p_base_region_o
174 => per_pss_shd.g_old_rec.base_region,
175 p_attribute_category_o
176 => per_pss_shd.g_old_rec.attribute_category,
177 p_attribute1_o
178 => per_pss_shd.g_old_rec.attribute1,
179 p_attribute2_o
180 => per_pss_shd.g_old_rec.attribute2,
181 p_attribute3_o
182 => per_pss_shd.g_old_rec.attribute3,
183 p_attribute4_o
184 => per_pss_shd.g_old_rec.attribute4,
185 p_attribute5_o
186 => per_pss_shd.g_old_rec.attribute5,
187 p_attribute6_o
188 => per_pss_shd.g_old_rec.attribute6,
189 p_attribute7_o
190 => per_pss_shd.g_old_rec.attribute7,
191 p_attribute8_o
192 => per_pss_shd.g_old_rec.attribute8,
193 p_attribute9_o
194 => per_pss_shd.g_old_rec.attribute9,
195 p_attribute10_o
196 => per_pss_shd.g_old_rec.attribute10,
197 p_attribute11_o
198 => per_pss_shd.g_old_rec.attribute11,
199 p_attribute12_o
200 => per_pss_shd.g_old_rec.attribute12,
201 p_attribute13_o
202 => per_pss_shd.g_old_rec.attribute13,
203 p_attribute14_o
204 => per_pss_shd.g_old_rec.attribute14,
205 p_attribute15_o
206 => per_pss_shd.g_old_rec.attribute15,
207 p_attribute16_o
208 => per_pss_shd.g_old_rec.attribute16,
209 p_attribute17_o
210 => per_pss_shd.g_old_rec.attribute17,
211 p_attribute18_o
212 => per_pss_shd.g_old_rec.attribute18,
213 p_attribute19_o
214 => per_pss_shd.g_old_rec.attribute19,
215 p_attribute20_o
216 => per_pss_shd.g_old_rec.attribute20
217 );
218
219 exception
220 when hr_api.cannot_find_prog_unit then
221 hr_api.cannot_find_prog_unit_error
222 (p_module_name => 'PER_SALARY_SURVEYS'
223 ,p_hook_type => 'AD'
224 );
225 end;
226 --
227 hr_utility.set_location(' Leaving:'||l_proc, 10);
228 --
229 End post_delete;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |---------------------------------< del >----------------------------------|
233 -- ----------------------------------------------------------------------------
234 Procedure del
235 (
236 p_rec in per_pss_shd.g_rec_type
237 ) is
238 --
239 l_proc varchar2(72) := g_package||'del';
240 --
241 Begin
242 hr_utility.set_location('Entering:'||l_proc, 5);
243 --
244 -- We must lock the row which we need to delete.
245 --
246 per_pss_shd.lck
247 (
248 p_rec.salary_survey_id,
249 p_rec.object_version_number
250 );
251 --
252 -- Call the supporting delete validate operation
253 --
254 per_pss_bus.delete_validate(p_rec);
255 --
256 -- Call the supporting pre-delete operation
257 --
258 pre_delete(p_rec);
259 --
260 -- Delete the row.
261 --
262 delete_dml(p_rec);
263 --
264 -- Call the supporting post-delete operation
265 --
266 post_delete(p_rec);
267 End del;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |---------------------------------< del >----------------------------------|
271 -- ----------------------------------------------------------------------------
272 Procedure del
273 (
274 p_salary_survey_id in number,
275 p_object_version_number in number
276 ) is
277 --
278 l_rec per_pss_shd.g_rec_type;
279 l_proc varchar2(72) := g_package||'del';
280 --
281 Begin
282 hr_utility.set_location('Entering:'||l_proc, 5);
283 --
284 -- As the delete procedure accepts a plsql record structure we do need to
285 -- convert the arguments into the record structure.
286 -- We don't need to call the supplied conversion argument routine as we
287 -- only need a few attributes.
288 --
289 l_rec.salary_survey_id:= p_salary_survey_id;
290 l_rec.object_version_number := p_object_version_number;
291 --
292 -- Having converted the arguments into the per_pss_rec
293 -- plsql record structure we must call the corresponding entity
294 -- business process
295 --
296 del(l_rec);
297 --
298 hr_utility.set_location(' Leaving:'||l_proc, 10);
299 End del;
300 --
301 end per_pss_del;