1 Package Body ghr_nre_del as
2 /* $Header: ghnrerhi.pkb 120.1.12010000.1 2009/03/26 10:13:57 utokachi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ghr_nre_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 -- Prerequisites:
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 Row Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml(p_rec in ghr_nre_shd.g_rec_type) is
46 --
47 l_proc varchar2(72);
48 --
49 Begin
50 l_proc := g_package||'delete_dml';
51 hr_utility.set_location('Entering:'||l_proc, 5);
52
53 --
54 --
55 -- Delete the ghr_noac_remarks row.
56 --
57 delete from ghr_noac_remarks
58 where noac_remark_id = p_rec.noac_remark_id;
59 --
60 --
61 hr_utility.set_location(' Leaving:'||l_proc, 10);
62 --
63 Exception
64 When hr_api.child_integrity_violated then
65 -- Child integrity has been violated
66 ghr_nre_shd.constraint_error
67 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
68 When Others Then
69 Raise;
70 End delete_dml;
71 --
72 -- ----------------------------------------------------------------------------
73 -- |------------------------------< pre_delete >------------------------------|
74 -- ----------------------------------------------------------------------------
75 -- {Start Of Comments}
76 --
77 -- Description:
78 -- This private procedure contains any processing which is required before
79 -- the delete dml.
80 --
81 -- Prerequisites:
82 -- This is an internal procedure which is called from the del procedure.
83 --
84 -- In Parameters:
85 -- A Pl/Sql record structre.
86 --
87 -- Post Success:
88 -- Processing continues.
89 --
90 -- Post Failure:
91 -- If an error has occurred, an error message and exception will be raised
92 -- but not handled.
93 --
94 -- Developer Implementation Notes:
95 -- Any pre-processing required before the delete dml is issued should be
96 -- coded within this procedure. It is important to note that any 3rd party
97 -- maintenance should be reviewed before placing in this procedure.
98 --
99 -- Access Status:
100 -- Internal Row Handler Use Only.
101 --
102 -- {End Of Comments}
103 -- ----------------------------------------------------------------------------
104 Procedure pre_delete(p_rec in ghr_nre_shd.g_rec_type) is
105 --
106 l_proc varchar2(72) := g_package||'pre_delete';
107 --
108 Begin
109 l_proc := g_package||'pre_delete';
110 hr_utility.set_location('Entering:'||l_proc, 5);
111
112 --
113 hr_utility.set_location(' Leaving:'||l_proc, 10);
114 End pre_delete;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |-----------------------------< post_delete >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 -- This private procedure contains any processing which is required after the
123 -- delete dml.
124 --
125 -- Prerequisites:
126 -- This is an internal procedure which is called from the del procedure.
127 --
128 -- In Parameters:
129 -- A Pl/Sql record structre.
130 --
131 -- Post Success:
132 -- Processing continues.
133 --
134 -- Post Failure:
135 -- If an error has occurred, an error message and exception will be raised
136 -- but not handled.
137 --
138 -- Developer Implementation Notes:
139 -- Any post-processing required after the delete dml is issued should be
140 -- coded within this procedure. It is important to note that any 3rd party
141 -- maintenance should be reviewed before placing in this procedure.
142 --
143 -- Access Status:
144 -- Internal table Handler Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure post_delete(
149 p_effective_date in date,p_rec in ghr_nre_shd.g_rec_type) is
150 --
151 l_proc varchar2(72);
152 --
153 Begin
154 l_proc := g_package||'post_delete';
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 --
158 -- Start of API User Hook for post_delete.
159 --
160 begin
161 --
162 ghr_nre_rkd.after_delete
163 (
164 p_noac_remark_id =>p_rec.noac_remark_id
165 ,p_nature_of_action_id_o =>ghr_nre_shd.g_old_rec.nature_of_action_id
166 ,p_remark_id_o =>ghr_nre_shd.g_old_rec.remark_id
167 ,p_required_flag_o =>ghr_nre_shd.g_old_rec.required_flag
168 ,p_enabled_flag_o =>ghr_nre_shd.g_old_rec.enabled_flag
169 ,p_date_from_o =>ghr_nre_shd.g_old_rec.date_from
170 ,p_date_to_o =>ghr_nre_shd.g_old_rec.date_to
171 ,p_object_version_number_o =>ghr_nre_shd.g_old_rec.object_version_number
172 );
173 --
174 exception
175 --
176 when hr_api.cannot_find_prog_unit then
177 --
178 hr_api.cannot_find_prog_unit_error
179 (p_module_name => 'ghr_noac_remarks'
180 ,p_hook_type => 'AD');
181 --
182 end;
183 --
184 -- End of API User Hook for post_delete.
185 --
186 --
187 hr_utility.set_location(' Leaving:'||l_proc, 10);
188 End post_delete;
189 --
190 -- ----------------------------------------------------------------------------
191 -- |---------------------------------< del >----------------------------------|
192 -- ----------------------------------------------------------------------------
193 Procedure del
194 (
195 p_effective_date in date,
196 p_rec in ghr_nre_shd.g_rec_type
197 ) is
198 --
199 l_proc varchar2(72);
200 --
201 Begin
202 l_proc := g_package||'del';
203 hr_utility.set_location('Entering:'||l_proc, 5);
204 --
205 -- We must lock the row which we need to delete.
206 --
207 ghr_nre_shd.lck
208 (
209 p_rec.noac_remark_id,
210 p_rec.object_version_number
211 );
212 --
213 -- Call the supporting delete validate operation
214 --
215 ghr_nre_bus.delete_validate(p_rec
216 ,p_effective_date);
217 --
218 -- Call the supporting pre-delete operation
219 --
220 pre_delete(p_rec);
221 --
222 -- Delete the row.
223 --
224 delete_dml(p_rec);
225 --
226 -- Call the supporting post-delete operation
227 --
228 post_delete(
229 p_effective_date,p_rec);
230 End del;
231 --
232 -- ----------------------------------------------------------------------------
233 -- |---------------------------------< del >----------------------------------|
234 -- ----------------------------------------------------------------------------
235 Procedure del
236 (
237 p_effective_date in date,
238 p_noac_remark_id in number,
239 p_object_version_number in number
240 ) is
241 --
242 l_rec ghr_nre_shd.g_rec_type;
243 l_proc varchar2(72);
244 --
245 Begin
246 l_proc := g_package||'del';
247 hr_utility.set_location('Entering:'||l_proc, 5);
248 --
249 -- As the delete procedure accepts a plsql record structure we do need to
250 -- convert the arguments into the record structure.
251 -- We don't need to call the supplied conversion argument routine as we
252 -- only need a few attributes.
253 --
254 l_rec.noac_remark_id:= p_noac_remark_id;
255 l_rec.object_version_number := p_object_version_number;
256 --
257 -- Having converted the arguments into the ghr_nre_rec
258 -- plsql record structure we must call the corresponding entity
259 -- business process
260 --
261 del(
262 p_effective_date,l_rec);
263 --
264 hr_utility.set_location(' Leaving:'||l_proc, 10);
265 End del;
266 --
267 end ghr_nre_del;