DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_POS_UPD

Source


1 Package Body per_pos_upd as
2 /* $Header: peposrhi.pkb 115.26 2003/11/26 15:25:03 hsajja ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pos_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 functions of this
17 --   procedure are as follows:
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 Arguments:
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' arguments 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_pos_shd.g_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   p_rec.object_version_number := p_rec.object_version_number + 1;
64   --
65   per_pos_shd.g_api_dml := true;  -- Set the api dml status
66   --
67   -- PMFLETCH Now using per_all_positions
68   --
69   -- Update the per_all_positions Row
70   --
71   update per_all_positions
72   set
73   position_id                       = p_rec.position_id,
74   successor_position_id             = p_rec.successor_position_id,
75   relief_position_id                = p_rec.relief_position_id,
76   location_id                       = p_rec.location_id,
77   position_definition_id            = p_rec.position_definition_id,
78   date_effective                    = p_rec.date_effective,
79   comments                          = p_rec.comments,
80   date_end                          = p_rec.date_end,
81   frequency                         = p_rec.frequency,
82   name                              = p_rec.name,
83   probation_period                  = p_rec.probation_period,
84   probation_period_units            = p_rec.probation_period_units,
85   replacement_required_flag         = p_rec.replacement_required_flag,
86   time_normal_finish                = p_rec.time_normal_finish,
87   time_normal_start                 = p_rec.time_normal_start,
88   status                            = p_rec.status,
89   working_hours                     = p_rec.working_hours,
90   request_id                        = p_rec.request_id,
91   program_application_id            = p_rec.program_application_id,
92   program_id                        = p_rec.program_id,
93   program_update_date               = p_rec.program_update_date,
94   attribute_category                = p_rec.attribute_category,
95   attribute1                        = p_rec.attribute1,
96   attribute2                        = p_rec.attribute2,
97   attribute3                        = p_rec.attribute3,
98   attribute4                        = p_rec.attribute4,
99   attribute5                        = p_rec.attribute5,
100   attribute6                        = p_rec.attribute6,
101   attribute7                        = p_rec.attribute7,
102   attribute8                        = p_rec.attribute8,
103   attribute9                        = p_rec.attribute9,
104   attribute10                       = p_rec.attribute10,
105   attribute11                       = p_rec.attribute11,
106   attribute12                       = p_rec.attribute12,
107   attribute13                       = p_rec.attribute13,
108   attribute14                       = p_rec.attribute14,
109   attribute15                       = p_rec.attribute15,
110   attribute16                       = p_rec.attribute16,
111   attribute17                       = p_rec.attribute17,
112   attribute18                       = p_rec.attribute18,
113   attribute19                       = p_rec.attribute19,
114   attribute20                       = p_rec.attribute20,
115   object_version_number             = p_rec.object_version_number
116   where position_id = p_rec.position_id;
117   --
118   per_pos_shd.g_api_dml := false;   -- Unset the api dml status
119   --
120   hr_utility.set_location(' Leaving:'||l_proc, 10);
121 --
122 Exception
123   When hr_api.check_integrity_violated Then
124     -- A check constraint has been violated
125     per_pos_shd.g_api_dml := false;   -- Unset the api dml status
126     per_pos_shd.constraint_error
127       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
128   When hr_api.parent_integrity_violated Then
129     -- Parent integrity has been violated
130     per_pos_shd.g_api_dml := false;   -- Unset the api dml status
131     per_pos_shd.constraint_error
132       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
133   When hr_api.unique_integrity_violated Then
134     -- Unique integrity has been violated
135     per_pos_shd.g_api_dml := false;   -- Unset the api dml status
136     per_pos_shd.constraint_error
137       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
138   When Others Then
139     per_pos_shd.g_api_dml := false;   -- Unset the api dml status
140     Raise;
141 End update_dml;
142 --
143 -- ----------------------------------------------------------------------------
144 -- |------------------------------< pre_update >------------------------------|
145 -- ----------------------------------------------------------------------------
146 -- {Start Of Comments}
147 --
148 -- Description:
149 --   This private procedure contains any processing which is required before
150 --   the update dml.
151 --
152 -- Pre Conditions:
153 --   This is an internal procedure which is called from the upd procedure.
154 --
155 -- In Arguments:
156 --   A Pl/Sql record structre.
157 --
158 -- Post Success:
159 --   Processing continues.
160 --
161 -- Post Failure:
162 --   If an error has occurred, an error message and exception will be raised
163 --   but not handled.
164 --
165 -- Developer Implementation Notes:
166 --   Any pre-processing required before the update dml is issued should be
167 --   coded within this procedure. It is important to note that any 3rd party
168 --   maintenance should be reviewed before placing in this procedure.
169 --
170 -- Access Status:
171 --   Internal Table Handler Use Only.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure pre_update(p_rec in per_pos_shd.g_rec_type) is
176 --
177   l_proc  varchar2(72) := g_package||'pre_update';
178 --
179 Begin
180   hr_utility.set_location('Entering:'||l_proc, 5);
181   --
182   hr_utility.set_location(' Leaving:'||l_proc, 10);
183 End pre_update;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |-----------------------------< post_update >------------------------------|
187 -- ----------------------------------------------------------------------------
188 -- {Start Of Comments}
189 --
190 -- Description:
191 --   This private procedure contains any processing which is required after the
192 --   update dml.
193 --
194 -- Pre Conditions:
195 --   This is an internal procedure which is called from the upd procedure.
196 --
197 -- In Arguments:
198 --   A Pl/Sql record structre.
199 --
200 -- Post Success:
201 --   Processing continues.
202 --
203 -- Post Failure:
204 --   If an error has occurred, an error message and exception will be raised
205 --   but not handled.
206 --
207 -- Developer Implementation Notes:
208 --   Any post-processing required after the update dml is issued should be
209 --   coded within this procedure. It is important to note that any 3rd party
210 --   maintenance should be reviewed before placing in this procedure.
211 --
212 -- Access Status:
213 --   Internal Table Handler Use Only.
214 --
215 -- {End Of Comments}
216 -- ----------------------------------------------------------------------------
217 Procedure post_update(p_rec in per_pos_shd.g_rec_type) is
218 --
219   l_proc  varchar2(72) := g_package||'post_update';
220 --
221 Begin
222   hr_utility.set_location('Entering:'||l_proc, 5);
223   --
224   -- Start of API User Hook for post_update.
225   begin
226     per_pos_rku.after_update
227       (p_position_id                  => p_rec.position_id
228       ,p_successor_position_id        => p_rec.successor_position_id
229       ,p_relief_position_id           => p_rec.relief_position_id
230       ,p_location_id                  => p_rec.location_id
231       ,p_position_definition_id       => p_rec.position_definition_id
232       ,p_date_effective               => p_rec.date_effective
233       ,p_comments                     => p_rec.comments
234       ,p_date_end                     => p_rec.date_end
235       ,p_frequency                    => p_rec.frequency
236       ,p_name                         => p_rec.name
237       ,p_probation_period             => p_rec.probation_period
238       ,p_probation_period_units       => p_rec.probation_period_units
239       ,p_replacement_required_flag    => p_rec.replacement_required_flag
240       ,p_time_normal_finish           => p_rec.time_normal_finish
241       ,p_time_normal_start            => p_rec.time_normal_start
242       ,p_status                       => p_rec.status
243       ,p_working_hours                => p_rec.working_hours
244       ,p_request_id                   => p_rec.request_id
245       ,p_program_application_id       => p_rec.program_application_id
246       ,p_program_id                   => p_rec.program_id
247       ,p_program_update_date          => p_rec.program_update_date
248       ,p_attribute_category           => p_rec.attribute_category
249       ,p_attribute1                   => p_rec.attribute1
250       ,p_attribute2                   => p_rec.attribute2
251       ,p_attribute3                   => p_rec.attribute3
252       ,p_attribute4                   => p_rec.attribute4
253       ,p_attribute5                   => p_rec.attribute5
254       ,p_attribute6                   => p_rec.attribute6
255       ,p_attribute7                   => p_rec.attribute7
256       ,p_attribute8                   => p_rec.attribute8
257       ,p_attribute9                   => p_rec.attribute9
258       ,p_attribute10                  => p_rec.attribute10
259       ,p_attribute11                  => p_rec.attribute11
260       ,p_attribute12                  => p_rec.attribute12
261       ,p_attribute13                  => p_rec.attribute13
262       ,p_attribute14                  => p_rec.attribute14
263       ,p_attribute15                  => p_rec.attribute15
264       ,p_attribute16                  => p_rec.attribute16
265       ,p_attribute17                  => p_rec.attribute17
266       ,p_attribute18                  => p_rec.attribute18
267       ,p_attribute19                  => p_rec.attribute19
268       ,p_attribute20                  => p_rec.attribute20
269       ,p_object_version_number        => p_rec.object_version_number
270       ,p_business_group_id_o
271           => per_pos_shd.g_old_rec.business_group_id
272       ,p_job_id_o
273           => per_pos_shd.g_old_rec.job_id
274       ,p_organization_id_o
275           => per_pos_shd.g_old_rec.organization_id
276       ,p_successor_position_id_o
277           => per_pos_shd.g_old_rec.successor_position_id
278       ,p_relief_position_id_o
279           => per_pos_shd.g_old_rec.relief_position_id
280       ,p_location_id_o
281           => per_pos_shd.g_old_rec.location_id
282       ,p_position_definition_id_o
283           => per_pos_shd.g_old_rec.position_definition_id
284       ,p_date_effective_o
285           => per_pos_shd.g_old_rec.date_effective
286       ,p_comments_o
287           => per_pos_shd.g_old_rec.comments
288       ,p_date_end_o
289           => per_pos_shd.g_old_rec.date_end
290       ,p_frequency_o
291           => per_pos_shd.g_old_rec.frequency
292       ,p_name_o
293           => per_pos_shd.g_old_rec.name
294       ,p_probation_period_o
295           => per_pos_shd.g_old_rec.probation_period
296       ,p_probation_period_units_o
297           => per_pos_shd.g_old_rec.probation_period_units
298       ,p_replacement_required_flag_o
299           => per_pos_shd.g_old_rec.replacement_required_flag
300       ,p_time_normal_finish_o
301           => per_pos_shd.g_old_rec.time_normal_finish
302       ,p_time_normal_start_o
303           => per_pos_shd.g_old_rec.time_normal_start
304       ,p_status_o
305           => per_pos_shd.g_old_rec.status
306       ,p_working_hours_o
307           => per_pos_shd.g_old_rec.working_hours
308       ,p_request_id_o
309           => per_pos_shd.g_old_rec.request_id
310       ,p_program_application_id_o
311           => per_pos_shd.g_old_rec.program_application_id
312       ,p_program_id_o
313           => per_pos_shd.g_old_rec.program_id
314       ,p_program_update_date_o
315           => per_pos_shd.g_old_rec.program_update_date
316       ,p_attribute_category_o
317           => per_pos_shd.g_old_rec.attribute_category
318       ,p_attribute1_o
319           => per_pos_shd.g_old_rec.attribute1
320       ,p_attribute2_o
321           => per_pos_shd.g_old_rec.attribute2
322       ,p_attribute3_o
323           => per_pos_shd.g_old_rec.attribute3
324       ,p_attribute4_o
325           => per_pos_shd.g_old_rec.attribute4
326       ,p_attribute5_o
327           => per_pos_shd.g_old_rec.attribute5
328       ,p_attribute6_o
329           => per_pos_shd.g_old_rec.attribute6
330       ,p_attribute7_o
331           => per_pos_shd.g_old_rec.attribute7
332       ,p_attribute8_o
333           => per_pos_shd.g_old_rec.attribute8
334       ,p_attribute9_o
335           => per_pos_shd.g_old_rec.attribute9
336       ,p_attribute10_o
337           => per_pos_shd.g_old_rec.attribute10
338       ,p_attribute11_o
339           => per_pos_shd.g_old_rec.attribute11
340       ,p_attribute12_o
341           => per_pos_shd.g_old_rec.attribute12
342       ,p_attribute13_o
343           => per_pos_shd.g_old_rec.attribute13
344       ,p_attribute14_o
345           => per_pos_shd.g_old_rec.attribute14
346       ,p_attribute15_o
347           => per_pos_shd.g_old_rec.attribute15
348       ,p_attribute16_o
349           => per_pos_shd.g_old_rec.attribute16
350       ,p_attribute17_o
351           => per_pos_shd.g_old_rec.attribute17
352       ,p_attribute18_o
353           => per_pos_shd.g_old_rec.attribute18
354       ,p_attribute19_o
355           => per_pos_shd.g_old_rec.attribute19
356       ,p_attribute20_o
357           => per_pos_shd.g_old_rec.attribute20
358       ,p_object_version_number_o
359           => per_pos_shd.g_old_rec.object_version_number
360       );
361   exception
362     when hr_api.cannot_find_prog_unit then
363       hr_api.cannot_find_prog_unit_error
364         (p_module_name => 'PER_POSITIONS'
365         ,p_hook_type   => 'AU'
366         );
367   end;
368   -- End of API User Hook for post_update.
369   --
370   hr_utility.set_location(' Leaving:'||l_proc, 10);
371 End post_update;
372 --
373 -- ----------------------------------------------------------------------------
374 -- |-----------------------------< convert_defs >-----------------------------|
375 -- ----------------------------------------------------------------------------
376 -- {Start Of Comments}
377 --
378 -- Description:
379 --   The Convert_Defs procedure has one very important function:
380 --   It must return the record structure for the row with all system defaulted
381 --   values converted into its corresponding argument value for update. When
382 --   we attempt to update a row through the Upd business process , certain
383 --   arguments can be defaulted which enables flexibility in the calling of
384 --   the upd process (e.g. only attributes which need to be updated need to be
385 --   specified). For the upd business process to determine which attributes
386 --   have NOT been specified we need to check if the argument has a reserved
387 --   system default value. Therefore, for all attributes which have a
388 --   corresponding reserved system default mechanism specified we need to
389 --   check if a system default is being used. If a system default is being
390 --   used then we convert the defaulted value into its corresponding attribute
391 --   value held in the g_old_rec data structure.
392 --
393 -- Pre Conditions:
394 --   This private function can only be called from the upd process.
395 --
396 -- In Arguments:
397 --   A Pl/Sql record structre.
398 --
399 -- Post Success:
400 --   The record structure will be returned with all system defaulted argument
401 --   values converted into its current row attribute value.
402 --
403 -- Post Failure:
404 --   No direct error handling is required within this function. Any possible
405 --   errors within this procedure will be a PL/SQL value error due to conversion
406 
407 --   of datatypes or data lengths.
408 --
409 -- Developer Implementation Notes:
410 --   None.
411 --
412 -- Access Status:
413 --   Internal Table Handler Use Only.
414 --
415 -- {End Of Comments}
416 -- ----------------------------------------------------------------------------
417 Procedure convert_defs(p_rec in out nocopy per_pos_shd.g_rec_type) is
418 --
419   l_proc  varchar2(72) := g_package||'convert_defs';
420 --
421 Begin
422   --
423   hr_utility.set_location('Entering:'||l_proc, 5);
424   --
425   -- We must now examine each argument value in the
426   -- p_rec plsql record structure
427   -- to see if a system default is being used. If a system default
428   -- is being used then we must set to the 'current' argument value.
429   --
430   If (p_rec.business_group_id = hr_api.g_number) then
431     p_rec.business_group_id :=
432     per_pos_shd.g_old_rec.business_group_id;
433   End If;
434   If (p_rec.job_id = hr_api.g_number) then
435     p_rec.job_id :=
436     per_pos_shd.g_old_rec.job_id;
437   End If;
438   If (p_rec.organization_id = hr_api.g_number) then
439     p_rec.organization_id :=
440     per_pos_shd.g_old_rec.organization_id;
441   End If;
442   If (p_rec.successor_position_id = hr_api.g_number) then
443     p_rec.successor_position_id :=
444     per_pos_shd.g_old_rec.successor_position_id;
445   End If;
446   If (p_rec.relief_position_id = hr_api.g_number) then
447     p_rec.relief_position_id :=
448     per_pos_shd.g_old_rec.relief_position_id;
449   End If;
450   If (p_rec.location_id = hr_api.g_number) then
451     p_rec.location_id :=
452     per_pos_shd.g_old_rec.location_id;
453   End If;
454   If (p_rec.position_definition_id = hr_api.g_number) then
455     p_rec.position_definition_id :=
456     per_pos_shd.g_old_rec.position_definition_id;
457   End If;
458   If (p_rec.date_effective = hr_api.g_date) then
459     p_rec.date_effective :=
460     per_pos_shd.g_old_rec.date_effective;
461   End If;
462   If (p_rec.comments = hr_api.g_varchar2) then
463     p_rec.comments :=
464     per_pos_shd.g_old_rec.comments;
465   End If;
466   If (p_rec.date_end = hr_api.g_date) then
467     p_rec.date_end :=
468     per_pos_shd.g_old_rec.date_end;
469   End If;
470   If (p_rec.frequency = hr_api.g_varchar2) then
471     p_rec.frequency :=
472     per_pos_shd.g_old_rec.frequency;
473   End If;
474   If (p_rec.name = hr_api.g_varchar2) then
475     p_rec.name :=
476     per_pos_shd.g_old_rec.name;
477   End If;
478   If (p_rec.probation_period = hr_api.g_number) then
479     p_rec.probation_period :=
480     per_pos_shd.g_old_rec.probation_period;
481   End If;
482   If (p_rec.probation_period_units = hr_api.g_varchar2) then
483     p_rec.probation_period_units :=
484     per_pos_shd.g_old_rec.probation_period_units;
485   End If;
486   If (p_rec.replacement_required_flag = hr_api.g_varchar2) then
487     p_rec.replacement_required_flag :=
488     per_pos_shd.g_old_rec.replacement_required_flag;
489   End If;
490   If (p_rec.time_normal_finish = hr_api.g_varchar2) then
491     p_rec.time_normal_finish :=
492     per_pos_shd.g_old_rec.time_normal_finish;
493   End If;
494   If (p_rec.time_normal_start = hr_api.g_varchar2) then
495     p_rec.time_normal_start :=
496     per_pos_shd.g_old_rec.time_normal_start;
497   End If;
498   If (p_rec.status = hr_api.g_varchar2) then
499     p_rec.status :=
500     per_pos_shd.g_old_rec.status;
501   End If;
502   If (p_rec.working_hours = hr_api.g_number) then
503     p_rec.working_hours :=
504     per_pos_shd.g_old_rec.working_hours;
505   End If;
506   If (p_rec.request_id = hr_api.g_number) then
507     p_rec.request_id :=
508     per_pos_shd.g_old_rec.request_id;
509   End If;
510   If (p_rec.program_application_id = hr_api.g_number) then
511     p_rec.program_application_id :=
512     per_pos_shd.g_old_rec.program_application_id;
513   End If;
514   If (p_rec.program_id = hr_api.g_number) then
515     p_rec.program_id :=
516     per_pos_shd.g_old_rec.program_id;
517   End If;
518   If (p_rec.program_update_date = hr_api.g_date) then
519     p_rec.program_update_date :=
520     per_pos_shd.g_old_rec.program_update_date;
521   End If;
522   If (p_rec.attribute_category = hr_api.g_varchar2) then
523     p_rec.attribute_category :=
524     per_pos_shd.g_old_rec.attribute_category;
525   End If;
526   If (p_rec.attribute1 = hr_api.g_varchar2) then
527     p_rec.attribute1 :=
528     per_pos_shd.g_old_rec.attribute1;
529   End If;
530   If (p_rec.attribute2 = hr_api.g_varchar2) then
531     p_rec.attribute2 :=
532     per_pos_shd.g_old_rec.attribute2;
533   End If;
534   If (p_rec.attribute3 = hr_api.g_varchar2) then
535     p_rec.attribute3 :=
536     per_pos_shd.g_old_rec.attribute3;
537   End If;
538   If (p_rec.attribute4 = hr_api.g_varchar2) then
539     p_rec.attribute4 :=
540     per_pos_shd.g_old_rec.attribute4;
541   End If;
542   If (p_rec.attribute5 = hr_api.g_varchar2) then
543     p_rec.attribute5 :=
544     per_pos_shd.g_old_rec.attribute5;
545   End If;
546   If (p_rec.attribute6 = hr_api.g_varchar2) then
547     p_rec.attribute6 :=
548     per_pos_shd.g_old_rec.attribute6;
549   End If;
550   If (p_rec.attribute7 = hr_api.g_varchar2) then
551     p_rec.attribute7 :=
552     per_pos_shd.g_old_rec.attribute7;
553   End If;
554   If (p_rec.attribute8 = hr_api.g_varchar2) then
555     p_rec.attribute8 :=
556     per_pos_shd.g_old_rec.attribute8;
557   End If;
558   If (p_rec.attribute9 = hr_api.g_varchar2) then
559     p_rec.attribute9 :=
560     per_pos_shd.g_old_rec.attribute9;
561   End If;
562   If (p_rec.attribute10 = hr_api.g_varchar2) then
563     p_rec.attribute10 :=
564     per_pos_shd.g_old_rec.attribute10;
565   End If;
566   If (p_rec.attribute11 = hr_api.g_varchar2) then
567     p_rec.attribute11 :=
568     per_pos_shd.g_old_rec.attribute11;
569   End If;
570   If (p_rec.attribute12 = hr_api.g_varchar2) then
571     p_rec.attribute12 :=
572     per_pos_shd.g_old_rec.attribute12;
573   End If;
574   If (p_rec.attribute13 = hr_api.g_varchar2) then
575     p_rec.attribute13 :=
576     per_pos_shd.g_old_rec.attribute13;
577   End If;
578   If (p_rec.attribute14 = hr_api.g_varchar2) then
579     p_rec.attribute14 :=
580     per_pos_shd.g_old_rec.attribute14;
581   End If;
582   If (p_rec.attribute15 = hr_api.g_varchar2) then
583     p_rec.attribute15 :=
584     per_pos_shd.g_old_rec.attribute15;
585   End If;
586   If (p_rec.attribute16 = hr_api.g_varchar2) then
587     p_rec.attribute16 :=
588     per_pos_shd.g_old_rec.attribute16;
589   End If;
590   If (p_rec.attribute17 = hr_api.g_varchar2) then
591     p_rec.attribute17 :=
592     per_pos_shd.g_old_rec.attribute17;
593   End If;
594   If (p_rec.attribute18 = hr_api.g_varchar2) then
595     p_rec.attribute18 :=
596     per_pos_shd.g_old_rec.attribute18;
597   End If;
598   If (p_rec.attribute19 = hr_api.g_varchar2) then
599     p_rec.attribute19 :=
600     per_pos_shd.g_old_rec.attribute19;
601   End If;
602   If (p_rec.attribute20 = hr_api.g_varchar2) then
603     p_rec.attribute20 :=
604     per_pos_shd.g_old_rec.attribute20;
605   End If;
606   --
607   hr_utility.set_location(' Leaving:'||l_proc, 10);
608 --
609 End convert_defs;
610 --
611 -- ----------------------------------------------------------------------------
612 -- |---------------------------------< upd >----------------------------------|
613 -- ----------------------------------------------------------------------------
614 Procedure upd
615   (
616   p_rec        in out nocopy per_pos_shd.g_rec_type,
617   p_validate   in     boolean default false
618   ) is
619 --
620   l_proc  varchar2(72) := g_package||'upd';
621 --
622 Begin
623   hr_utility.set_location('Entering:'||l_proc, 5);
624   --
625   -- Determine if the business process is to be validated.
626   --
627   If p_validate then
628     --
629     -- Issue the savepoint.
630     --
631     SAVEPOINT upd_per_pos;
632   End If;
633   --
634   -- We must lock the row which we need to update.
635   --
636   --
637   per_pos_shd.lck
638 	(
639 	p_rec.position_id,
640 	p_rec.object_version_number
641 	);
642   --
643   -- 1. During an update system defaults are used to determine if
644   --    arguments have been defaulted or not. We must therefore
645   --    derive the full record structure values to be updated.
646   --
647   -- 2. Call the supporting update validate operations.
648   --
649   convert_defs(p_rec);
650   per_pos_bus.update_validate(p_rec);
651   --
652   -- Call the supporting pre-update operation
653   --
654   pre_update(p_rec);
655   --
656   -- Update the row.
657   --
658   update_dml(p_rec);
659   --
660   -- Call the supporting post-update operation
661   --
662   post_update(p_rec);
663   --
664   -- If we are validating then raise the Validate_Enabled exception
665   --
666   If p_validate then
667     Raise HR_Api.Validate_Enabled;
668   End If;
669   --
670   hr_utility.set_location(' Leaving:'||l_proc, 10);
671 Exception
672   When HR_Api.Validate_Enabled Then
673     --
674     -- As the Validate_Enabled exception has been raised
675     -- we must rollback to the savepoint
676     --
677     ROLLBACK TO upd_per_pos;
678 End upd;
679 --
680 -- ----------------------------------------------------------------------------
681 -- |---------------------------------< upd >----------------------------------|
682 -- ----------------------------------------------------------------------------
683 Procedure upd
684   (
685   p_position_id                  in number,
686   p_successor_position_id        in number           default hr_api.g_number,
687   p_relief_position_id           in number           default hr_api.g_number,
688   p_location_id                  in number           default hr_api.g_number,
689   p_position_definition_id       in number           default hr_api.g_number,
690   p_date_effective               in date             default hr_api.g_date,
691   p_comments                     in varchar2         default hr_api.g_varchar2,
692   p_date_end                     in date             default hr_api.g_date,
693   p_frequency                    in varchar2         default hr_api.g_varchar2,
694   p_name                         in varchar2         default hr_api.g_varchar2,
695   p_probation_period             in number           default hr_api.g_number,
696   p_probation_period_units       in varchar2         default hr_api.g_varchar2,
697   p_replacement_required_flag    in varchar2         default hr_api.g_varchar2,
698   p_time_normal_finish           in varchar2         default hr_api.g_varchar2,
699   p_time_normal_start            in varchar2         default hr_api.g_varchar2,
700   p_status                       in varchar2         default hr_api.g_varchar2,
701   p_working_hours                in number           default hr_api.g_number,
702   p_request_id                   in number           default hr_api.g_number,
703   p_program_application_id       in number           default hr_api.g_number,
704   p_program_id                   in number           default hr_api.g_number,
705   p_program_update_date          in date             default hr_api.g_date,
706   p_attribute_category           in varchar2         default hr_api.g_varchar2,
707   p_attribute1                   in varchar2         default hr_api.g_varchar2,
708   p_attribute2                   in varchar2         default hr_api.g_varchar2,
709   p_attribute3                   in varchar2         default hr_api.g_varchar2,
710   p_attribute4                   in varchar2         default hr_api.g_varchar2,
711   p_attribute5                   in varchar2         default hr_api.g_varchar2,
712   p_attribute6                   in varchar2         default hr_api.g_varchar2,
713   p_attribute7                   in varchar2         default hr_api.g_varchar2,
714   p_attribute8                   in varchar2         default hr_api.g_varchar2,
715   p_attribute9                   in varchar2         default hr_api.g_varchar2,
716   p_attribute10                  in varchar2         default hr_api.g_varchar2,
717   p_attribute11                  in varchar2         default hr_api.g_varchar2,
718   p_attribute12                  in varchar2         default hr_api.g_varchar2,
719   p_attribute13                  in varchar2         default hr_api.g_varchar2,
720   p_attribute14                  in varchar2         default hr_api.g_varchar2,
721   p_attribute15                  in varchar2         default hr_api.g_varchar2,
722   p_attribute16                  in varchar2         default hr_api.g_varchar2,
723   p_attribute17                  in varchar2         default hr_api.g_varchar2,
724   p_attribute18                  in varchar2         default hr_api.g_varchar2,
725   p_attribute19                  in varchar2         default hr_api.g_varchar2,
726   p_attribute20                  in varchar2         default hr_api.g_varchar2,
727   p_object_version_number        in out nocopy number,
728   p_validate                     in boolean          default false
729   ) is
730 --
731   l_rec	  per_pos_shd.g_rec_type;
732   l_proc  varchar2(72) := g_package||'upd';
733 --
734 Begin
735   hr_utility.set_location('Entering:'||l_proc, 5);
736   --
737   -- Call conversion function to turn arguments into the
738   -- l_rec structure.
739   --
740   l_rec :=
741   per_pos_shd.convert_args
742   (
743   p_position_id,
744   hr_api.g_number,
745   hr_api.g_number,
746   hr_api.g_number,
747   p_successor_position_id,
748   p_relief_position_id,
749   p_location_id,
750   p_position_definition_id,
751   p_date_effective,
752   p_comments,
753   p_date_end,
754   p_frequency,
755   p_name,
756   p_probation_period,
757   p_probation_period_units,
758   p_replacement_required_flag,
759   p_time_normal_finish,
760   p_time_normal_start,
761   p_status,
762   p_working_hours,
763   p_request_id,
764   p_program_application_id,
765   p_program_id,
766   p_program_update_date,
767   p_attribute_category,
768   p_attribute1,
769   p_attribute2,
770   p_attribute3,
771   p_attribute4,
772   p_attribute5,
773   p_attribute6,
774   p_attribute7,
775   p_attribute8,
776   p_attribute9,
777   p_attribute10,
778   p_attribute11,
779   p_attribute12,
780   p_attribute13,
781   p_attribute14,
782   p_attribute15,
783   p_attribute16,
784   p_attribute17,
785   p_attribute18,
786   p_attribute19,
787   p_attribute20,
788   p_object_version_number
789   );
790   --
791   -- Having converted the arguments into the
792   -- plsql record structure we call the corresponding record
793   -- business process.
794   --
795   upd(l_rec, p_validate);
796   p_object_version_number := l_rec.object_version_number;
797   --
798   hr_utility.set_location(' Leaving:'||l_proc, 10);
799 End upd;
800 --
801 end per_pos_upd;