DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_GRS_DEL

Source


1 Package Body per_grs_del as
2 /* $Header: pegrsrhi.pkb 115.3 2002/12/05 17:40:37 pkakar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_grs_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 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
21 --      the predicates.
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_grs_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_grs_shd.g_api_dml := true;  -- Set the api dml status
59   --
60   -- Delete the per_cagr_grade_structures row.
61   --
62   delete from per_cagr_grade_structures
63   where cagr_grade_structure_id = p_rec.cagr_grade_structure_id;
64   --
65   per_grs_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_grs_shd.g_api_dml := false;   -- Unset the api dml status
73     per_grs_shd.constraint_error
74       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75   When Others Then
76     per_grs_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_effective_date in date,
113                      p_rec in per_grs_shd.g_rec_type) 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_effective_date  in date,
156 		      p_rec in per_grs_shd.g_rec_type) 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     --
168     per_grs_rkd.after_delete
169       (
170   p_cagr_grade_structure_id       =>p_rec.cagr_grade_structure_id
171  ,p_collective_agreement_id_o     =>per_grs_shd.g_old_rec.collective_agreement_id
172  ,p_object_version_number_o       =>per_grs_shd.g_old_rec.object_version_number
173  ,p_id_flex_num_o                 =>per_grs_shd.g_old_rec.id_flex_num
174  ,p_dynamic_insert_allowed_o      =>per_grs_shd.g_old_rec.dynamic_insert_allowed
175  ,p_attribute_category_o          =>per_grs_shd.g_old_rec.attribute_category
176  ,p_attribute1_o                  =>per_grs_shd.g_old_rec.attribute1
177  ,p_attribute2_o                  =>per_grs_shd.g_old_rec.attribute2
178  ,p_attribute3_o                  =>per_grs_shd.g_old_rec.attribute3
179  ,p_attribute4_o                  =>per_grs_shd.g_old_rec.attribute4
180  ,p_attribute5_o                  =>per_grs_shd.g_old_rec.attribute5
181  ,p_attribute6_o                  =>per_grs_shd.g_old_rec.attribute6
182  ,p_attribute7_o                  =>per_grs_shd.g_old_rec.attribute7
183  ,p_attribute8_o                  =>per_grs_shd.g_old_rec.attribute8
184  ,p_attribute9_o                  =>per_grs_shd.g_old_rec.attribute9
185  ,p_attribute10_o                 =>per_grs_shd.g_old_rec.attribute10
186  ,p_attribute11_o                 =>per_grs_shd.g_old_rec.attribute11
187  ,p_attribute12_o                 =>per_grs_shd.g_old_rec.attribute12
188  ,p_attribute13_o                 =>per_grs_shd.g_old_rec.attribute13
189  ,p_attribute14_o                 =>per_grs_shd.g_old_rec.attribute14
190  ,p_attribute15_o                 =>per_grs_shd.g_old_rec.attribute15
191  ,p_attribute16_o                 =>per_grs_shd.g_old_rec.attribute16
192  ,p_attribute17_o                 =>per_grs_shd.g_old_rec.attribute17
193  ,p_attribute18_o                 =>per_grs_shd.g_old_rec.attribute18
194  ,p_attribute19_o                 =>per_grs_shd.g_old_rec.attribute19
195  ,p_attribute20_o                 =>per_grs_shd.g_old_rec.attribute20
196  ,p_effective_date		  =>p_effective_date
197       );
198     --
199   exception
200     --
201     when hr_api.cannot_find_prog_unit then
202       --
203       hr_api.cannot_find_prog_unit_error
204         (p_module_name => 'per_cagr_grade_structures'
205         ,p_hook_type   => 'AD');
206       --
207   end;
208   --
209   -- End of API User Hook for post_delete.
210   --
211   --
212   hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End post_delete;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |---------------------------------< del >----------------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure del
219   (p_effective_date   in date,
220    p_rec	      in per_grs_shd.g_rec_type
221   ) is
222 --
223   l_proc  varchar2(72) := g_package||'del';
224 --
225 Begin
226   hr_utility.set_location('Entering:'||l_proc, 5);
227   --
228   -- We must lock the row which we need to delete.
229   --
230   per_grs_shd.lck
231 	(p_effective_date           => p_effective_date,
232 	 p_cagr_grade_structure_id  => p_rec.cagr_grade_structure_id,
233 	 p_object_version_number    => p_rec.object_version_number
234 	);
235   --
236   -- Call the supporting delete validate operation
237   --
238   per_grs_bus.delete_validate(p_effective_date  => p_effective_date,
239   			      p_rec		=> p_rec);
240   --
241   -- Call the supporting pre-delete operation
242   --
243   pre_delete(p_effective_date   => p_effective_date,
244   	     p_rec		=> p_rec);
245   --
246   -- Delete the row.
247   --
248   delete_dml(p_rec);
249   --
250   -- Call the supporting post-delete operation
251   --
252   post_delete(p_effective_date   => p_effective_date,
253   	      p_rec		 => p_rec);
254   --
255   hr_utility.set_location(' Leaving:'||l_proc, 10);
256 --
257 End del;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |---------------------------------< del >----------------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure del
263   (p_cagr_grade_structure_id            in number,
264    p_object_version_number              in number,
265    p_effective_date   			in date
266   ) is
267 --
268   l_rec	  per_grs_shd.g_rec_type;
269   l_proc  varchar2(72) := g_package||'del';
270 --
271 Begin
272   hr_utility.set_location('Entering:'||l_proc, 5);
273   --
274   -- As the delete procedure accepts a plsql record structure we do need to
275   -- convert the  arguments into the record structure.
276   -- We don't need to call the supplied conversion argument routine as we
277   -- only need a few attributes.
278   --
279   l_rec.cagr_grade_structure_id:= p_cagr_grade_structure_id;
280   l_rec.object_version_number := p_object_version_number;
281   --
282   -- Having converted the arguments into the per_grs_rec
283   -- plsql record structure we must call the corresponding entity
284   -- business process
285   --
286   del(p_effective_date   => p_effective_date,
287       p_rec		 => l_rec);
288   --
289   hr_utility.set_location(' Leaving:'||l_proc, 10);
290 End del;
291 --
292 end per_grs_del;