DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ZA_QUA_UPD

Source


1 Package Body per_za_qua_upd as
2 /* $Header: pezaquup.pkb 115.1 2002/12/05 06:52:11 nsugavan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_za_qua_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The processing of
17 --   this procedure is:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Pre Conditions:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' attribute list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Table Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml(p_rec in out nocopy per_za_qua_shd.g_za_rec_type) is
55 --
56   l_proc  varchar2(72) := g_package||'update_dml';
57 --
58 Begin
59   hr_utility.set_location('Entering:'||l_proc, 5);
60   --
61   -- Increment the object version
62   --
63   --
64   per_qua_shd.g_api_dml := true;  -- Set the api dml status
65   --
66   -- Update the per_qualifications Row
67   --
68   update per_za_formal_qualifications
69   set
70       qualification_id    = p_rec.qualification_id,
71       level_id            = p_rec.level_id,
72       field_of_learning   = p_rec.field_of_learning,
73       sub_field           = p_rec.sub_field,
74       registration_date   = p_rec.registration_date,
75       registration_number = p_rec.registration_number
76   where qualification_id = p_rec.qualification_id;
77   --
78   per_qua_shd.g_api_dml := false;   -- Unset the api dml status
79   --
80   hr_utility.set_location(' Leaving:'||l_proc, 10);
81 --
82 Exception
83   When hr_api.check_integrity_violated Then
84     -- A check constraint has been violated
85     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
86     per_qua_shd.constraint_error
87       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
88   When hr_api.parent_integrity_violated Then
89     -- Parent integrity has been violated
90     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
91     per_qua_shd.constraint_error
92       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
93   When hr_api.unique_integrity_violated Then
94     -- Unique integrity has been violated
95     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
96     per_qua_shd.constraint_error
97       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
98   When Others Then
99     per_qua_shd.g_api_dml := false;   -- Unset the api dml status
100     Raise;
101 End update_dml;
102 --
103 -- ----------------------------------------------------------------------------
104 -- |------------------------------< pre_update >------------------------------|
105 -- ----------------------------------------------------------------------------
106 -- {Start Of Comments}
107 --
108 -- Description:
109 --   This private procedure contains any processing which is required before
110 --   the update dml.
111 --
112 -- Pre Conditions:
113 --   This is an internal procedure which is called from the upd procedure.
114 --
115 -- In Parameters:
116 --   A Pl/Sql record structre.
117 --
118 -- Post Success:
119 --   Processing continues.
120 --
121 -- Post Failure:
122 --   If an error has occurred, an error message and exception will be raised
123 --   but not handled.
124 --
125 -- Developer Implementation Notes:
126 --   Any pre-processing required before the update dml is issued should be
127 --   coded within this procedure. It is important to note that any 3rd party
128 --   maintenance should be reviewed before placing in this procedure.
129 --
130 -- Access Status:
131 --   Internal Table Handler Use Only.
132 --
133 -- {End Of Comments}
134 -- ----------------------------------------------------------------------------
135 Procedure pre_update(p_rec in per_za_qua_shd.g_za_rec_type) is
136 --
137   l_proc  varchar2(72) := g_package||'pre_update';
138 --
139 Begin
140   hr_utility.set_location('Entering:'||l_proc, 5);
141   --
142   hr_utility.set_location(' Leaving:'||l_proc, 10);
143 End pre_update;
144 --
145 -- ----------------------------------------------------------------------------
146 -- |-----------------------------< post_update >------------------------------|
147 -- ----------------------------------------------------------------------------
148 -- {Start Of Comments}
149 --
150 -- Description:
151 --   This private procedure contains any processing which is required after the
152 --   update dml.
153 --
154 -- Pre Conditions:
155 --   This is an internal procedure which is called from the upd procedure.
156 --
157 -- In Parameters:
158 --   A Pl/Sql record structre.
159 --
160 -- Post Success:
161 --   Processing continues.
162 --
163 -- Post Failure:
164 --   If an error has occurred, an error message and exception will be raised
165 --   but not handled.
166 --
167 -- Developer Implementation Notes:
168 --   Any post-processing required after the update dml is issued should be
169 --   coded within this procedure. It is important to note that any 3rd party
170 --   maintenance should be reviewed before placing in this procedure.
171 --
172 -- Access Status:
173 --   Internal Table Handler Use Only.
174 --
175 -- {End Of Comments}
176 -- ----------------------------------------------------------------------------
177 Procedure post_update(p_rec in per_za_qua_shd.g_za_rec_type) is
178 --
179   l_proc  varchar2(72) := g_package||'post_update';
180 --
181 Begin
182   hr_utility.set_location('Entering:'||l_proc, 5);
183   --
184   hr_utility.set_location(' Leaving:'||l_proc, 10);
185 End post_update;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |---------------------------------< upd >----------------------------------|
189 -- ----------------------------------------------------------------------------
190 Procedure upd
191   (
192   p_rec            in out nocopy per_za_qua_shd.g_za_rec_type,
193   p_validate       in     boolean default false
194   ) is
195 --
196   l_proc  varchar2(72) := g_package||'upd';
197 --
198 Begin
199   hr_utility.set_location('Entering:'||l_proc, 5);
200   --
201   -- Determine if the business process is to be validated.
202   --
203   If p_validate then
204     --
205     -- Issue the savepoint.
206     --
207     SAVEPOINT upd_qua;
208   End If;
209   --
210   -- We must lock the row which we need to update.
211   --
212   per_za_qua_shd.lck
213 	(
214 	p_rec.qualification_id
215 	);
216   --
217   -- 1. During an update system defaults are used to determine if
218   --    arguments have been defaulted or not. We must therefore
219   --    derive the full record structure values to be updated.
220   --
221   -- 2. Call the supporting update validate operations.
222   --
223 --  convert_defs(p_rec);
224 --  per_qua_bus.update_validate(p_rec,p_effective_date);
225   --
226   -- Call the supporting pre-update operation
227   --
228   pre_update(p_rec);
229   --
230   -- Update the row.
231   --
232   update_dml(p_rec);
233   --
234   -- Call the supporting post-update operation
235   --
236   post_update(p_rec);
237   --
238   -- If we are validating then raise the Validate_Enabled exception
239   --
240   If p_validate then
241     Raise HR_Api.Validate_Enabled;
242   End If;
243   --
244   hr_utility.set_location(' Leaving:'||l_proc, 10);
245 Exception
246   When HR_Api.Validate_Enabled Then
247     --
248     -- As the Validate_Enabled exception has been raised
249     -- we must rollback to the savepoint
250     --
251     ROLLBACK TO upd_qua;
252 End upd;
253 --
254 -- ----------------------------------------------------------------------------
255 -- |---------------------------------< upd >----------------------------------|
256 -- ----------------------------------------------------------------------------
257 Procedure upd
258   (
259   p_qualification_id             in number,
260   p_level_id                     in number   default null,
261   p_field_of_learning            in varchar2 default null,
262   p_sub_field                    in varchar2 default null,
263   p_registration_date            in date     default null,
264   p_registration_number          in varchar2 default null,
265   p_validate                     in boolean  default false
266   ) is
267 --
268   l_rec	  per_za_qua_shd.g_za_rec_type;
269   l_proc  varchar2(72) := g_package||'upd';
270 --
271 Begin
272   hr_utility.set_location('Entering:'||l_proc, 5);
273   --
274   -- Call conversion function to turn arguments into the
275   -- l_rec structure.
276   --
277   l_rec :=
278   per_za_qua_shd.convert_args
279   (
280   p_qualification_id,
281   p_level_id,
282   p_field_of_learning,
283   p_sub_field,
284   p_registration_date,
285   p_registration_number
286   );
287   --
288   -- Having converted the arguments into the
289   -- plsql record structure we call the corresponding record
290   -- business process.
291   --
292   upd(l_rec, p_validate);
293   --
294   hr_utility.set_location(' Leaving:'||l_proc, 10);
295 End upd;
296 --
297 end per_za_qua_upd;