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