1 Package Body pqh_rst_del as
2 /* $Header: pqrstrhi.pkb 120.5 2011/04/28 09:38:46 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_rst_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 pqh_rst_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 -- Added the following code as a part of Zero Downtime Patching Project.
54 -- Code Starts Here.
55 --
56 per_ric_pkg.Chk_integrity(
57 p_entity_name=>'PQH_RULE_SETS',
58 p_ref_entity=>'PQH_RULES',
59 p_ref_column_name=>'RULE_SET_ID',
60 p_ref_col_value_number=>p_rec.rule_set_id,
61 p_ref_col_value_varchar=>NULL,
62 p_ref_col_value_date=>NULL,
63 p_ref_type=>'DEL');
64 --
65 -- Code Ends Here
66 --
67 --
68 -- Delete the pqh_rule_sets row.
69 --
70 delete from pqh_rule_sets
71 where rule_set_id = p_rec.rule_set_id;
72 --
73 --
74 hr_utility.set_location(' Leaving:'||l_proc, 10);
75 --
76 Exception
77 When hr_api.child_integrity_violated then
78 -- Child integrity has been violated
79 pqh_rst_shd.constraint_error
80 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
81 When Others Then
82 Raise;
83 End delete_dml;
84 --
85 -- ----------------------------------------------------------------------------
86 -- |------------------------------< pre_delete >------------------------------|
87 -- ----------------------------------------------------------------------------
88 -- {Start Of Comments}
89 --
90 -- Description:
91 -- This private procedure contains any processing which is required before
92 -- the delete dml.
93 --
94 -- Prerequisites:
95 -- This is an internal procedure which is called from the del procedure.
96 --
97 -- In Parameters:
98 -- A Pl/Sql record structre.
99 --
100 -- Post Success:
101 -- Processing continues.
102 --
103 -- Post Failure:
104 -- If an error has occurred, an error message and exception will be raised
105 -- but not handled.
106 --
107 -- Developer Implementation Notes:
108 -- Any pre-processing required before the delete dml is issued should be
109 -- coded within this procedure. It is important to note that any 3rd party
110 -- maintenance should be reviewed before placing in this procedure.
111 --
112 -- Access Status:
113 -- Internal Row Handler Use Only.
114 --
115 -- {End Of Comments}
116 -- ----------------------------------------------------------------------------
117 Procedure pre_delete(p_rec in pqh_rst_shd.g_rec_type) is
118 --
119 l_proc varchar2(72) := g_package||'pre_delete';
120 --
121 Begin
122 hr_utility.set_location('Entering:'||l_proc, 5);
123 --
124 hr_utility.set_location(' Leaving:'||l_proc, 10);
125 End pre_delete;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |-----------------------------< post_delete >------------------------------|
129 -- ----------------------------------------------------------------------------
130 -- {Start Of Comments}
131 --
132 -- Description:
133 -- This private procedure contains any processing which is required after the
134 -- delete dml.
135 --
136 -- Prerequisites:
137 -- This is an internal procedure which is called from the del procedure.
138 --
139 -- In Parameters:
140 -- A Pl/Sql record structre.
141 --
142 -- Post Success:
143 -- Processing continues.
144 --
145 -- Post Failure:
146 -- If an error has occurred, an error message and exception will be raised
147 -- but not handled.
148 --
149 -- Developer Implementation Notes:
150 -- Any post-processing required after the delete dml is issued should be
151 -- coded within this procedure. It is important to note that any 3rd party
152 -- maintenance should be reviewed before placing in this procedure.
153 --
154 -- Access Status:
155 -- Internal table Handler Use Only.
156 --
157 -- {End Of Comments}
158 -- ----------------------------------------------------------------------------
159 Procedure post_delete(
160 p_effective_date in date,p_rec in pqh_rst_shd.g_rec_type) is
161 --
162 l_proc varchar2(72) := g_package||'post_delete';
163 --
164 Begin
165 hr_utility.set_location('Entering:'||l_proc, 5);
166 --
167 --
168 -- Start of API User Hook for post_delete.
169 --
170 begin
171 --
172 pqh_rst_rkd.after_delete
173 (
174 p_rule_set_id =>p_rec.rule_set_id
175 ,p_business_group_id_o =>pqh_rst_shd.g_old_rec.business_group_id
176 ,p_rule_set_name_o =>pqh_rst_shd.g_old_rec.rule_set_name
177 ,p_organization_structure_id_o =>pqh_rst_shd.g_old_rec.organization_structure_id
178 ,p_organization_id_o =>pqh_rst_shd.g_old_rec.organization_id
179 ,p_referenced_rule_set_id_o =>pqh_rst_shd.g_old_rec.referenced_rule_set_id
180 ,p_rule_level_cd_o =>pqh_rst_shd.g_old_rec.rule_level_cd
181 ,p_object_version_number_o =>pqh_rst_shd.g_old_rec.object_version_number
182 ,p_short_name_o =>pqh_rst_shd.g_old_rec.short_name
183 ,p_rule_applicability_o =>pqh_rst_shd.g_old_rec.rule_applicability
184 ,p_rule_category_o =>pqh_rst_shd.g_old_rec.rule_category
185 ,p_starting_organization_id_o =>pqh_rst_shd.g_old_rec.starting_organization_id
186 ,p_seeded_rule_flag_o =>pqh_rst_shd.g_old_rec.seeded_rule_flag
187 ,p_status_o =>pqh_rst_shd.g_old_rec.status
188 );
189 --
190 exception
191 --
192 when hr_api.cannot_find_prog_unit then
193 --
194 hr_api.cannot_find_prog_unit_error
195 (p_module_name => 'pqh_rule_sets'
196 ,p_hook_type => 'AD');
197 --
198 end;
199 --
200 -- End of API User Hook for post_delete.
201 --
202 --
203 hr_utility.set_location(' Leaving:'||l_proc, 10);
204 End post_delete;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |---------------------------------< del >----------------------------------|
208 -- ----------------------------------------------------------------------------
209 Procedure del
210 (
211 p_effective_date in date,
212 p_rec in pqh_rst_shd.g_rec_type
213 ) is
214 --
215 l_proc varchar2(72) := g_package||'del';
216 --
217 Begin
218 hr_utility.set_location('Entering:'||l_proc, 5);
219 --
220 -- We must lock the row which we need to delete.
221 --
222 pqh_rst_shd.lck
223 (
224 p_rec.rule_set_id,
225 p_rec.object_version_number
226 );
227 --
228 -- Call the supporting delete validate operation
229 --
230 pqh_rst_bus.delete_validate(p_rec
231 ,p_effective_date);
232 --
233 -- Call the supporting pre-delete operation
234 --
235 pre_delete(p_rec);
236 --
237 -- Delete the row.
238 --
239 delete_dml(p_rec);
240 --
241 -- Call the supporting post-delete operation
242 --
243 post_delete(
244 p_effective_date,p_rec);
245 End del;
246 --
247 -- ----------------------------------------------------------------------------
248 -- |---------------------------------< del >----------------------------------|
249 -- ----------------------------------------------------------------------------
250 Procedure del
251 (
252 p_effective_date in date,
253 p_rule_set_id in number,
254 p_object_version_number in number
255 ) is
256 --
257 l_rec pqh_rst_shd.g_rec_type;
258 l_proc varchar2(72) := g_package||'del';
259 --
260 Begin
261 hr_utility.set_location('Entering:'||l_proc, 5);
262 --
263 -- As the delete procedure accepts a plsql record structure we do need to
264 -- convert the arguments into the record structure.
265 -- We don't need to call the supplied conversion argument routine as we
266 -- only need a few attributes.
267 --
268 l_rec.rule_set_id:= p_rule_set_id;
269 l_rec.object_version_number := p_object_version_number;
270 --
271 -- Having converted the arguments into the pqh_rst_rec
272 -- plsql record structure we must call the corresponding entity
273 -- business process
274 --
275 del(
276 p_effective_date,l_rec);
277 --
278 hr_utility.set_location(' Leaving:'||l_proc, 10);
279 End del;
280 --
281 end pqh_rst_del;