1 Package Body ghr_pre_del as
2 /* $Header: ghprerhi.pkb 115.3 1999/11/09 22:46:04 pkm ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ghr_pre_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 delete the specified row from the schema using the primary key in
19 -- the predicates.
20 -- 2) To trap any constraint violations that may have occurred.
21 -- 3) To raise any other errors.
22 --
23 -- Pre Conditions:
24 -- This is an internal private procedure which must be called from the del
25 -- procedure.
26 --
27 -- In Parameters:
28 -- A Pl/Sql record structre.
29 --
30 -- Post Success:
31 -- The specified row will be delete from the schema.
32 --
33 -- Post Failure:
34 -- If a child integrity constraint violation is raised the
35 -- constraint_error procedure will be called.
36 --
37 -- Developer Implementation Notes:
38 -- None.
39 --
40 -- Access Status:
41 -- Internal Table Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml(p_rec in ghr_pre_shd.g_rec_type) is
46 --
47 l_proc varchar2(72) := g_package||'delete_dml';
48 --
49 Begin
50 hr_utility.set_location('Entering:'||l_proc, 5);
51 --
52 -- Delete the ghr_pa_remarks row.
53 --
54 delete from ghr_pa_remarks
55 where pa_remark_id = p_rec.pa_remark_id;
56 --
57 hr_utility.set_location(' Leaving:'||l_proc, 10);
58 --
59 Exception
60 When hr_api.child_integrity_violated then
61 -- Child integrity has been violated
62 ghr_pre_shd.constraint_error
63 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
64 When Others Then
65 Raise;
66 End delete_dml;
67 --
68 -- ----------------------------------------------------------------------------
69 -- |------------------------------< pre_delete >------------------------------|
70 -- ----------------------------------------------------------------------------
71 -- {Start Of Comments}
72 --
73 -- Description:
74 -- This private procedure contains any processing which is required before
75 -- the delete dml.
76 --
77 -- Pre Conditions:
78 -- This is an internal procedure which is called from the del procedure.
79 --
80 -- In Parameters:
81 -- A Pl/Sql record structre.
82 --
83 -- Post Success:
84 -- Processing continues.
85 --
86 -- Post Failure:
87 -- If an error has occurred, an error message and exception will be raised
88 -- but not handled.
89 --
90 -- Developer Implementation Notes:
91 -- Any pre-processing required before the delete dml is issued should be
92 -- coded within this procedure. It is important to note that any 3rd party
93 -- maintenance should be reviewed before placing in this procedure.
94 --
95 -- Access Status:
96 -- Internal Table Handler Use Only.
97 --
98 -- {End Of Comments}
99 -- ----------------------------------------------------------------------------
100 Procedure pre_delete(p_rec in ghr_pre_shd.g_rec_type) is
101 --
102 l_proc varchar2(72) := g_package||'pre_delete';
103 --
104 Begin
105 hr_utility.set_location('Entering:'||l_proc, 5);
106 --
107 hr_utility.set_location(' Leaving:'||l_proc, 10);
108 End pre_delete;
109 --
110 -- ----------------------------------------------------------------------------
111 -- |-----------------------------< post_delete >------------------------------|
112 -- ----------------------------------------------------------------------------
113 -- {Start Of Comments}
114 --
115 -- Description:
116 -- This private procedure contains any processing which is required after the
117 -- delete dml.
118 --
119 -- Pre Conditions:
120 -- This is an internal procedure which is called from the del procedure.
121 --
122 -- In Parameters:
123 -- A Pl/Sql record structre.
124 --
125 -- Post Success:
126 -- Processing continues.
127 --
128 -- Post Failure:
129 -- If an error has occurred, an error message and exception will be raised
130 -- but not handled.
131 --
132 -- Developer Implementation Notes:
133 -- Any post-processing required after the delete dml is issued should be
134 -- coded within this procedure. It is important to note that any 3rd party
135 -- maintenance should be reviewed before placing in this procedure.
136 --
137 -- Access Status:
138 -- Internal table Handler Use Only.
139 --
140 -- {End Of Comments}
141 -- ----------------------------------------------------------------------------
142 Procedure post_delete(p_rec in ghr_pre_shd.g_rec_type) is
143 --
144 l_proc varchar2(72) := g_package||'post_delete';
145 --
146 Begin
147 hr_utility.set_location('Entering:'||l_proc, 5);
148 --
149 -- This is a hook point and the user hook for post_delete is called here.
150 --
151 begin
152 ghr_pre_rkd.after_delete (
153 p_pa_remark_id => p_rec.pa_remark_id,
154 p_pa_request_id_o => ghr_pre_shd.g_old_rec.pa_request_id,
155 p_remark_id_o => ghr_pre_shd.g_old_rec.remark_id,
156 p_description_o => ghr_pre_shd.g_old_rec.description,
157 p_remark_code_information1_o =>
158 ghr_pre_shd.g_old_rec.remark_code_information1,
159 p_remark_code_information2_o =>
160 ghr_pre_shd.g_old_rec.remark_code_information2,
161 p_remark_code_information3_o =>
162 ghr_pre_shd.g_old_rec.remark_code_information3,
163 p_remark_code_information4_o =>
164 ghr_pre_shd.g_old_rec.remark_code_information4,
165 p_remark_code_information5_o =>
166 ghr_pre_shd.g_old_rec.remark_code_information5,
167 p_object_version_number_o =>
168 ghr_pre_shd.g_old_rec.object_version_number
169 );
170
171 exception
172 when hr_api.cannot_find_prog_unit then
173 hr_api.cannot_find_prog_unit_error
174 ( p_module_name => 'GHR_PA_REMARKS'
175 ,p_hook_type => 'AD'
176 );
177 end;
178 -- End of API User Hook for post_delete.
179 --
180 hr_utility.set_location(' Leaving:'||l_proc, 10);
181 End post_delete;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |---------------------------------< del >----------------------------------|
185 -- ----------------------------------------------------------------------------
186 Procedure del
187 (
188 p_rec in ghr_pre_shd.g_rec_type,
189 p_validate in boolean default false
190 ) is
191 --
192 l_proc varchar2(72) := g_package||'del';
193 --
194 Begin
195 hr_utility.set_location('Entering:'||l_proc, 5);
196 --
197 -- Determine if the business process is to be validated.
198 --
199 If p_validate then
200 --
201 -- Issue the savepoint.
202 --
203 SAVEPOINT del_ghr_pre;
204 End If;
205 --
206 -- We must lock the row which we need to delete.
207 --
208
209 ghr_pre_shd.lck
210 (
211 p_rec.pa_remark_id,
212 p_rec.object_version_number
213 );
214 --
215 -- Call the supporting delete validate operation
216 --
217 ghr_pre_bus.delete_validate(p_rec);
218 --
219 -- Call the supporting pre-delete operation
220 --
221 pre_delete(p_rec);
222 --
223
224 -- Delete the row.
225 --
226 delete_dml(p_rec);
227
228 --
229 -- Call the supporting post-delete operation
230 --
231 post_delete(p_rec);
232
233 --
234 -- If we are validating then raise the Validate_Enabled exception
235 --
236 If p_validate then
237 Raise HR_Api.Validate_Enabled;
238 End If;
239 --
240 hr_utility.set_location(' Leaving:'||l_proc, 10);
241 Exception
242 When HR_Api.Validate_Enabled Then
243 --
244 -- As the Validate_Enabled exception has been raised
245 -- we must rollback to the savepoint
246 --
247 ROLLBACK TO del_ghr_pre;
248 End del;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |---------------------------------< del >----------------------------------|
252 -- ----------------------------------------------------------------------------
253 Procedure del
254 (
255 p_pa_remark_id in number,
256 p_object_version_number in number,
257 p_validate in boolean default false
258 ) is
259 --
260 l_rec ghr_pre_shd.g_rec_type;
261 l_proc varchar2(72) := g_package||'del';
262 --
263 Begin
264 hr_utility.set_location('Entering:'||l_proc, 5);
265 --
266 -- As the delete procedure accepts a plsql record structure we do need to
267 -- convert the arguments into the record structure.
268 -- We don't need to call the supplied conversion argument routine as we
269 -- only need a few attributes.
270 --
271 l_rec.pa_remark_id := p_pa_remark_id;
272 l_rec.object_version_number := p_object_version_number;
273 --
274 -- Having converted the arguments into the ghr_pre_rec
275 -- plsql record structure we must call the corresponding entity
276 -- business process
277 --
278 del(l_rec, p_validate);
279 --
280 hr_utility.set_location(' Leaving:'||l_proc, 10);
281 End del;
282 --
283 end ghr_pre_del;