DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_ATT_DEL

Source


1 Package Body pqh_att_del as
2 /* $Header: pqattrhi.pkb 120.7 2011/06/09 08:12:49 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_att_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_att_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_ATTRIBUTES',
58     p_ref_entity_info=>
59       PER_RIC_PKG.ref_entity_tbl(
60         PER_RIC_PKG.ref_info_rec('PQH_ATTRIBUTE_RANGES',PER_RIC_PKG.column_info_tbl(
61           PER_RIC_PKG.col_info_rec('ATTRIBUTE_ID',NULL, p_rec.attribute_id,NULL))),
62         PER_RIC_PKG.ref_info_rec('PQH_ATTRIBUTES_TL',PER_RIC_PKG.column_info_tbl(
63           PER_RIC_PKG.col_info_rec('ATTRIBUTE_ID',NULL, p_rec.attribute_id,NULL))),
64         PER_RIC_PKG.ref_info_rec('PQH_TEMPLATE_ATTRIBUTES',PER_RIC_PKG.column_info_tbl(
65           PER_RIC_PKG.col_info_rec('ATTRIBUTE_ID',NULL, p_rec.attribute_id,NULL))),
66         PER_RIC_PKG.ref_info_rec('PQH_TXN_CATEGORY_ATTRIBUTES',PER_RIC_PKG.column_info_tbl(
67           PER_RIC_PKG.col_info_rec('ATTRIBUTE_ID', NULL,p_rec.attribute_id, NULL)))),
68     p_ref_type=>'DEL');
69   --
70   --
71   -- Code Ends Here
72   --
73   -- Delete the pqh_attributes row.
74   --
75   delete from pqh_attributes
76   where attribute_id = p_rec.attribute_id;
77   --
78   --
79   hr_utility.set_location(' Leaving:'||l_proc, 10);
80 --
81 Exception
82   When hr_api.child_integrity_violated then
83     -- Child integrity has been violated
84     pqh_att_shd.constraint_error
85       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
86   When Others Then
87     Raise;
88 End delete_dml;
89 --
90 -- ----------------------------------------------------------------------------
91 -- |------------------------------< pre_delete >------------------------------|
92 -- ----------------------------------------------------------------------------
93 -- {Start Of Comments}
94 --
95 -- Description:
96 --   This private procedure contains any processing which is required before
97 --   the delete dml.
98 --
99 -- Prerequisites:
100 --   This is an internal procedure which is called from the del procedure.
101 --
102 -- In Parameters:
103 --   A Pl/Sql record structre.
104 --
105 -- Post Success:
106 --   Processing continues.
107 --
108 -- Post Failure:
109 --   If an error has occurred, an error message and exception will be raised
110 --   but not handled.
111 --
112 -- Developer Implementation Notes:
113 --   Any pre-processing required before the delete dml is issued should be
114 --   coded within this procedure. It is important to note that any 3rd party
115 --   maintenance should be reviewed before placing in this procedure.
116 --
117 -- Access Status:
118 --   Internal Row Handler Use Only.
119 --
120 -- {End Of Comments}
121 -- ----------------------------------------------------------------------------
122 Procedure pre_delete(p_rec in pqh_att_shd.g_rec_type) is
123 --
124   l_proc  varchar2(72) := g_package||'pre_delete';
125 --
126 Begin
127   hr_utility.set_location('Entering:'||l_proc, 5);
128   --
129   hr_utility.set_location(' Leaving:'||l_proc, 10);
130 End pre_delete;
131 --
132 -- ----------------------------------------------------------------------------
133 -- |-----------------------------< post_delete >------------------------------|
134 -- ----------------------------------------------------------------------------
135 -- {Start Of Comments}
136 --
137 -- Description:
138 --   This private procedure contains any processing which is required after the
139 --   delete dml.
140 --
141 -- Prerequisites:
142 --   This is an internal procedure which is called from the del procedure.
143 --
144 -- In Parameters:
145 --   A Pl/Sql record structre.
146 --
147 -- Post Success:
148 --   Processing continues.
149 --
150 -- Post Failure:
151 --   If an error has occurred, an error message and exception will be raised
152 --   but not handled.
153 --
154 -- Developer Implementation Notes:
155 --   Any post-processing required after the delete dml is issued should be
156 --   coded within this procedure. It is important to note that any 3rd party
157 --   maintenance should be reviewed before placing in this procedure.
158 --
159 -- Access Status:
160 --   Internal table Handler Use Only.
161 --
162 -- {End Of Comments}
163 -- ----------------------------------------------------------------------------
164 Procedure post_delete(
165 p_effective_date in date,p_rec in pqh_att_shd.g_rec_type) is
166 --
167   l_proc  varchar2(72) := g_package||'post_delete';
168 --
169 Begin
170   hr_utility.set_location('Entering:'||l_proc, 5);
171 --
172   --
173   -- Start of API User Hook for post_delete.
174   --
175   begin
176     --
177     pqh_att_rkd.after_delete
178       (
179   p_attribute_id                  =>p_rec.attribute_id
180  ,p_attribute_name_o              =>pqh_att_shd.g_old_rec.attribute_name
181  ,p_master_attribute_id_o         =>pqh_att_shd.g_old_rec.master_attribute_id
182  ,p_master_table_route_id_o       =>pqh_att_shd.g_old_rec.master_table_route_id
183  ,p_column_name_o                 =>pqh_att_shd.g_old_rec.column_name
184  ,p_column_type_o                 =>pqh_att_shd.g_old_rec.column_type
185  ,p_enable_flag_o                 =>pqh_att_shd.g_old_rec.enable_flag
186  ,p_width_o                       =>pqh_att_shd.g_old_rec.width
187  ,p_object_version_number_o       =>pqh_att_shd.g_old_rec.object_version_number
188  ,p_region_itemname_o             =>pqh_att_shd.g_old_rec.region_itemname
189  ,p_attribute_itemname_o          =>pqh_att_shd.g_old_rec.attribute_itemname
190  ,p_decode_function_name_o        =>pqh_att_shd.g_old_rec.decode_function_name
191       );
192     --
193   exception
194     --
195     when hr_api.cannot_find_prog_unit then
196       --
197       hr_api.cannot_find_prog_unit_error
198         (p_module_name => 'pqh_attributes'
199         ,p_hook_type   => 'AD');
200       --
201   end;
202   --
203   -- End of API User Hook for post_delete.
204   --
205   --
206   hr_utility.set_location(' Leaving:'||l_proc, 10);
207 End post_delete;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |---------------------------------< del >----------------------------------|
211 -- ----------------------------------------------------------------------------
212 Procedure del
213   (
214   p_effective_date in date,
215   p_rec	      in pqh_att_shd.g_rec_type
216   ) is
217 --
218   l_proc  varchar2(72) := g_package||'del';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   --
223   -- We must lock the row which we need to delete.
224   --
225   pqh_att_shd.lck
226 	(
227 	p_rec.attribute_id,
228 	p_rec.object_version_number
229 	);
230   --
231   -- Call the supporting delete validate operation
232   --
233   pqh_att_bus.delete_validate(p_rec
234   ,p_effective_date);
235   --
236   -- Call the supporting pre-delete operation
237   --
238   pre_delete(p_rec);
239   --
240   -- Delete the row.
241   --
242   delete_dml(p_rec);
243   --
244   -- Call the supporting post-delete operation
245   --
246   post_delete(
247 p_effective_date,p_rec);
248 End del;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |---------------------------------< del >----------------------------------|
252 -- ----------------------------------------------------------------------------
253 Procedure del
254   (
255   p_effective_date in date,
256   p_attribute_id                       in number,
257   p_object_version_number              in number
258   ) is
259 --
260   l_rec	  pqh_att_shd.g_rec_type;
261   l_proc  varchar2(72) := g_package||'del';
262 --
263 Begin
264   hr_utility.set_location('Entering:'||l_proc, 5);
265   --
266   -- As the delete procedure accepts a plsql record structure we do need to
267   -- convert the  arguments into the record structure.
268   -- We don't need to call the supplied conversion argument routine as we
269   -- only need a few attributes.
270   --
271   l_rec.attribute_id:= p_attribute_id;
272   l_rec.object_version_number := p_object_version_number;
273   --
274   -- Having converted the arguments into the pqh_att_rec
275   -- plsql record structure we must call the corresponding entity
276   -- business process
277   --
278   del(
279     p_effective_date,l_rec);
280   --
281   hr_utility.set_location(' Leaving:'||l_proc, 10);
282 End del;
283 --
284 end pqh_att_del;