1 Package Body per_za_ass_upd as
2 /* $Header: pezaasup.pkb 115.1 2002/12/05 06:49:48 nsugavan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_za_ass_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).
25 -- 5) To raise any other errors.
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.
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_ass_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_za_ass_shd.g_api_dml := true; -- Set the api dml status
65 --
66 -- Update the per_za_assessments Row
67 --
68 update per_za_assessments
69 set
70 assessment_id = p_rec.assessment_id,
71 person_id = p_rec.person_id,
72 level_id = p_rec.level_id,
73 name_of_assessor = p_rec.name_of_assessor,
74 institution = p_rec.institution,
75 credit = p_rec.credit,
76 date_of_assessment = p_rec.date_of_assessment,
77 final_result = p_rec.final_result,
78 assessment_number = p_rec.assessment_number,
79 location_where_assessed = p_rec.location_where_assessed,
80 field_of_learning = p_rec.field_of_learning,
81 sub_field = p_rec.sub_field,
82 assessment_start_date = p_rec.assessment_start_date,
83 assessment_end_date = p_rec.assessment_end_date,
84 competence_acquired = p_rec.competence_acquired,
85 ETQA_name = p_rec.ETQA_name,
86 certification_date = p_rec.certification_date,
87 certificate_number = p_rec.certificate_number,
88 accredited_by = p_rec.accredited_by,
89 date_of_accreditation = p_rec.date_of_accreditation,
90 certification_expiry_date = p_rec.certification_expiry_date
91 where assessment_id = p_rec.assessment_id;
92 --
93 per_za_ass_shd.g_api_dml := false; -- Unset the api dml status
94 --
95 hr_utility.set_location(' Leaving:'||l_proc, 10);
96 --
97 Exception
98 When hr_api.check_integrity_violated Then
99 -- A check constraint has been violated
100 per_za_ass_shd.g_api_dml := false; -- Unset the api dml status
101 per_za_ass_shd.constraint_error
102 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
103 When hr_api.parent_integrity_violated Then
104 -- Parent integrity has been violated
105 per_za_ass_shd.g_api_dml := false; -- Unset the api dml status
106 per_za_ass_shd.constraint_error
107 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
108 When hr_api.unique_integrity_violated Then
109 -- Unique integrity has been violated
110 per_za_ass_shd.g_api_dml := false; -- Unset the api dml status
111 per_za_ass_shd.constraint_error
112 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
113 When Others Then
114 per_za_ass_shd.g_api_dml := false; -- Unset the api dml status
115 Raise;
116 End update_dml;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |------------------------------< pre_update >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 -- This private procedure contains any processing which is required before
125 -- the update dml.
126 --
127 -- Pre Conditions:
128 -- This is an internal procedure which is called from the upd procedure.
129 --
130 -- In Parameters:
131 -- A Pl/Sql record structre.
132 --
133 -- Post Success:
134 -- Processing continues.
135 --
136 -- Post Failure:
137 -- If an error has occurred, an error message and exception will be raised
138 -- but not handled.
139 --
140 -- Developer Implementation Notes:
141 -- Any pre-processing required before the update dml is issued should be
142 -- coded within this procedure. It is important to note that any 3rd party
143 -- maintenance should be reviewed before placing in this procedure.
144 --
145 -- Access Status:
146 -- Internal Table Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- ----------------------------------------------------------------------------
150 Procedure pre_update(p_rec in per_za_ass_shd.g_za_rec_type) is
151 --
152 l_proc varchar2(72) := g_package||'pre_update';
153 --
154 Begin
155 hr_utility.set_location('Entering:'||l_proc, 5);
156 --
157 hr_utility.set_location(' Leaving:'||l_proc, 10);
158 End pre_update;
159 --
163 -- {Start Of Comments}
160 -- ----------------------------------------------------------------------------
161 -- |-----------------------------< post_update >------------------------------|
162 -- ----------------------------------------------------------------------------
164 --
165 -- Description:
166 -- This private procedure contains any processing which is required after the
167 -- update dml.
168 --
169 -- Pre Conditions:
170 -- This is an internal procedure which is called from the upd procedure.
171 --
172 -- In Parameters:
173 -- A Pl/Sql record structre.
174 --
175 -- Post Success:
176 -- Processing continues.
177 --
178 -- Post Failure:
179 -- If an error has occurred, an error message and exception will be raised
180 -- but not handled.
181 --
182 -- Developer Implementation Notes:
183 -- Any post-processing required after the update dml is issued should be
184 -- coded within this procedure. It is important to note that any 3rd party
185 -- maintenance should be reviewed before placing in this procedure.
186 --
187 -- Access Status:
188 -- Internal Table Handler Use Only.
189 --
190 -- {End Of Comments}
191 -- ----------------------------------------------------------------------------
192 Procedure post_update(p_rec in per_za_ass_shd.g_za_rec_type) is
193 --
194 l_proc varchar2(72) := g_package||'post_update';
195 --
196 Begin
197 hr_utility.set_location('Entering:'||l_proc, 5);
198 --
199 hr_utility.set_location(' Leaving:'||l_proc, 10);
200 End post_update;
201 -- ----------------------------------------------------------------------------
202 -- |---------------------------------< upd >----------------------------------|
203 -- ----------------------------------------------------------------------------
204 Procedure upd
205 (
206 p_rec in out nocopy per_za_ass_shd.g_za_rec_type,
207 p_validate in boolean default false
208 ) is
209 --
210 l_proc varchar2(72) := g_package||'upd';
211 --
212 Begin
213 hr_utility.set_location('Entering:'||l_proc, 5);
214 --
215 -- Determine if the business process is to be validated.
216 --
217 If p_validate then
218 --
219 -- Issue the savepoint.
220 --
221 SAVEPOINT upd_ass;
222 End If;
223 --
224 -- We must lock the row which we need to update.
225 --
226 per_za_ass_shd.lck
227 (
228 p_rec.assessment_id,
229 p_rec.person_id
230 );
231 --
232 -- 1. During an update system defaults are used to determine if
233 -- arguments have been defaulted or not. We must therefore
234 -- derive the full record structure values to be updated.
235 --
236 -- 2. Call the supporting update validate operations.
237 --
238 -- convert_defs(p_rec);
239 -- per_za_ass_bus.update_validate(p_rec,p_effective_date);
240 --
241 -- Call the supporting pre-update operation
242 --
243 pre_update(p_rec);
244 --
245 -- Update the row.
246 --
247 update_dml(p_rec);
248 --
249 -- Call the supporting post-update operation
250 --
251 post_update(p_rec);
252 --
253 -- If we are validating then raise the Validate_Enabled exception
254 --
255 If p_validate then
256 Raise HR_Api.Validate_Enabled;
257 End If;
258 --
259 hr_utility.set_location(' Leaving:'||l_proc, 10);
260 Exception
261 When HR_Api.Validate_Enabled Then
262 --
266 ROLLBACK TO upd_ass;
263 -- As the Validate_Enabled exception has been raised
264 -- we must rollback to the savepoint
265 --
267 End upd;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |---------------------------------< upd >----------------------------------|
271 -- ----------------------------------------------------------------------------
272 Procedure upd
273 (
274 p_assessment_id in number,
275 p_person_id in number,
276 p_level_id in number default null,
277 p_name_of_assessor in varchar2,
278 p_institution in varchar2 default null,
279 p_credit in number default null,
280 p_date_of_assessment in date default null,
281 p_final_result in varchar2 default null,
282 p_assessment_number in varchar2 default null,
283 p_location_where_assessed in varchar2 default null,
284 p_field_of_learning in varchar2 default null,
285 p_sub_field in varchar2 default null,
286 p_assessment_start_date in date default null,
287 p_assessment_end_date in date default null,
288 p_competence_acquired in varchar2 default null,
289 p_ETQA_name in varchar2 default null,
290 p_certification_date in date default null,
291 p_certificate_number in varchar2 default null,
292 p_accredited_by in varchar2 default null,
293 p_date_of_accreditation in date default null,
294 p_certification_expiry_date in date default null,
295 p_validate in boolean default false
296 ) is
297 --
298 l_rec per_za_ass_shd.g_za_rec_type;
299 l_proc varchar2(72) := g_package||'upd';
300 --
301 Begin
302 hr_utility.set_location('Entering:'||l_proc, 5);
303 --
304 -- Call conversion function to turn arguments into the
305 -- l_rec structure.
306 --
307 l_rec :=
308 per_za_ass_shd.convert_args
309 (
310 p_assessment_id,
311 p_person_id ,
312 p_level_id,
313 p_name_of_assessor ,
314 p_institution,
315 p_credit ,
316 p_date_of_assessment ,
317 p_final_result,
318 p_assessment_number,
319 p_location_where_assessed,
320 p_field_of_learning,
321 p_sub_field,
322 p_assessment_start_date,
323 p_assessment_end_date,
324 p_competence_acquired,
325 p_ETQA_name,
326 p_certification_date,
327 p_certificate_number,
328 p_accredited_by,
329 p_date_of_accreditation,
330 p_certification_expiry_date
331 );
332 --
333 -- Having converted the arguments into the
334 -- plsql record structure we call the corresponding record
335 -- business process.
336 --
337 upd(l_rec, p_validate);
338 --
339 hr_utility.set_location(' Leaving:'||l_proc, 10);
340 End upd;
341 --
342 end per_za_ass_upd;