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