1 Package Body pay_apr_del as
2 /* $Header: pyaprrhi.pkb 120.0.12000000.1 2007/01/17 15:39:22 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33);
9 --
10 -- ----------------------------------------------------------------------------
11 -- ----------------------< delete_app_ownerships >----------------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description:
15 -- Deletes row(s) from hr_application_ownerships depending on the mode that
16 -- the row handler has been called in.
17 --
18 -- ----------------------------------------------------------------------------
19 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
20 ,p_pk_value IN varchar2) IS
21 --
22 BEGIN
23 --
24 IF (hr_startup_data_api_support.return_startup_mode
25 IN ('STARTUP','GENERIC')) THEN
26 --
27 DELETE FROM hr_application_ownerships
28 WHERE key_name = p_pk_column
29 AND key_value = p_pk_value;
30 --
31 END IF;
32 END delete_app_ownerships;
33 --
34 -- ----------------------------------------------------------------------------
35 -- ----------------------< delete_app_ownerships >----------------------------|
36 -- ----------------------------------------------------------------------------
37 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
38 ,p_pk_value IN number) IS
39 --
40 BEGIN
41 delete_app_ownerships(p_pk_column, to_char(p_pk_value));
42 END delete_app_ownerships;
43 --
44 -- ----------------------------------------------------------------------------
45 -- |------------------------------< delete_dml >------------------------------|
46 -- ----------------------------------------------------------------------------
47 -- {Start Of Comments}
48 --
49 -- Description:
50 -- This procedure controls the actual dml delete logic. The functions of
51 -- this procedure are as follows:
52 -- 1) To set and unset the g_api_dml status as required (as we are about to
53 -- perform dml).
54 -- 2) To delete the specified row from the schema using the primary key in
55 -- the predicates.
56 -- 3) To trap any constraint violations that may have occurred.
57 -- 4) To raise any other errors.
58 --
59 -- Prerequisites:
60 -- This is an internal private procedure which must be called from the del
61 -- procedure.
62 --
63 -- In Parameters:
64 -- A Pl/Sql record structre.
65 --
66 -- Post Success:
67 -- The specified row will be delete from the schema.
68 --
69 -- Post Failure:
70 -- On the delete dml failure it is important to note that we always reset the
71 -- g_api_dml status to false.
72 -- If a child integrity constraint violation is raised the
73 -- constraint_error procedure will be called.
74 -- If any other error is reported, the error will be raised after the
75 -- g_api_dml status is reset.
76 --
77 -- Developer Implementation Notes:
78 -- None.
79 --
80 -- Access Status:
81 -- Internal Row Handler Use Only.
82 --
83 -- {End Of Comments}
84 -- ----------------------------------------------------------------------------
85 Procedure delete_dml
86 (p_rec in pay_apr_shd.g_rec_type
87 ) is
88 --
89 l_proc varchar2(72);
90 --
91 Begin
92 l_proc := g_package||'delete_dml';
93 --
94 hr_utility.set_location('Entering:'||l_proc, 5);
95 --
96 pay_apr_shd.g_api_dml := true; -- Set the api dml status
97 --
98 -- Delete the pay_au_processes row.
99 --
100 delete from pay_au_processes
101 where process_id = p_rec.process_id;
102 --
103 pay_apr_shd.g_api_dml := false; -- Unset the api dml status
104 --
105 hr_utility.set_location(' Leaving:'||l_proc, 10);
106 --
107 Exception
108 When hr_api.child_integrity_violated then
109 -- Child integrity has been violated
110 pay_apr_shd.g_api_dml := false; -- Unset the api dml status
111 pay_apr_shd.constraint_error
112 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
113 When Others Then
114 pay_apr_shd.g_api_dml := false; -- Unset the api dml status
115 Raise;
116 End delete_dml;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |------------------------------< pre_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This private procedure contains any processing which is required before
125 -- the 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 pre-processing required before 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 Row Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- ----------------------------------------------------------------------------
150 Procedure pre_delete(p_rec in pay_apr_shd.g_rec_type) is
151 --
152 l_proc varchar2(72);
153 --
154 Begin
155 l_proc := g_package||'pre_delete';
156 --
157 hr_utility.set_location('Entering:'||l_proc, 5);
158 --
159 hr_utility.set_location(' Leaving:'||l_proc, 10);
160 End pre_delete;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |-----------------------------< post_delete >------------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 -- This private procedure contains any processing which is required after
169 -- the delete dml.
170 --
171 -- Prerequistes:
172 -- This is an internal procedure which is called from the del procedure.
173 --
174 -- In Parameters:
175 -- A Pl/Sql record structure.
176 --
177 -- Post Success:
178 -- Processing continues.
179 --
180 -- Post Failure:
181 -- If an error has occurred, an error message and exception will be raised
182 -- but not handled.
183 --
184 -- Developer Implementation Notes:
185 -- Any post-processing required after the delete dml is issued should be
186 -- coded within this procedure. It is important to note that any 3rd party
187 -- maintenance should be reviewed before placing in this procedure.
188 --
189 -- Access Status:
190 -- Internal Row Handler Use Only.
191 --
192 -- {End Of Comments}
193 -- -----------------------------------------------------------------------------
194 Procedure post_delete(p_rec in pay_apr_shd.g_rec_type) is
195 --
196 l_proc varchar2(72);
197 --
198 Begin
199 l_proc := g_package||'post_delete';
200 --
201 hr_utility.set_location('Entering:'||l_proc, 5);
202 begin
203 --
204 -- Delete ownerships if applicable
205 delete_app_ownerships
206 ('PROCESS_ID', p_rec.process_id
207 );
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 pay_apr_shd.g_rec_type
219 ) is
220 --
221 l_proc varchar2(72);
222 --
223 Begin
224 l_proc := g_package||'post_delete';
225 --
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 -- We must lock the row which we need to delete.
229 --
230 pay_apr_shd.lck
231 (p_rec.process_id
232 ,p_rec.object_version_number
233 );
234 --
235 -- Call the supporting delete validate operation
236 --
237 pay_apr_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 pay_apr_del.pre_delete(p_rec);
245 --
246 -- Delete the row.
247 --
248 pay_apr_del.delete_dml(p_rec);
249 --
250 -- Call the supporting post-delete operation
251 --
252 pay_apr_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_process_id in number
264 ,p_object_version_number in number
265 ) is
266 --
267 l_rec pay_apr_shd.g_rec_type;
268 l_proc varchar2(72);
269 --
270 Begin
271 l_proc := g_package||'del';
272 --
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.process_id := p_process_id;
281 l_rec.object_version_number := p_object_version_number;
282 --
283 -- Having converted the arguments into the pay_apr_rec
284 -- plsql record structure we must call the corresponding entity
285 -- business process
286 --
287 pay_apr_del.del(l_rec);
288 --
289 hr_utility.set_location(' Leaving:'||l_proc, 10);
290 End del;
291 --
292 begin
293 g_package := ' pay_apr_del.'; -- Global package name
294 end pay_apr_del;