1 Package Body pqh_tca_del as
2 /* $Header: pqtcarhi.pkb 120.3 2011/04/28 09:35:17 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_tca_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_tca_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_TXN_CATEGORY_ATTRIBUTES',
58 p_ref_entity=>'PQH_SPECIAL_ATTRIBUTES',
59 p_ref_column_name=>'TXN_CATEGORY_ATTRIBUTE_ID',
60 p_ref_col_value_number=>p_rec.txn_category_attribute_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 -- Delete the pqh_txn_category_attributes row.
68 --
69 delete from pqh_txn_category_attributes
70 where txn_category_attribute_id = p_rec.txn_category_attribute_id;
71 --
72 --
73 hr_utility.set_location(' Leaving:'||l_proc, 10);
74 --
75 Exception
76 When hr_api.child_integrity_violated then
77 -- Child integrity has been violated
78 pqh_tca_shd.constraint_error
79 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
80 When Others Then
81 Raise;
82 End delete_dml;
83 --
84 -- ----------------------------------------------------------------------------
85 -- |------------------------------< pre_delete >------------------------------|
86 -- ----------------------------------------------------------------------------
87 -- {Start Of Comments}
88 --
89 -- Description:
90 -- This private procedure contains any processing which is required before
91 -- the delete dml.
92 --
93 -- Prerequisites:
94 -- This is an internal procedure which is called from the del procedure.
95 --
96 -- In Parameters:
97 -- A Pl/Sql record structre.
98 --
99 -- Post Success:
100 -- Processing continues.
101 --
102 -- Post Failure:
103 -- If an error has occurred, an error message and exception will be raised
104 -- but not handled.
105 --
106 -- Developer Implementation Notes:
107 -- Any pre-processing required before the delete dml is issued should be
108 -- coded within this procedure. It is important to note that any 3rd party
109 -- maintenance should be reviewed before placing in this procedure.
110 --
111 -- Access Status:
112 -- Internal Row Handler Use Only.
113 --
114 -- {End Of Comments}
115 -- ----------------------------------------------------------------------------
116 Procedure pre_delete(p_rec in pqh_tca_shd.g_rec_type) is
117 --
118 l_proc varchar2(72) := g_package||'pre_delete';
119 --
120 Begin
121 hr_utility.set_location('Entering:'||l_proc, 5);
122 --
123 hr_utility.set_location(' Leaving:'||l_proc, 10);
124 End pre_delete;
125 --
126 -- ----------------------------------------------------------------------------
127 -- |-----------------------------< post_delete >------------------------------|
128 -- ----------------------------------------------------------------------------
129 -- {Start Of Comments}
130 --
131 -- Description:
132 -- This private procedure contains any processing which is required after the
133 -- delete dml.
134 --
135 -- Prerequisites:
136 -- This is an internal procedure which is called from the del procedure.
137 --
138 -- In Parameters:
139 -- A Pl/Sql record structre.
140 --
141 -- Post Success:
142 -- Processing continues.
143 --
144 -- Post Failure:
145 -- If an error has occurred, an error message and exception will be raised
146 -- but not handled.
147 --
148 -- Developer Implementation Notes:
149 -- Any post-processing required after the delete dml is issued should be
150 -- coded within this procedure. It is important to note that any 3rd party
151 -- maintenance should be reviewed before placing in this procedure.
152 --
153 -- Access Status:
154 -- Internal table Handler Use Only.
155 --
156 -- {End Of Comments}
157 -- ----------------------------------------------------------------------------
158 Procedure post_delete(
159 p_effective_date in date,p_rec in pqh_tca_shd.g_rec_type) is
160 --
161 l_proc varchar2(72) := g_package||'post_delete';
162 --
163 Begin
164 hr_utility.set_location('Entering:'||l_proc, 5);
165 --
166 --
167 -- Start of API User Hook for post_delete.
168 --
169 begin
170 --
171 pqh_tca_rkd.after_delete
172 (
173 p_txn_category_attribute_id =>p_rec.txn_category_attribute_id
174 ,p_attribute_id_o =>pqh_tca_shd.g_old_rec.attribute_id
175 ,p_transaction_category_id_o =>pqh_tca_shd.g_old_rec.transaction_category_id
176 ,p_value_set_id_o =>pqh_tca_shd.g_old_rec.value_set_id
177 ,p_object_version_number_o =>pqh_tca_shd.g_old_rec.object_version_number
178 ,p_transaction_table_route_id_o =>pqh_tca_shd.g_old_rec.transaction_table_route_id
179 ,p_form_column_name_o =>pqh_tca_shd.g_old_rec.form_column_name
180 ,p_identifier_flag_o =>pqh_tca_shd.g_old_rec.identifier_flag
181 ,p_list_identifying_flag_o =>pqh_tca_shd.g_old_rec.list_identifying_flag
182 ,p_member_identifying_flag_o =>pqh_tca_shd.g_old_rec.member_identifying_flag
183 ,p_refresh_flag_o =>pqh_tca_shd.g_old_rec.refresh_flag
184 ,p_select_flag_o =>pqh_tca_shd.g_old_rec.select_flag
185 ,p_value_style_cd_o =>pqh_tca_shd.g_old_rec.value_style_cd
186 );
187 --
188 exception
189 --
190 when hr_api.cannot_find_prog_unit then
191 --
192 hr_api.cannot_find_prog_unit_error
193 (p_module_name => 'pqh_txn_category_attributes'
194 ,p_hook_type => 'AD');
195 --
196 end;
197 --
198 -- End of API User Hook for post_delete.
199 --
200 --
201 hr_utility.set_location(' Leaving:'||l_proc, 10);
202 End post_delete;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |---------------------------------< del >----------------------------------|
206 -- ----------------------------------------------------------------------------
207 Procedure del
208 (
209 p_effective_date in date,
210 p_rec in pqh_tca_shd.g_rec_type
211 ) is
212 --
213 l_proc varchar2(72) := g_package||'del';
214 --
215 Begin
216 hr_utility.set_location('Entering:'||l_proc, 5);
217 --
218 -- We must lock the row which we need to delete.
219 --
220 pqh_tca_shd.lck
221 (
222 p_rec.txn_category_attribute_id,
223 p_rec.object_version_number
224 );
225 --
226 -- Call the supporting delete validate operation
227 --
228 pqh_tca_bus.delete_validate(p_rec
229 ,p_effective_date);
230 --
231 -- Call the supporting pre-delete operation
232 --
233 pre_delete(p_rec);
234 --
235 -- Delete the row.
236 --
237 delete_dml(p_rec);
238 --
239 -- Call the supporting post-delete operation
240 --
241 post_delete(
242 p_effective_date,p_rec);
243 End del;
244 --
245 -- ----------------------------------------------------------------------------
246 -- |---------------------------------< del >----------------------------------|
247 -- ----------------------------------------------------------------------------
248 Procedure del
249 (
250 p_effective_date in date,
251 p_txn_category_attribute_id in number,
252 p_object_version_number in number
253 ) is
254 --
255 l_rec pqh_tca_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.txn_category_attribute_id:= p_txn_category_attribute_id;
267 l_rec.object_version_number := p_object_version_number;
268 --
269 -- Having converted the arguments into the pqh_tca_rec
270 -- plsql record structure we must call the corresponding entity
271 -- business process
272 --
273 del(
274 p_effective_date,l_rec);
275 --
276 hr_utility.set_location(' Leaving:'||l_proc, 10);
277 End del;
278 --
279 end pqh_tca_del;