DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_GRA_DEL

Source


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