1 Package Body pqh_bdt_del as
2 /* $Header: pqbdtrhi.pkb 120.0 2005/05/29 01:28:31 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_bdt_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 -- 2) To delete the specified row from the schema using the primary key in
19 -- the predicates.
20 -- 3) To trap any constraint violations that may have occurred.
21 -- 4) 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 pqh_bdt_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 --
53 -- Delete the pqh_budget_details row.
54 --
55 delete from pqh_budget_details
56 where budget_detail_id = p_rec.budget_detail_id;
57 --
58 --
59 hr_utility.set_location(' Leaving:'||l_proc, 10);
60 --
61 Exception
62 When hr_api.child_integrity_violated then
63 -- Child integrity has been violated
64 pqh_bdt_shd.constraint_error
65 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
66 When Others Then
67 Raise;
68 End delete_dml;
69 --
70 -- ----------------------------------------------------------------------------
71 -- |------------------------------< pre_delete >------------------------------|
72 -- ----------------------------------------------------------------------------
73 -- {Start Of Comments}
74 --
75 -- Description:
76 -- This private procedure contains any processing which is required before
77 -- the delete dml.
78 --
79 -- Prerequisites:
80 -- This is an internal procedure which is called from the del procedure.
81 --
82 -- In Parameters:
83 -- A Pl/Sql record structre.
84 --
85 -- Post Success:
86 -- Processing continues.
87 --
88 -- Post Failure:
89 -- If an error has occurred, an error message and exception will be raised
90 -- but not handled.
91 --
92 -- Developer Implementation Notes:
93 -- Any pre-processing required before the delete dml is issued should be
94 -- coded within this procedure. It is important to note that any 3rd party
95 -- maintenance should be reviewed before placing in this procedure.
96 --
97 -- Access Status:
98 -- Internal Row Handler Use Only.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure pre_delete(p_rec in pqh_bdt_shd.g_rec_type) is
103 --
104 l_proc varchar2(72) := g_package||'pre_delete';
105 --
106 Begin
107 hr_utility.set_location('Entering:'||l_proc, 5);
108 --
109 hr_utility.set_location(' Leaving:'||l_proc, 10);
110 End pre_delete;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |-----------------------------< post_delete >------------------------------|
114 -- ----------------------------------------------------------------------------
115 -- {Start Of Comments}
116 --
117 -- Description:
118 -- This private procedure contains any processing which is required after the
119 -- delete dml.
120 --
121 -- Prerequisites:
122 -- This is an internal procedure which is called from the del procedure.
123 --
124 -- In Parameters:
125 -- A Pl/Sql record structre.
126 --
127 -- Post Success:
128 -- Processing continues.
129 --
130 -- Post Failure:
131 -- If an error has occurred, an error message and exception will be raised
132 -- but not handled.
133 --
134 -- Developer Implementation Notes:
135 -- Any post-processing required after the delete dml is issued should be
136 -- coded within this procedure. It is important to note that any 3rd party
137 -- maintenance should be reviewed before placing in this procedure.
138 --
139 -- Access Status:
140 -- Internal table Handler Use Only.
141 --
142 -- {End Of Comments}
143 -- ----------------------------------------------------------------------------
144 Procedure post_delete(p_rec in pqh_bdt_shd.g_rec_type) is
145 --
146 l_proc varchar2(72) := g_package||'post_delete';
147 --
148 Begin
149 hr_utility.set_location('Entering:'||l_proc, 5);
150 --
151 --
152 -- Start of API User Hook for post_delete.
153 --
154 begin
155 --
156 pqh_bdt_rkd.after_delete
157 (
158 p_budget_detail_id =>p_rec.budget_detail_id
159 ,p_organization_id_o =>pqh_bdt_shd.g_old_rec.organization_id
160 ,p_job_id_o =>pqh_bdt_shd.g_old_rec.job_id
161 ,p_position_id_o =>pqh_bdt_shd.g_old_rec.position_id
162 ,p_grade_id_o =>pqh_bdt_shd.g_old_rec.grade_id
163 ,p_budget_version_id_o =>pqh_bdt_shd.g_old_rec.budget_version_id
164 ,p_budget_unit1_percent_o =>pqh_bdt_shd.g_old_rec.budget_unit1_percent
165 ,p_budget_unit1_value_type_cd_o =>pqh_bdt_shd.g_old_rec.budget_unit1_value_type_cd
166 ,p_budget_unit1_value_o =>pqh_bdt_shd.g_old_rec.budget_unit1_value
167 ,p_budget_unit1_available_o =>pqh_bdt_shd.g_old_rec.budget_unit1_available
168 ,p_budget_unit2_percent_o =>pqh_bdt_shd.g_old_rec.budget_unit2_percent
169 ,p_budget_unit2_value_type_cd_o =>pqh_bdt_shd.g_old_rec.budget_unit2_value_type_cd
170 ,p_budget_unit2_value_o =>pqh_bdt_shd.g_old_rec.budget_unit2_value
171 ,p_budget_unit2_available_o =>pqh_bdt_shd.g_old_rec.budget_unit2_available
172 ,p_budget_unit3_percent_o =>pqh_bdt_shd.g_old_rec.budget_unit3_percent
173 ,p_budget_unit3_value_type_cd_o =>pqh_bdt_shd.g_old_rec.budget_unit3_value_type_cd
174 ,p_budget_unit3_value_o =>pqh_bdt_shd.g_old_rec.budget_unit3_value
175 ,p_budget_unit3_available_o =>pqh_bdt_shd.g_old_rec.budget_unit3_available
176 ,p_gl_status_o =>pqh_bdt_shd.g_old_rec.gl_status
177 ,p_object_version_number_o =>pqh_bdt_shd.g_old_rec.object_version_number
178 );
179 --
180 exception
181 --
182 when hr_api.cannot_find_prog_unit then
183 --
184 hr_api.cannot_find_prog_unit_error
185 (p_module_name => 'pqh_budget_details'
186 ,p_hook_type => 'AD');
187 --
188 end;
189 --
190 -- End of API User Hook for post_delete.
191 --
192 --
193 hr_utility.set_location(' Leaving:'||l_proc, 10);
194 End post_delete;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |---------------------------------< del >----------------------------------|
198 -- ----------------------------------------------------------------------------
199 Procedure del
200 (
201 p_rec in pqh_bdt_shd.g_rec_type
202 ) is
203 --
204 l_proc varchar2(72) := g_package||'del';
205 --
206 Begin
207 hr_utility.set_location('Entering:'||l_proc, 5);
208 --
209 -- We must lock the row which we need to delete.
210 --
211 pqh_bdt_shd.lck
212 (
213 p_rec.budget_detail_id,
214 p_rec.object_version_number
215 );
216 --
217 -- Call the supporting delete validate operation
218 --
219 pqh_bdt_bus.delete_validate(p_rec);
220 --
221 -- Call the supporting pre-delete operation
222 --
223 pre_delete(p_rec);
224 --
225 -- Delete the row.
226 --
227 delete_dml(p_rec);
228 --
229 -- Call the supporting post-delete operation
230 --
231 post_delete(p_rec);
232 End del;
233 --
234 -- ----------------------------------------------------------------------------
235 -- |---------------------------------< del >----------------------------------|
236 -- ----------------------------------------------------------------------------
237 Procedure del
238 (
239 p_budget_detail_id in number,
240 p_object_version_number in number
241 ) is
242 --
243 l_rec pqh_bdt_shd.g_rec_type;
244 l_proc varchar2(72) := g_package||'del';
245 --
246 Begin
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.budget_detail_id:= p_budget_detail_id;
255 l_rec.object_version_number := p_object_version_number;
256 --
257 -- Having converted the arguments into the pqh_bdt_rec
258 -- plsql record structure we must call the corresponding entity
259 -- business process
260 --
261 del(l_rec);
262 --
263 hr_utility.set_location(' Leaving:'||l_proc, 10);
264 End del;
265 --
266 end pqh_bdt_del;