DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HTC_DEL

Source


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