1 Package Body pqh_cec_del as
2 /* $Header: pqcecrhi.pkb 120.3 2011/04/28 09:42:08 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_cec_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 -- perform dml).
19 -- 2) To delete the specified row from the schema using the primary key in
20 -- the predicates.
21 -- 3) To trap any constraint violations that may have occurred.
22 -- 4) To raise any other errors.
23 --
24 -- Prerequisites:
25 -- This is an internal private procedure which must be called from the del
26 -- procedure.
27 --
28 -- In Parameters:
29 -- A Pl/Sql record structre.
30 --
31 -- Post Success:
32 -- The specified row will be delete from the schema.
33 --
34 -- Post Failure:
35 -- On the delete dml failure it is important to note that we always reset the
36 -- If a child integrity constraint violation is raised the
37 -- constraint_error procedure will be called.
38 -- If any other error is reported, the error will be raised after the
39 --
40 -- Developer Implementation Notes:
41 -- None.
42 --
43 -- Access Status:
44 -- Internal Row Handler Use Only.
45 --
46 -- {End Of Comments}
47 -- ----------------------------------------------------------------------------
48 Procedure delete_dml(p_rec in pqh_cec_shd.g_rec_type) is
49 --
50 l_proc varchar2(72) := g_package||'delete_dml';
51 --
52 Begin
53 hr_utility.set_location('Entering:'||l_proc, 5);
54 --
55 --
56 -- Added the following code as a part of Zero Downtime Patching Project.
57 -- Code Starts Here.
58 --
59 PER_RIC_PKG.chk_integrity (
60 p_entity_name=>'PQH_COPY_ENTITY_CONTEXTS',
61 p_ref_entity_info=>
62 PER_RIC_PKG.ref_entity_tbl(
63 PER_RIC_PKG.ref_info_rec('PQH_COPY_ENTITY_FUNCTIONS',PER_RIC_PKG.column_info_tbl(
64 PER_RIC_PKG.col_info_rec('CONTEXT',p_rec.context,NULL, NULL))),
65 PER_RIC_PKG.ref_info_rec('PQH_SPECIAL_ATTRIBUTES',PER_RIC_PKG.column_info_tbl(
66 PER_RIC_PKG.col_info_rec('CONTEXT',p_rec.context, NULL, NULL)))),
67 p_ref_type=>'DEL');
68 --
69 -- Code Ends Here
70 --
71 --
72 -- Delete the pqh_copy_entity_contexts row.
73 --
74 delete from pqh_copy_entity_contexts
75 where context = p_rec.context;
76 --
77 --
81 When hr_api.child_integrity_violated then
78 hr_utility.set_location(' Leaving:'||l_proc, 10);
79 --
80 Exception
82 -- Child integrity has been violated
83 pqh_cec_shd.constraint_error
84 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
85 When Others Then
86 Raise;
87 End delete_dml;
88 --
89 -- ----------------------------------------------------------------------------
90 -- |------------------------------< pre_delete >------------------------------|
91 -- ----------------------------------------------------------------------------
92 -- {Start Of Comments}
93 --
94 -- Description:
95 -- This private procedure contains any processing which is required before
96 -- the delete dml.
97 --
98 -- Prerequisites:
99 -- This is an internal procedure which is called from the del procedure.
100 --
101 -- In Parameters:
102 -- A Pl/Sql record structre.
103 --
104 -- Post Success:
105 -- Processing continues.
106 --
107 -- Post Failure:
108 -- If an error has occurred, an error message and exception will be raised
109 -- but not handled.
110 --
111 -- Developer Implementation Notes:
112 -- Any pre-processing required before the delete dml is issued should be
113 -- coded within this procedure. It is important to note that any 3rd party
114 -- maintenance should be reviewed before placing in this procedure.
115 --
116 -- Access Status:
117 -- Internal Row Handler Use Only.
118 --
119 -- {End Of Comments}
120 -- ----------------------------------------------------------------------------
121 Procedure pre_delete(p_rec in pqh_cec_shd.g_rec_type) is
122 --
123 l_proc varchar2(72) := g_package||'pre_delete';
124 --
125 Begin
126 hr_utility.set_location('Entering:'||l_proc, 5);
127 --
128 hr_utility.set_location(' Leaving:'||l_proc, 10);
129 End pre_delete;
130 --
131 -- ----------------------------------------------------------------------------
132 -- |-----------------------------< post_delete >------------------------------|
133 -- ----------------------------------------------------------------------------
134 -- {Start Of Comments}
135 --
136 -- Description:
137 -- This private procedure contains any processing which is required after the
138 -- delete dml.
139 --
140 -- Prerequisites:
141 -- This is an internal procedure which is called from the del procedure.
142 --
143 -- In Parameters:
144 -- A Pl/Sql record structre.
145 --
146 -- Post Success:
147 -- Processing continues.
148 --
149 -- Post Failure:
150 -- If an error has occurred, an error message and exception will be raised
151 -- but not handled.
152 --
153 -- Developer Implementation Notes:
154 -- Any post-processing required after the delete dml is issued should be
155 -- coded within this procedure. It is important to note that any 3rd party
156 -- maintenance should be reviewed before placing in this procedure.
157 --
158 -- Access Status:
159 -- Internal table Handler Use Only.
160 --
161 -- {End Of Comments}
162 -- ----------------------------------------------------------------------------
163 Procedure post_delete(p_rec in pqh_cec_shd.g_rec_type) is
164 --
165 l_proc varchar2(72) := g_package||'post_delete';
166 --
167 Begin
168 hr_utility.set_location('Entering:'||l_proc, 5);
169 --
170 --
171 -- Start of API User Hook for post_delete.
172 --
173 begin
174 --
175 pqh_cec_rkd.after_delete
176 (
177 p_context =>p_rec.context
178 ,p_application_short_name_o =>pqh_cec_shd.g_old_rec.application_short_name
179 ,p_legislation_code_o =>pqh_cec_shd.g_old_rec.legislation_code
180 ,p_responsibility_key_o =>pqh_cec_shd.g_old_rec.responsibility_key
181 ,p_transaction_short_name_o =>pqh_cec_shd.g_old_rec.transaction_short_name
182 ,p_object_version_number_o =>pqh_cec_shd.g_old_rec.object_version_number
183 );
184 --
185 exception
186 --
187 when hr_api.cannot_find_prog_unit then
188 --
189 hr_api.cannot_find_prog_unit_error
190 (p_module_name => 'pqh_copy_entity_contexts'
191 ,p_hook_type => 'AD');
192 --
193 end;
194 --
195 -- End of API User Hook for post_delete.
196 --
197 --
198 hr_utility.set_location(' Leaving:'||l_proc, 10);
199 End post_delete;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |---------------------------------< del >----------------------------------|
203 -- ----------------------------------------------------------------------------
204 Procedure del
205 (
206 p_rec in pqh_cec_shd.g_rec_type
207 ) is
208 --
209 l_proc varchar2(72) := g_package||'del';
210 --
211 Begin
212 hr_utility.set_location('Entering:'||l_proc, 5);
213 --
214 -- We must lock the row which we need to delete.
215 --
216 pqh_cec_shd.lck
217 (
218 p_rec.context,
219 p_rec.object_version_number
220 );
221 --
222 -- Call the supporting delete validate operation
223 --
224 pqh_cec_bus.delete_validate(p_rec);
225 --
226 -- Call the supporting pre-delete operation
227 --
228 pre_delete(p_rec);
229 --
230 -- Delete the row.
231 --
232 delete_dml(p_rec);
233 --
234 -- Call the supporting post-delete operation
235 --
236 post_delete(p_rec);
237 End del;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |---------------------------------< del >----------------------------------|
241 -- ----------------------------------------------------------------------------
242 Procedure del
243 (
244 p_context in varchar2,
245 p_object_version_number in number
246 ) is
247 --
248 l_rec pqh_cec_shd.g_rec_type;
249 l_proc varchar2(72) := g_package||'del';
250 --
251 Begin
252 hr_utility.set_location('Entering:'||l_proc, 5);
253 --
254 -- As the delete procedure accepts a plsql record structure we do need to
255 -- convert the arguments into the record structure.
256 -- We don't need to call the supplied conversion argument routine as we
257 -- only need a few attributes.
258 --
259 l_rec.context:= p_context;
260 l_rec.object_version_number := p_object_version_number;
261 --
262 -- Having converted the arguments into the pqh_cec_rec
263 -- plsql record structure we must call the corresponding entity
264 -- business process
265 --
266 del(l_rec);
267 --
268 hr_utility.set_location(' Leaving:'||l_proc, 10);
269 End del;
270 --
271 end pqh_cec_del;