DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_STT_DEL

Source


1 Package Body per_stt_del as
2 /* $Header: pesttrhi.pkb 115.4 2002/12/09 14:19:55 eumenyio ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_stt_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 --      perform dml).
19 --   2) To delete the specified row from the schema using the primary key in
20 --      the predicates.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) To raise any other errors.
23 --
24 -- Prerequisites:
25 --   This is an internal private procedure which must be called from the del
26 --   procedure.
27 --
28 -- In Parameters:
29 --   A Pl/Sql record structre.
30 --
31 -- Post Success:
32 --   The specified row will be delete from the schema.
33 --
34 -- Post Failure:
35 --   On the delete dml failure it is important to note that we always reset the
36 --   If a child integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --   If any other error is reported, the error will be raised after the
39 --
40 -- Developer Implementation Notes:
41 --   None.
42 --
43 -- Access Status:
44 --   Internal Row Handler Use Only.
45 --
46 -- {End Of Comments}
47 -- ----------------------------------------------------------------------------
48 Procedure delete_dml(p_rec in per_stt_shd.g_rec_type) is
49 --
50   l_proc  varchar2(72) := g_package||'delete_dml';
51 --
52 Begin
53   hr_utility.set_location('Entering:'||l_proc, 5);
54   --
55   --
56   -- Delete the per_shared_types_tl row.
57   --
58   delete from per_shared_types_tl
59   where shared_type_id = p_rec.shared_type_id
60   and   language = p_rec.language;
61   --
62   --
63   hr_utility.set_location(' Leaving:'||l_proc, 10);
64 --
65 Exception
66   When hr_api.child_integrity_violated then
67     -- Child integrity has been violated
68     per_stt_shd.constraint_error
69       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
70   When Others Then
71     Raise;
72 End delete_dml;
73 --
74 -- ----------------------------------------------------------------------------
75 -- |------------------------------< pre_delete >------------------------------|
76 -- ----------------------------------------------------------------------------
77 -- {Start Of Comments}
78 --
79 -- Description:
80 --   This private procedure contains any processing which is required before
81 --   the delete dml.
82 --
83 -- Prerequisites:
84 --   This is an internal procedure which is called from the del procedure.
85 --
86 -- In Parameters:
87 --   A Pl/Sql record structre.
88 --
89 -- Post Success:
90 --   Processing continues.
91 --
92 -- Post Failure:
93 --   If an error has occurred, an error message and exception will be raised
94 --   but not handled.
95 --
96 -- Developer Implementation Notes:
97 --   Any pre-processing required before the delete dml is issued should be
98 --   coded within this procedure. It is important to note that any 3rd party
99 --   maintenance should be reviewed before placing in this procedure.
100 --
101 -- Access Status:
102 --   Internal Row Handler Use Only.
103 --
104 -- {End Of Comments}
105 -- ----------------------------------------------------------------------------
106 Procedure pre_delete(p_rec in per_stt_shd.g_rec_type) is
107 --
108   l_proc  varchar2(72) := g_package||'pre_delete';
109 --
110 Begin
111   hr_utility.set_location('Entering:'||l_proc, 5);
112   --
113   hr_utility.set_location(' Leaving:'||l_proc, 10);
114 End pre_delete;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |-----------------------------< post_delete >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 --   This private procedure contains any processing which is required after the
123 --   delete dml.
124 --
125 -- Prerequisites:
126 --   This is an internal procedure which is called from the del procedure.
127 --
128 -- In Parameters:
129 --   A Pl/Sql record structre.
130 --
131 -- Post Success:
132 --   Processing continues.
133 --
134 -- Post Failure:
135 --   If an error has occurred, an error message and exception will be raised
136 --   but not handled.
137 --
138 -- Developer Implementation Notes:
139 --   Any post-processing required after the delete dml is issued should be
140 --   coded within this procedure. It is important to note that any 3rd party
141 --   maintenance should be reviewed before placing in this procedure.
142 --
143 -- Access Status:
144 --   Internal table Handler Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure post_delete(p_rec in per_stt_shd.g_rec_type) is
149 --
150   l_proc  varchar2(72) := g_package||'post_delete';
151 --
152 Begin
153   hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155   --
156   -- Start of API User Hook for post_delete.
157   --
158   begin
159     --
160     per_stt_rkd.after_delete
161       (
162   p_shared_type_id                =>p_rec.shared_type_id
163  ,p_language_o                    =>per_stt_shd.g_old_rec.language
164  ,p_source_lang_o                 =>per_stt_shd.g_old_rec.source_lang
165  ,p_shared_type_name_o            =>per_stt_shd.g_old_rec.shared_type_name
166       );
167     --
168   exception
169     --
170     when hr_api.cannot_find_prog_unit then
171       --
172       hr_api.cannot_find_prog_unit_error
173         (p_module_name => 'per_shared_types_tl'
174         ,p_hook_type   => 'AD');
175       --
176   end;
177   --
178   -- End of API User Hook for post_delete.
179   --
180   --
181   hr_utility.set_location(' Leaving:'||l_proc, 10);
182 End post_delete;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |---------------------------------< del >----------------------------------|
186 -- ----------------------------------------------------------------------------
187 Procedure del
188   (
189   p_rec	      in per_stt_shd.g_rec_type
190   ) is
191 --
192   l_proc  varchar2(72) := g_package||'del';
193 --
194 Begin
195   hr_utility.set_location('Entering:'||l_proc, 5);
196   --
197   -- We must lock the row which we need to delete.
198   --
199   per_stt_shd.lck
200 	(
201 	p_rec.shared_type_id,
202 	p_rec.language
203 	);
204   --
205   -- Call the supporting delete validate operation
206   --
207   per_stt_bus.delete_validate(p_rec);
208   --
209   -- Call the supporting pre-delete operation
210   --
211   pre_delete(p_rec);
212   --
213   -- Delete the row.
214   --
215   delete_dml(p_rec);
216   --
217   -- Call the supporting post-delete operation
218   --
219   post_delete(p_rec);
220 End del;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |---------------------------------< del >----------------------------------|
224 -- ----------------------------------------------------------------------------
225 Procedure del
226   (
227   p_shared_type_id                     in number,
228   p_language                           in varchar2
229   ) is
230 --
231   l_rec	  per_stt_shd.g_rec_type;
232   l_proc  varchar2(72) := g_package||'del';
233 --
234 Begin
235   hr_utility.set_location('Entering:'||l_proc, 5);
236   --
237   -- As the delete procedure accepts a plsql record structure we do need to
238   -- convert the  arguments into the record structure.
239   -- We don't need to call the supplied conversion argument routine as we
240   -- only need a few attributes.
241   --
242   l_rec.shared_type_id:= p_shared_type_id;
243   l_rec.language:= p_language;
244   --
245   --
246   -- Having converted the arguments into the per_stt_rec
247   -- plsql record structure we must call the corresponding entity
248   -- business process
249   --
250   del(l_rec);
251   --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253 End del;
254 --
255 procedure del_tl (p_shared_type_id in number )
256 is
257  cursor csr_del_langs is
258    select stt.language
259    from per_shared_types_tl stt
260    where stt.shared_type_id = p_shared_type_id ;
261   l_proc  varchar2(72) := g_package||'del_tl';
262 --
263 Begin
264   hr_utility.set_location('Entering:'||l_proc, 10);
265   for l_lang in csr_del_langs loop
266     del(
267       p_shared_type_id   => p_shared_type_id,
268       p_language         => l_lang.language );
269   end loop;
270   hr_utility.set_location('Entering:'||l_proc, 20);
271 end del_tl ;
272 end per_stt_del;