DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_LOT_DEL

Source


1 Package Body hr_lot_del as
2 /* $Header: hrlotrhi.pkb 115.10 2002/12/04 05:45:04 hjonnala ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_lot_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 hr_lot_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   -- Delete the hr_locations_all_tl row.
53   --
54   delete from hr_locations_all_tl
55   where location_id = p_rec.location_id
56   and   language = p_rec.language;
57   --
58   hr_utility.set_location(' Leaving:'||l_proc, 10);
59 --
60 Exception
61   When hr_api.child_integrity_violated then
62     -- Child integrity has been violated
63     hr_lot_shd.constraint_error
64       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
65   When Others Then
66     Raise;
67 End delete_dml;
68 --
69 -- ----------------------------------------------------------------------------
70 -- |------------------------------< pre_delete >------------------------------|
71 -- ----------------------------------------------------------------------------
72 -- {Start Of Comments}
73 --
74 -- Description:
75 --   This private procedure contains any processing which is required before
76 --   the delete dml.
77 --
78 -- Prerequisites:
79 --   This is an internal procedure which is called from the del procedure.
80 --
81 -- In Parameters:
82 --   A Pl/Sql record structre.
83 --
84 -- Post Success:
85 --   Processing continues.
86 --
87 -- Post Failure:
88 --   If an error has occurred, an error message and exception will be raised
89 --   but not handled.
90 --
91 -- Developer Implementation Notes:
92 --   Any pre-processing required before the delete dml is issued should be
93 --   coded within this procedure. It is important to note that any 3rd party
94 --   maintenance should be reviewed before placing in this procedure.
95 --
96 -- Access Status:
97 --   Internal Row Handler Use Only.
98 --
99 -- {End Of Comments}
100 -- ----------------------------------------------------------------------------
101 Procedure pre_delete(p_rec in hr_lot_shd.g_rec_type) is
102 --
103   l_proc  varchar2(72) := g_package||'pre_delete';
104 --
105 Begin
106   hr_utility.set_location('Entering:'||l_proc, 5);
107   --
108   hr_utility.set_location(' Leaving:'||l_proc, 10);
109 End pre_delete;
110 --
111 -- ----------------------------------------------------------------------------
112 -- |-----------------------------< post_delete >------------------------------|
113 -- ----------------------------------------------------------------------------
114 -- {Start Of Comments}
115 --
116 -- Description:
117 --   This private procedure contains any processing which is required after the
118 --   delete dml.
119 --
120 -- Prerequisites:
121 --   This is an internal procedure which is called from the del procedure.
122 --
123 -- In Parameters:
124 --   A Pl/Sql record structre.
125 --
126 -- Post Success:
127 --   Processing continues.
128 --
129 -- Post Failure:
130 --   If an error has occurred, an error message and exception will be raised
131 --   but not handled.
132 --
133 -- Developer Implementation Notes:
134 --   Any post-processing required after the delete dml is issued should be
135 --   coded within this procedure. It is important to note that any 3rd party
136 --   maintenance should be reviewed before placing in this procedure.
137 --
138 -- Access Status:
139 --   Internal table Handler Use Only.
140 --
141 -- {End Of Comments}
142 -- ----------------------------------------------------------------------------
143 Procedure post_delete(p_rec in hr_lot_shd.g_rec_type) is
144 --
145   l_proc  varchar2(72) := g_package||'post_delete';
146 --
147 Begin
148   hr_utility.set_location('Entering:'||l_proc, 5);
149 --
150   --
151   -- Start of API User Hook for post_delete.
152   --
153   begin
154     --
155     hr_lot_rkd.after_delete
156       (
157     p_location_id                   =>p_rec.location_id
158    ,p_language                      =>p_rec.language
159    ,p_source_lang_o                 =>hr_lot_shd.g_old_rec.source_lang
160    ,p_location_code_o               =>hr_lot_shd.g_old_rec.location_code
161    ,p_description_o                 =>hr_lot_shd.g_old_rec.description
162        );
163      --
164    exception
165       --
166       when hr_api.cannot_find_prog_unit then
167         --
168        hr_api.cannot_find_prog_unit_error
169         (p_module_name => 'HR_LOCATIONS_ALL_TL'
170         ,p_hook_type   => 'AD');
171       --
172   end;
173   --
174   -- End of API User Hook for post_delete.
175   --
176   --
177   hr_utility.set_location(' Leaving:'||l_proc, 10);
178 End post_delete;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |---------------------------------< del >----------------------------------|
182 -- ----------------------------------------------------------------------------
183 Procedure del
184   (
185   p_rec	      in hr_lot_shd.g_rec_type
186   ) is
187 --
188   l_proc  varchar2(72) := g_package||'del';
189 --
190 Begin
191   hr_utility.set_location('Entering:'||l_proc, 5);
192   --
193   -- We must lock the row which we need to delete.
194   --
195   hr_lot_shd.lck
196 	(
197 	p_rec.location_id,
198 	p_rec.language
199 	);
200   --
201   -- Call the supporting delete validate operation
202   --
203   hr_lot_bus.delete_validate(p_rec);
204   --
205   -- Call the supporting pre-delete operation
206   --
207   pre_delete(p_rec);
208   --
209   -- Delete the row.
210   --
211   delete_dml(p_rec);
212   --
213   -- Call the supporting post-delete operation
214   --
215   post_delete(p_rec);
216 End del;
217 --
218 -- ----------------------------------------------------------------------------
219 -- |---------------------------------< del >----------------------------------|
220 -- ----------------------------------------------------------------------------
221 Procedure del
222   (
223   p_location_id                        in number,
224   p_language                           in varchar2
225   ) is
226 --
227   l_rec	  hr_lot_shd.g_rec_type;
228   l_proc  varchar2(72) := g_package||'del';
229 --
230 Begin
231   hr_utility.set_location('Entering:'||l_proc, 5);
232   --
233   -- As the delete procedure accepts a plsql record structure we do need to
234   -- convert the  arguments into the record structure.
235   -- We don't need to call the supplied conversion argument routine as we
236   -- only need a few attributes.
237   --
238   l_rec.location_id := p_location_id;
239   l_rec.language    := p_language;
240   --
241   --
242   -- Having converted the arguments into the hr_lot_rec
243   -- plsql record structure we must call the corresponding entity
244   -- business process
245   --
246   del(l_rec);
247   --
248   hr_utility.set_location(' Leaving:'||l_proc, 10);
249 End del;
250 --
251 -- ------------------------------------------------------------------------
252 -- |-----------------------------< del_tl >-------------------------------|
253 -- ------------------------------------------------------------------------
254 Procedure del_tl
255  (
256     p_location_id                  in number
257  )
258 is
259   --
260   -- Cursor to obtain all the translation rows.
261   --
262   cursor csr_del_langs is
263     select lot.language
264       from hr_locations_all_tl lot
265      where lot.location_id = p_location_id;
266   --
267   l_proc              varchar2(72) := g_package||'del_tl';
268   l_deleted_anything  boolean := false;
269   --
270 Begin
271   hr_utility.set_location('Entering:'||l_proc, 10);
272   --
273   -- Delete all the translated rows
274   --
275   for l_lang in csr_del_langs loop
276     del
277      (p_location_id   => p_location_id
278      ,p_language      => l_lang.language
279      );
280     l_deleted_anything := true;
281   end loop;
282   --
283   if not l_deleted_anything then
284      hr_utility.set_message(800, 'HR_7220_INVALID_PRIMARY_KEY');
285      hr_utility.raise_error;
286   end if;
287   --
288   hr_utility.set_location(' Leaving:'||l_proc, 20);
289 End del_tl;
290 --
291 end hr_lot_del;