DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TSR_DEL

Source


1 Package Body ota_tsr_del as
2 /* $Header: ottsr01t.pkb 120.2 2005/08/08 23:27:40 ssur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tsr_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 this
17 --   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 -- Pre Conditions:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Arguments:
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 Development Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in ota_tsr_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   ota_tsr_shd.g_api_dml := true;  -- Set the api dml status
59 
60   -- Bug. no. 3242410
61   ota_srt_del.del_tl (p_supplied_resource_id => p_rec.supplied_resource_id);
62 
63   -- Delete the ota_suppliable_resources row.
64   --
65 
66   delete from ota_suppliable_resources
67   where supplied_resource_id = p_rec.supplied_resource_id;
68   --
69   ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
70   --
71   hr_utility.set_location(' Leaving:'||l_proc, 10);
72 --
73 Exception
74   When hr_api.child_integrity_violated then
75     -- Child integrity has been violated
76     ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
77     ota_tsr_shd.constraint_error
78       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
79   When Others Then
80     ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
81     Raise;
82 End delete_dml;
83 --
84 -- ----------------------------------------------------------------------------
85 -- |------------------------------< pre_delete >------------------------------|
86 -- ----------------------------------------------------------------------------
87 -- {Start Of Comments}
88 --
89 -- Description:
90 --   This private procedure contains any processing which is required before
91 --   the delete dml.
92 --
93 -- Pre Conditions:
94 --   This is an internal procedure which is called from the del procedure.
95 --
96 -- In Arguments:
97 --   A Pl/Sql record structre.
98 --
99 -- Post Success:
100 --   Processing continues.
101 --
102 -- Post Failure:
103 --   If an error has occurred, an error message and exception will be raised
104 --   but not handled.
105 --
106 -- Developer Implementation Notes:
107 --   Any pre-processing required before the delete dml is issued should be
108 --   coded within this procedure. It is important to note that any 3rd party
109 --   maintenance should be reviewed before placing in this procedure.
110 --
111 -- Access Status:
112 --   Internal Development Use Only.
113 --
114 -- {End Of Comments}
115 -- ----------------------------------------------------------------------------
116 Procedure pre_delete(p_rec in ota_tsr_shd.g_rec_type) is
117 --
118   l_proc  varchar2(72) := g_package||'pre_delete';
119 --
120 Begin
121   hr_utility.set_location('Entering:'||l_proc, 5);
122   --
123   hr_utility.set_location(' Leaving:'||l_proc, 10);
124 End pre_delete;
125 --
126 -- ----------------------------------------------------------------------------
127 -- |-----------------------------< post_delete >------------------------------|
128 -- ----------------------------------------------------------------------------
129 -- {Start Of Comments}
130 --
131 -- Description:
132 --   This private procedure contains any processing which is required after the
133 --   delete dml.
134 --
135 -- Pre Conditions:
136 --   This is an internal procedure which is called from the del procedure.
137 --
138 -- In Arguments:
139 --   A Pl/Sql record structre.
140 --
141 -- Post Success:
142 --   Processing continues.
143 --
144 -- Post Failure:
145 --   If an error has occurred, an error message and exception will be raised
146 --   but not handled.
147 --
148 -- Developer Implementation Notes:
149 --   Any post-processing required after the delete dml is issued should be
150 --   coded within this procedure. It is important to note that any 3rd party
151 --   maintenance should be reviewed before placing in this procedure.
152 --
153 -- Access Status:
154 --   Internal Development Use Only.
155 --
156 -- {End Of Comments}
157 -- ----------------------------------------------------------------------------
158 Procedure post_delete(p_rec in ota_tsr_shd.g_rec_type) is
159 --
160   l_proc  varchar2(72) := g_package||'post_delete';
161 --
162 Begin
163   hr_utility.set_location('Entering:'||l_proc, 5);
164   --
165   hr_utility.set_location(' Leaving:'||l_proc, 10);
166 End post_delete;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |---------------------------------< del >----------------------------------|
170 -- ----------------------------------------------------------------------------
171 Procedure del
172   (
173   p_rec	      in ota_tsr_shd.g_rec_type,
174   p_validate  in boolean
175   ) is
176 --
177   l_proc  varchar2(72) := g_package||'del';
178 --
179 Begin
180   hr_utility.set_location('Entering:'||l_proc, 5);
181   --
182   -- Determine if the business process is to be validated.
183   --
184   If p_validate then
185     --
186     -- Issue the savepoint.
187     --
188     SAVEPOINT del_ota_tsr;
189   End If;
190   --
191   -- We must lock the row which we need to delete.
192   --
193   ota_tsr_shd.lck
194 	(
195 	p_rec.supplied_resource_id,
196 	p_rec.object_version_number
197 	);
198   --
199   -- Call the supporting delete validate operation
200   --
201   ota_tsr_bus.delete_validate(p_rec);
202   --
203   -- Call the supporting pre-delete operation
204   --
205   pre_delete(p_rec);
206   --
207   -- Delete the row.
208   --
209   delete_dml(p_rec);
210   --
211   -- Call the supporting post-delete operation
212   --
213   post_delete(p_rec);
214   --
215   -- If we are validating then raise the Validate_Enabled exception
216   --
217   If p_validate then
218     Raise HR_Api.Validate_Enabled;
219   End If;
220   --
221   hr_utility.set_location(' Leaving:'||l_proc, 10);
222 Exception
223   When HR_Api.Validate_Enabled Then
224     --
225     -- As the Validate_Enabled exception has been raised
226     -- we must rollback to the savepoint
227     --
228     ROLLBACK TO del_ota_tsr;
229 End del;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |---------------------------------< del >----------------------------------|
233 -- ----------------------------------------------------------------------------
234 Procedure del
235   (
236   p_supplied_resource_id               in number,
237   p_object_version_number              in number,
238   p_validate                           in boolean
239   ) is
240 --
241   l_rec	  ota_tsr_shd.g_rec_type;
242   l_proc  varchar2(72) := g_package||'del';
243 --
244 Begin
245   hr_utility.set_location('Entering:'||l_proc, 5);
246   --
247   -- As the delete procedure accepts a plsql record structure we do need to
248   -- convert the  arguments into the record structure.
249   -- We don't need to call the supplied conversion argument routine as we
250   -- only need a few attributes.
251   --
252   l_rec.supplied_resource_id:= p_supplied_resource_id;
253   l_rec.object_version_number := p_object_version_number;
254   --
255   -- Having converted the arguments into the ota_tsr_rec
256   -- plsql record structure we must call the corresponding entity
257   -- business process
258   --
259   del(l_rec, p_validate);
260   --
261   hr_utility.set_location(' Leaving:'||l_proc, 10);
262 End del;
263 --
264 end ota_tsr_del;