1 Package Body pqh_plg_del as
2 /* $Header: pqplgrhi.pkb 115.5 2002/12/12 23:13:49 sgoyal ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_plg_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 -- perform dml).
19 -- 2) To delete the specified row from the schema using the primary key in
20 -- the predicates.
21 -- 3) To trap any constraint violations that may have occurred.
22 -- 4) To raise any other errors.
23 --
24 -- Prerequisites:
25 -- This is an internal private procedure which must be called from the del
26 -- procedure.
27 --
28 -- In Parameters:
29 -- A Pl/Sql record structre.
30 --
31 -- Post Success:
32 -- The specified row will be delete from the schema.
33 --
34 -- Post Failure:
35 -- On the delete dml failure it is important to note that we always reset the
36 -- If a child integrity constraint violation is raised the
37 -- constraint_error procedure will be called.
38 -- If any other error is reported, the error will be raised after the
39 --
40 -- Developer Implementation Notes:
41 -- None.
42 --
43 -- Access Status:
44 -- Internal Row Handler Use Only.
45 --
46 -- {End Of Comments}
47 -- ----------------------------------------------------------------------------
48 Procedure delete_dml(p_rec in pqh_plg_shd.g_rec_type) is
49 --
50 l_proc varchar2(72) := g_package||'delete_dml';
51 --
52 Begin
53 hr_utility.set_location('Entering:'||l_proc, 5);
54 --
55 --
56 -- Delete the pqh_process_log row.
57 --
58 delete from pqh_process_log
59 where process_log_id = p_rec.process_log_id;
60 --
61 --
62 hr_utility.set_location(' Leaving:'||l_proc, 10);
63 --
64 Exception
65 When hr_api.child_integrity_violated then
66 -- Child integrity has been violated
67 pqh_plg_shd.constraint_error
68 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
69 When Others Then
70 Raise;
71 End delete_dml;
72 --
73 -- ----------------------------------------------------------------------------
74 -- |------------------------------< pre_delete >------------------------------|
75 -- ----------------------------------------------------------------------------
76 -- {Start Of Comments}
77 --
78 -- Description:
79 -- This private procedure contains any processing which is required before
80 -- the delete dml.
81 --
82 -- Prerequisites:
83 -- This is an internal procedure which is called from the del procedure.
84 --
85 -- In Parameters:
86 -- A Pl/Sql record structre.
87 --
88 -- Post Success:
89 -- Processing continues.
90 --
91 -- Post Failure:
92 -- If an error has occurred, an error message and exception will be raised
93 -- but not handled.
94 --
95 -- Developer Implementation Notes:
96 -- Any pre-processing required before the delete dml is issued should be
97 -- coded within this procedure. It is important to note that any 3rd party
98 -- maintenance should be reviewed before placing in this procedure.
99 --
100 -- Access Status:
101 -- Internal Row Handler Use Only.
102 --
103 -- {End Of Comments}
104 -- ----------------------------------------------------------------------------
105 Procedure pre_delete(p_rec in pqh_plg_shd.g_rec_type) is
106 --
107 l_proc varchar2(72) := g_package||'pre_delete';
108 --
109 Begin
110 hr_utility.set_location('Entering:'||l_proc, 5);
111 --
112 hr_utility.set_location(' Leaving:'||l_proc, 10);
113 End pre_delete;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |-----------------------------< post_delete >------------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 -- This private procedure contains any processing which is required after the
122 -- delete dml.
123 --
124 -- Prerequisites:
125 -- This is an internal procedure which is called from the del procedure.
126 --
127 -- In Parameters:
128 -- A Pl/Sql record structre.
129 --
130 -- Post Success:
131 -- Processing continues.
132 --
133 -- Post Failure:
134 -- If an error has occurred, an error message and exception will be raised
135 -- but not handled.
136 --
137 -- Developer Implementation Notes:
138 -- Any post-processing required after the delete dml is issued should be
139 -- coded within this procedure. It is important to note that any 3rd party
140 -- maintenance should be reviewed before placing in this procedure.
141 --
142 -- Access Status:
143 -- Internal table Handler Use Only.
144 --
145 -- {End Of Comments}
146 -- ----------------------------------------------------------------------------
147 Procedure post_delete(
148 p_effective_date in date,p_rec in pqh_plg_shd.g_rec_type) is
149 --
150 l_proc varchar2(72) := g_package||'post_delete';
151 --
152 Begin
153 hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155 --
156 -- Start of API User Hook for post_delete.
157 --
158 begin
159 --
160 pqh_plg_rkd.after_delete
161 (
162 p_process_log_id =>p_rec.process_log_id
163 ,p_module_cd_o =>pqh_plg_shd.g_old_rec.module_cd
164 ,p_txn_id_o =>pqh_plg_shd.g_old_rec.txn_id
165 ,p_master_process_log_id_o =>pqh_plg_shd.g_old_rec.master_process_log_id
166 ,p_message_text_o =>pqh_plg_shd.g_old_rec.message_text
167 ,p_message_type_cd_o =>pqh_plg_shd.g_old_rec.message_type_cd
168 ,p_batch_status_o =>pqh_plg_shd.g_old_rec.batch_status
169 ,p_batch_start_date_o =>pqh_plg_shd.g_old_rec.batch_start_date
170 ,p_batch_end_date_o =>pqh_plg_shd.g_old_rec.batch_end_date
171 ,p_txn_table_route_id_o =>pqh_plg_shd.g_old_rec.txn_table_route_id
172 ,p_log_context_o =>pqh_plg_shd.g_old_rec.log_context
173 ,p_information_category_o =>pqh_plg_shd.g_old_rec.information_category
174 ,p_information1_o =>pqh_plg_shd.g_old_rec.information1
175 ,p_information2_o =>pqh_plg_shd.g_old_rec.information2
176 ,p_information3_o =>pqh_plg_shd.g_old_rec.information3
177 ,p_information4_o =>pqh_plg_shd.g_old_rec.information4
178 ,p_information5_o =>pqh_plg_shd.g_old_rec.information5
179 ,p_information6_o =>pqh_plg_shd.g_old_rec.information6
180 ,p_information7_o =>pqh_plg_shd.g_old_rec.information7
181 ,p_information8_o =>pqh_plg_shd.g_old_rec.information8
182 ,p_information9_o =>pqh_plg_shd.g_old_rec.information9
183 ,p_information10_o =>pqh_plg_shd.g_old_rec.information10
184 ,p_information11_o =>pqh_plg_shd.g_old_rec.information11
185 ,p_information12_o =>pqh_plg_shd.g_old_rec.information12
186 ,p_information13_o =>pqh_plg_shd.g_old_rec.information13
187 ,p_information14_o =>pqh_plg_shd.g_old_rec.information14
188 ,p_information15_o =>pqh_plg_shd.g_old_rec.information15
189 ,p_information16_o =>pqh_plg_shd.g_old_rec.information16
190 ,p_information17_o =>pqh_plg_shd.g_old_rec.information17
191 ,p_information18_o =>pqh_plg_shd.g_old_rec.information18
192 ,p_information19_o =>pqh_plg_shd.g_old_rec.information19
193 ,p_information20_o =>pqh_plg_shd.g_old_rec.information20
194 ,p_information21_o =>pqh_plg_shd.g_old_rec.information21
195 ,p_information22_o =>pqh_plg_shd.g_old_rec.information22
196 ,p_information23_o =>pqh_plg_shd.g_old_rec.information23
197 ,p_information24_o =>pqh_plg_shd.g_old_rec.information24
198 ,p_information25_o =>pqh_plg_shd.g_old_rec.information25
199 ,p_information26_o =>pqh_plg_shd.g_old_rec.information26
200 ,p_information27_o =>pqh_plg_shd.g_old_rec.information27
201 ,p_information28_o =>pqh_plg_shd.g_old_rec.information28
202 ,p_information29_o =>pqh_plg_shd.g_old_rec.information29
203 ,p_information30_o =>pqh_plg_shd.g_old_rec.information30
204 ,p_object_version_number_o =>pqh_plg_shd.g_old_rec.object_version_number
205 );
206 --
207 exception
208 --
209 when hr_api.cannot_find_prog_unit then
210 --
211 hr_api.cannot_find_prog_unit_error
212 (p_module_name => 'pqh_process_log'
213 ,p_hook_type => 'AD');
214 --
215 end;
216 --
217 -- End of API User Hook for post_delete.
218 --
219 --
220 hr_utility.set_location(' Leaving:'||l_proc, 10);
221 End post_delete;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |---------------------------------< del >----------------------------------|
225 -- ----------------------------------------------------------------------------
226 Procedure del
227 (
228 p_effective_date in date,
229 p_rec in pqh_plg_shd.g_rec_type
230 ) is
231 --
232 l_proc varchar2(72) := g_package||'del';
233 --
234 Begin
235 hr_utility.set_location('Entering:'||l_proc, 5);
236 --
237 -- We must lock the row which we need to delete.
238 --
239 pqh_plg_shd.lck
240 (
241 p_rec.process_log_id,
242 p_rec.object_version_number
243 );
244 --
245 -- Call the supporting delete validate operation
246 --
247 pqh_plg_bus.delete_validate(p_rec
248 ,p_effective_date);
249 --
250 -- Call the supporting pre-delete operation
251 --
252 pre_delete(p_rec);
253 --
254 -- Delete the row.
255 --
256 delete_dml(p_rec);
257 --
258 -- Call the supporting post-delete operation
259 --
260 post_delete(
261 p_effective_date,p_rec);
262 End del;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------------< del >----------------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure del
268 (
269 p_effective_date in date,
270 p_process_log_id in number,
271 p_object_version_number in number
272 ) is
273 --
274 l_rec pqh_plg_shd.g_rec_type;
275 l_proc varchar2(72) := g_package||'del';
276 --
277 Begin
278 hr_utility.set_location('Entering:'||l_proc, 5);
279 --
280 -- As the delete procedure accepts a plsql record structure we do need to
281 -- convert the arguments into the record structure.
282 -- We don't need to call the supplied conversion argument routine as we
283 -- only need a few attributes.
284 --
285 l_rec.process_log_id:= p_process_log_id;
286 l_rec.object_version_number := p_object_version_number;
287 --
288 -- Having converted the arguments into the pqh_plg_rec
289 -- plsql record structure we must call the corresponding entity
290 -- business process
291 --
292 del(
293 p_effective_date,l_rec);
294 --
295 hr_utility.set_location(' Leaving:'||l_proc, 10);
296 End del;
297 --
298 end pqh_plg_del;