DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_CTL_DEL

Source


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