DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SHT_DEL

Source


1 Package Body per_sht_del as
2 /* $Header: peshtrhi.pkb 120.1 2011/04/28 09:50:48 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_sht_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 --   2) To delete the specified row from the schema using the primary key in
19 --      the predicates.
20 --   3) To trap any constraint violations that may have occurred.
21 --   4) 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 per_sht_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=>'PER_SHARED_TYPES',
58     p_ref_entity_info=>
59     PER_RIC_PKG.ref_entity_tbl(
60       PER_RIC_PKG.ref_info_rec('HR_ALL_POSITIONS_F',PER_RIC_PKG.column_info_tbl(
61         PER_RIC_PKG.col_info_rec('AVAILABILITY_STATUS_ID', NULL, p_rec.shared_type_id,NULL))),
62       PER_RIC_PKG.ref_info_rec('PQH_BUDGETS',PER_RIC_PKG.column_info_tbl(
63         PER_RIC_PKG.col_info_rec('BUDGET_UNIT1_ID', NULL,p_rec.shared_type_id,NULL))),
64       PER_RIC_PKG.ref_info_rec('PQH_BUDGETS',PER_RIC_PKG.column_info_tbl(
65         PER_RIC_PKG.col_info_rec('BUDGET_UNIT2_ID', NULL, p_rec.shared_type_id,NULL))),
66       PER_RIC_PKG.ref_info_rec('PQH_BUDGETS',PER_RIC_PKG.column_info_tbl(
67         PER_RIC_PKG.col_info_rec('BUDGET_UNIT3_ID', NULL,p_rec.shared_type_id,NULL))),
68       PER_RIC_PKG.ref_info_rec('PQH_BUDGET_POOLS',PER_RIC_PKG.column_info_tbl(
69         PER_RIC_PKG.col_info_rec('BUDGET_UNIT_ID', NULL, p_rec.shared_type_id,NULL))),
70       PER_RIC_PKG.ref_info_rec('PQH_POSITION_TRANSACTIONS',PER_RIC_PKG.column_info_tbl(
71         PER_RIC_PKG.col_info_rec('AVAILABILITY_STATUS_ID', NULL,p_rec.shared_type_id,NULL))),
72       PER_RIC_PKG.ref_info_rec('PER_SHARED_TYPES_TL',PER_RIC_PKG.column_info_tbl(
73         PER_RIC_PKG.col_info_rec('SHARED_TYPE_ID', NULL, p_rec.shared_type_id,NULL)))),
74     p_ref_type=>'DEL');
75   --
76   -- Code Ends Here
77   --
78   -- Delete the per_shared_types row.
79   --
80   delete from per_shared_types
81   where shared_type_id = p_rec.shared_type_id;
82   --
83   hr_utility.set_location(' Leaving:'||l_proc, 10);
84 --
85 Exception
86   When hr_api.child_integrity_violated then
87     -- Child integrity has been violated
88     per_sht_shd.constraint_error
89       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
90   When Others Then
91     Raise;
92 End delete_dml;
93 --
94 -- ----------------------------------------------------------------------------
95 -- |------------------------------< pre_delete >------------------------------|
96 -- ----------------------------------------------------------------------------
97 -- {Start Of Comments}
98 --
99 -- Description:
100 --   This private procedure contains any processing which is required before
101 --   the delete dml.
102 --
103 -- Prerequisites:
104 --   This is an internal procedure which is called from the del procedure.
105 --
106 -- In Parameters:
107 --   A Pl/Sql record structre.
108 --
109 -- Post Success:
110 --   Processing continues.
111 --
112 -- Post Failure:
113 --   If an error has occurred, an error message and exception will be raised
114 --   but not handled.
115 --
116 -- Developer Implementation Notes:
117 --   Any pre-processing required before the delete dml is issued should be
118 --   coded within this procedure. It is important to note that any 3rd party
119 --   maintenance should be reviewed before placing in this procedure.
120 --
121 -- Access Status:
122 --   Internal Row Handler Use Only.
123 --
124 -- {End Of Comments}
125 -- ----------------------------------------------------------------------------
126 Procedure pre_delete(p_rec in per_sht_shd.g_rec_type) is
127 --
128   l_proc  varchar2(72) := g_package||'pre_delete';
129 --
130 Begin
131   hr_utility.set_location('Entering:'||l_proc, 5);
132   --
133   hr_utility.set_location(' Leaving:'||l_proc, 10);
134 End pre_delete;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |-----------------------------< post_delete >------------------------------|
138 -- ----------------------------------------------------------------------------
139 -- {Start Of Comments}
140 --
141 -- Description:
142 --   This private procedure contains any processing which is required after the
143 --   delete dml.
144 --
145 -- Prerequisites:
146 --   This is an internal procedure which is called from the del procedure.
147 --
148 -- In Parameters:
149 --   A Pl/Sql record structre.
150 --
151 -- Post Success:
152 --   Processing continues.
153 --
154 -- Post Failure:
155 --   If an error has occurred, an error message and exception will be raised
156 --   but not handled.
157 --
158 -- Developer Implementation Notes:
159 --   Any post-processing required after the delete dml is issued should be
160 --   coded within this procedure. It is important to note that any 3rd party
161 --   maintenance should be reviewed before placing in this procedure.
162 --
163 -- Access Status:
164 --   Internal table Handler Use Only.
165 --
166 -- {End Of Comments}
167 -- ----------------------------------------------------------------------------
168 Procedure post_delete(
169 p_effective_date in date,p_rec in per_sht_shd.g_rec_type) is
170 --
171   l_proc  varchar2(72) := g_package||'post_delete';
172 --
173 Begin
174   hr_utility.set_location('Entering:'||l_proc, 5);
175 --
176   --
177   -- Start of API User Hook for post_delete.
178   --
179   begin
180     --
181     per_sht_rkd.after_delete
182       (
183   p_shared_type_id                =>p_rec.shared_type_id
184  ,p_business_group_id_o           =>per_sht_shd.g_old_rec.business_group_id
185  ,p_shared_type_name_o            =>per_sht_shd.g_old_rec.shared_type_name
186  ,p_shared_type_code_o            =>per_sht_shd.g_old_rec.shared_type_code
187  ,p_system_type_cd_o              =>per_sht_shd.g_old_rec.system_type_cd
188  ,p_information1_o                =>per_sht_shd.g_old_rec.information1
189  ,p_information2_o                =>per_sht_shd.g_old_rec.information2
190  ,p_information3_o                =>per_sht_shd.g_old_rec.information3
191  ,p_information4_o                =>per_sht_shd.g_old_rec.information4
192  ,p_information5_o                =>per_sht_shd.g_old_rec.information5
193  ,p_information6_o                =>per_sht_shd.g_old_rec.information6
194  ,p_information7_o                =>per_sht_shd.g_old_rec.information7
195  ,p_information8_o                =>per_sht_shd.g_old_rec.information8
196  ,p_information9_o                =>per_sht_shd.g_old_rec.information9
197  ,p_information10_o               =>per_sht_shd.g_old_rec.information10
198  ,p_information11_o               =>per_sht_shd.g_old_rec.information11
199  ,p_information12_o               =>per_sht_shd.g_old_rec.information12
200  ,p_information13_o               =>per_sht_shd.g_old_rec.information13
201  ,p_information14_o               =>per_sht_shd.g_old_rec.information14
202  ,p_information15_o               =>per_sht_shd.g_old_rec.information15
203  ,p_information16_o               =>per_sht_shd.g_old_rec.information16
204  ,p_information17_o               =>per_sht_shd.g_old_rec.information17
205  ,p_information18_o               =>per_sht_shd.g_old_rec.information18
206  ,p_information19_o               =>per_sht_shd.g_old_rec.information19
207  ,p_information20_o               =>per_sht_shd.g_old_rec.information20
208  ,p_information21_o               =>per_sht_shd.g_old_rec.information21
209  ,p_information22_o               =>per_sht_shd.g_old_rec.information22
210  ,p_information23_o               =>per_sht_shd.g_old_rec.information23
211  ,p_information24_o               =>per_sht_shd.g_old_rec.information24
212  ,p_information25_o               =>per_sht_shd.g_old_rec.information25
213  ,p_information26_o               =>per_sht_shd.g_old_rec.information26
214  ,p_information27_o               =>per_sht_shd.g_old_rec.information27
215  ,p_information28_o               =>per_sht_shd.g_old_rec.information28
216  ,p_information29_o               =>per_sht_shd.g_old_rec.information29
217  ,p_information30_o               =>per_sht_shd.g_old_rec.information30
218  ,p_information_category_o        =>per_sht_shd.g_old_rec.information_category
219  ,p_object_version_number_o       =>per_sht_shd.g_old_rec.object_version_number
220  ,p_lookup_type_o                 =>per_sht_shd.g_old_rec.lookup_type
221       );
222     --
223   exception
224     --
225     when hr_api.cannot_find_prog_unit then
226       --
227       hr_api.cannot_find_prog_unit_error
228         (p_module_name => 'per_shared_types'
229         ,p_hook_type   => 'AD');
230       --
231   end;
232   --
233   -- End of API User Hook for post_delete.
234   --
235   --
236   hr_utility.set_location(' Leaving:'||l_proc, 10);
237 End post_delete;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |---------------------------------< del >----------------------------------|
241 -- ----------------------------------------------------------------------------
242 Procedure del
243   (
244   p_effective_date in date,
245   p_rec	      in per_sht_shd.g_rec_type
246   ) is
247 --
248   l_proc  varchar2(72) := g_package||'del';
249 --
250 Begin
251   hr_utility.set_location('Entering:'||l_proc, 5);
252   --
253   -- We must lock the row which we need to delete.
254   --
255   per_sht_shd.lck
256 	(
257 	p_rec.shared_type_id,
258 	p_rec.object_version_number
259 	);
260   --
261   -- Call the supporting delete validate operation
262   --
263   per_sht_bus.delete_validate(p_rec
264   ,p_effective_date);
265   --
266   -- Call the supporting pre-delete operation
267   --
268   pre_delete(p_rec);
269   --
270   -- Delete the row.
271   --
272   delete_dml(p_rec);
273   --
274   -- Call the supporting post-delete operation
275   --
276   post_delete(
277 p_effective_date,p_rec);
278 End del;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------------< del >----------------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure del
284   (
285   p_effective_date in date,
286   p_shared_type_id                     in number,
287   p_object_version_number              in number
288   ) is
289 --
290   l_rec	  per_sht_shd.g_rec_type;
291   l_proc  varchar2(72) := g_package||'del';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295   --
296   -- As the delete procedure accepts a plsql record structure we do need to
297   -- convert the  arguments into the record structure.
298   -- We don't need to call the supplied conversion argument routine as we
299   -- only need a few attributes.
300   --
301   l_rec.shared_type_id:= p_shared_type_id;
302   l_rec.object_version_number := p_object_version_number;
303   --
304   -- Having converted the arguments into the per_sht_rec
305   -- plsql record structure we must call the corresponding entity
306   -- business process
307   --
308   del(
309     p_effective_date,l_rec);
310   --
311   hr_utility.set_location(' Leaving:'||l_proc, 10);
312 End del;
313 --
314 end per_sht_del;