DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PTU_UPD

Source


1 Package Body per_ptu_upd as
2 /* $Header: pepturhi.pkb 120.0 2005/05/31 15:57:51 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ptu_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the execution of dml from the datetrack mode
17 --   of CORRECTION only. It is important to note that the object version
18 --   number is only increment by 1 because the datetrack correction is
19 --   soley for one datetracked row.
20 --   This procedure controls the actual dml update logic. The functions of this
21 --   procedure are as follows:
22 --   1) Get the next object_version_number.
23 --   2) To update the specified row in the schema using the primary key in
24 --      the predicates.
25 --   3) To trap any constraint violations that may have occurred.
26 --   4) To raise any other errors.
27 --
28 -- Prerequisites:
29 --   This is an internal private procedure which must be called from the
30 --   update_dml procedure.
31 --
32 -- In Parameters:
33 --   A Pl/Sql record structre.
34 --
35 -- Post Success:
36 --   The specified row will be updated in the schema.
37 --
38 -- Post Failure:
39 --   If a check or unique integrity constraint violation is raised the
40 --   constraint_error procedure will be called.
41 --
42 -- Developer Implementation Notes:
43 --   The update 'set' arguments list should be modified if any of your
44 --   attributes are not updateable.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure dt_update_dml
52    (p_rec          in out nocopy per_ptu_shd.g_rec_type,
53     p_effective_date  in   date,
54     p_datetrack_mode  in   varchar2,
55     p_validation_start_date in   date,
56     p_validation_end_date   in   date) is
57 --
58   l_proc varchar2(72) := g_package||'dt_update_dml';
59 --
60 Begin
61   hr_utility.set_location('Entering:'||l_proc, 5);
62   --
63   If (p_datetrack_mode = 'CORRECTION') then
64     hr_utility.set_location(l_proc, 10);
65     --
66     -- Because we are updating a row we must get the next object
67     -- version number.
68     --
69     p_rec.object_version_number :=
70       dt_api.get_object_version_number
71      (p_base_table_name => 'per_person_type_usages_f',
72       p_base_key_column => 'person_type_usage_id',
73       p_base_key_value  => p_rec.person_type_usage_id);
74     --
75     --
76     -- Update the per_person_type_usages_f Row
77     --
78     update  per_person_type_usages_f
79     set
80         person_type_usage_id            = p_rec.person_type_usage_id,
81     person_id                       = p_rec.person_id,
82     person_type_id                  = p_rec.person_type_id,
83     object_version_number           = p_rec.object_version_number,
84     request_id                      = p_rec.request_id,
85     program_application_id          = p_rec.program_application_id,
86     program_id                      = p_rec.program_id,
87     program_update_date             = p_rec.program_update_date,
88     attribute_category              = p_rec.attribute_category,
89     attribute1                      = p_rec.attribute1,
90     attribute2                      = p_rec.attribute2,
91     attribute3                      = p_rec.attribute3,
92     attribute4                      = p_rec.attribute4,
93     attribute5                      = p_rec.attribute5,
94     attribute6                      = p_rec.attribute6,
95     attribute7                      = p_rec.attribute7,
96     attribute8                      = p_rec.attribute8,
97     attribute9                      = p_rec.attribute9,
98     attribute10                     = p_rec.attribute10,
99     attribute11                     = p_rec.attribute11,
100     attribute12                     = p_rec.attribute12,
101     attribute13                     = p_rec.attribute13,
102     attribute14                     = p_rec.attribute14,
103     attribute15                     = p_rec.attribute15,
104     attribute16                     = p_rec.attribute16,
105     attribute17                     = p_rec.attribute17,
106     attribute18                     = p_rec.attribute18,
107     attribute19                     = p_rec.attribute19,
108     attribute20                     = p_rec.attribute20,
109     attribute21                     = p_rec.attribute21,
110     attribute22                     = p_rec.attribute22,
111     attribute23                     = p_rec.attribute23,
112     attribute24                     = p_rec.attribute24,
113     attribute25                     = p_rec.attribute25,
114     attribute26                     = p_rec.attribute26,
115     attribute27                     = p_rec.attribute27,
116     attribute28                     = p_rec.attribute28,
117     attribute29                     = p_rec.attribute29,
118     attribute30                     = p_rec.attribute30
119     where   person_type_usage_id = p_rec.person_type_usage_id
120     and     effective_start_date = p_validation_start_date
121     and     effective_end_date   = p_validation_end_date;
122     --
123     --
124     -- Set the effective start and end dates
125     --
126     p_rec.effective_start_date := p_validation_start_date;
127     p_rec.effective_end_date   := p_validation_end_date;
128   End If;
129 --
130 hr_utility.set_location(' Leaving:'||l_proc, 15);
131 Exception
132   When hr_api.check_integrity_violated Then
133     -- A check constraint has been violated
134     per_ptu_shd.constraint_error
135       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
136   When hr_api.unique_integrity_violated Then
137     -- Unique integrity has been violated
138     per_ptu_shd.constraint_error
139       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
140   When Others Then
141     Raise;
142 End dt_update_dml;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |------------------------------< update_dml >------------------------------|
146 -- ----------------------------------------------------------------------------
147 -- {Start Of Comments}
148 --
149 -- Description:
150 --   This procedure calls the dt_update_dml control logic which handles
151 --   the actual datetrack dml.
152 --
153 -- Prerequisites:
154 --   This is an internal private procedure which must be called from the upd
155 --   procedure.
156 --
157 -- In Parameters:
158 --   A Pl/Sql record structre.
159 --
160 -- Post Success:
161 --   Processing contines.
162 --
163 -- Post Failure:
164 --   No specific error handling is required within this procedure.
165 --
166 -- Developer Implementation Notes:
167 --   The update 'set' arguments list should be modified if any of your
168 --   attributes are not updateable.
169 --
170 -- Access Status:
171 --   Internal Row Handler Use Only.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure update_dml
176    (p_rec          in out nocopy per_ptu_shd.g_rec_type,
177     p_effective_date  in   date,
178     p_datetrack_mode  in   varchar2,
179     p_validation_start_date in   date,
180     p_validation_end_date   in   date) is
181 --
182   l_proc varchar2(72) := g_package||'update_dml';
183 --
184 Begin
185   hr_utility.set_location('Entering:'||l_proc, 5);
186   --
187   dt_update_dml(p_rec         => p_rec,
188       p_effective_date  => p_effective_date,
189       p_datetrack_mode  => p_datetrack_mode,
190             p_validation_start_date => p_validation_start_date,
191       p_validation_end_date   => p_validation_end_date);
192   --
193   hr_utility.set_location(' Leaving:'||l_proc, 10);
194 End update_dml;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |----------------------------< dt_pre_update >-----------------------------|
198 -- ----------------------------------------------------------------------------
199 -- {Start Of Comments}
200 --
201 -- Description:
202 --   The dt_pre_update procedure controls the execution
203 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
204 --   and UPDATE_CHANGE_INSERT only. The execution required is as
205 --   follows:
206 --
207 --   1) Providing the datetrack update mode is not 'CORRECTION'
208 --      then set the effective end date of the current row (this
209 --      will be the validation_start_date - 1).
210 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
211 --      corresponding delete_dml process to delete any future rows
212 --      where the effective_start_date is greater than or equal to
213 -- the validation_start_date.
214 --   3) Call the insert_dml process to insert the new updated row
215 --      details..
216 --
217 -- Prerequisites:
218 --   This is an internal procedure which is called from the
219 --   pre_update procedure.
220 --
221 -- In Parameters:
222 --
223 -- Post Success:
224 --   Processing continues.
225 --
226 -- Post Failure:
227 --   If an error has occurred, an error message and exception will be raised
228 --   but not handled.
229 --
230 -- Developer Implementation Notes:
231 --   This is an internal procedure which is required by Datetrack. Don't
232 --   remove or modify.
233 --
234 -- Access Status:
235 --   Internal Row Handler Use Only.
236 --
237 -- {End Of Comments}
238 -- ----------------------------------------------------------------------------
239 Procedure dt_pre_update
240    (p_rec          in out nocopy per_ptu_shd.g_rec_type,
241     p_effective_date  in   date,
242     p_datetrack_mode  in   varchar2,
243     p_validation_start_date in   date,
244     p_validation_end_date   in   date) is
245 --
246   l_proc          varchar2(72) := g_package||'dt_pre_update';
247   l_dummy_version_number number;
248 --
249 Begin
250   hr_utility.set_location('Entering:'||l_proc, 5);
251   If (p_datetrack_mode <> 'CORRECTION') then
252     hr_utility.set_location(l_proc, 10);
253     --
254     -- Update the current effective end date
255     --
256     per_ptu_shd.upd_effective_end_date
257      (p_effective_date         => p_effective_date,
258       p_base_key_value         => p_rec.person_type_usage_id,
259       p_new_effective_end_date => (p_validation_start_date - 1),
260       p_validation_start_date  => p_validation_start_date,
261       p_validation_end_date    => p_validation_end_date,
262       p_object_version_number  => l_dummy_version_number);
263     --
264     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
265       hr_utility.set_location(l_proc, 15);
266       --
267       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
268       -- delete any future rows
269       --
270       per_ptu_del.delete_dml
271         (p_rec        => p_rec,
272     p_effective_date  => p_effective_date,
273     p_datetrack_mode  => p_datetrack_mode,
274     p_validation_start_date => p_validation_start_date,
275     p_validation_end_date   => p_validation_end_date);
276     End If;
277     hr_utility.set_location(l_proc, 20);
278     --
279     -- We must now insert the updated row
280     --
281     per_ptu_ins.insert_dml
282       (p_rec         => p_rec,
283        p_effective_date    => p_effective_date,
284        p_datetrack_mode    => p_datetrack_mode,
285        p_validation_start_date   => p_validation_start_date,
286        p_validation_end_date  => p_validation_end_date);
287   End If;
288   hr_utility.set_location(' Leaving:'||l_proc, 20);
289 End dt_pre_update;
290 --
291 -- ----------------------------------------------------------------------------
292 -- |------------------------------< pre_update >------------------------------|
293 -- ----------------------------------------------------------------------------
294 -- {Start Of Comments}
295 --
296 -- Description:
297 --   This private procedure contains any processing which is required before
298 --   the update dml.
299 --
300 -- Prerequisites:
301 --   This is an internal procedure which is called from the upd procedure.
302 --
303 -- In Parameters:
304 --   A Pl/Sql record structre.
305 --
306 -- Post Success:
307 --   Processing continues.
308 --
309 -- Post Failure:
310 --   If an error has occurred, an error message and exception will be raised
311 --   but not handled.
312 --
313 -- Developer Implementation Notes:
314 --   Any pre-processing required before the update dml is issued should be
315 --   coded within this procedure. It is important to note that any 3rd party
316 --   maintenance should be reviewed before placing in this procedure. The call
317 --   to the dt_update_dml procedure should NOT be removed.
318 --
319 -- Access Status:
320 --   Internal Row Handler Use Only.
321 --
322 -- {End Of Comments}
323 -- ----------------------------------------------------------------------------
324 Procedure pre_update
325    (p_rec          in out nocopy per_ptu_shd.g_rec_type,
326     p_effective_date  in   date,
327     p_datetrack_mode  in   varchar2,
328     p_validation_start_date in   date,
329     p_validation_end_date   in   date) is
330 --
331   l_proc varchar2(72) := g_package||'pre_update';
332 --
333 Begin
334   hr_utility.set_location('Entering:'||l_proc, 5);
335   --
336   --
337   --
338   dt_pre_update
339     (p_rec          => p_rec,
340      p_effective_date        => p_effective_date,
341      p_datetrack_mode        => p_datetrack_mode,
342      p_validation_start_date => p_validation_start_date,
343      p_validation_end_date   => p_validation_end_date);
344   --
345   hr_utility.set_location(' Leaving:'||l_proc, 10);
346 End pre_update;
347 --
348 -- ----------------------------------------------------------------------------
349 -- |-----------------------------< post_update >------------------------------|
350 -- ----------------------------------------------------------------------------
351 -- {Start Of Comments}
352 --
353 -- Description:
354 --   This private procedure contains any processing which is required after the
355 --   update dml.
356 --
357 -- Prerequisites:
358 --   This is an internal procedure which is called from the upd procedure.
359 --
360 -- In Parameters:
361 --   A Pl/Sql record structre.
362 --
363 -- Post Success:
364 --   Processing continues.
365 --
366 -- Post Failure:
367 --   If an error has occurred, an error message and exception will be raised
368 --   but not handled.
369 --
370 -- Developer Implementation Notes:
371 --   Any post-processing required after the update dml is issued should be
372 --   coded within this procedure. It is important to note that any 3rd party
373 --   maintenance should be reviewed before placing in this procedure.
374 --
375 -- Access Status:
376 --   Internal Row Handler Use Only.
377 --
378 -- {End Of Comments}
379 -- ----------------------------------------------------------------------------
380 Procedure post_update
381    (p_rec          in per_ptu_shd.g_rec_type,
382     p_effective_date  in date,
383     p_datetrack_mode  in varchar2,
384     p_validation_start_date in date,
385     p_validation_end_date   in date) is
386 --
387   l_proc varchar2(72) := g_package||'post_update';
388   --
389   -- Start of Fix for WWBUG 1408379
390   --
391   l_old ben_ptu_ler.g_ptu_ler_rec;
392   l_new ben_ptu_ler.g_ptu_ler_rec;
393   --
394   -- End of Fix for WWBUG 1408379
395   --
396 --
397 Begin
398   hr_utility.set_location('Entering:'||l_proc, 5);
399   --
400   --
401   -- Start of API User Hook for post_update.
402   begin
403     per_ptu_rku.after_update
404           (
405            p_person_type_usage_id  => p_rec.person_type_usage_id,
406            p_person_type_id        => p_rec.person_type_id,
407            p_effective_start_date  => p_rec.effective_start_date,
408            p_effective_end_date    => p_rec.effective_end_date,
409            p_object_version_number  => p_rec.object_version_number,
410            p_request_id             => p_rec.request_id,
411            p_program_application_id  => p_rec.program_application_id,
412            p_program_id              => p_rec.program_id,
413            p_program_update_date     => p_rec.program_update_date,
414            p_attribute_category      => p_rec.attribute_category
415           ,p_attribute1          => p_rec.attribute1
416      ,p_attribute2          => p_rec.attribute2
417      ,p_attribute3          => p_rec.attribute3
418      ,p_attribute4          => p_rec.attribute4
419      ,p_attribute5          => p_rec.attribute5
420      ,p_attribute6          => p_rec.attribute6
421      ,p_attribute7          => p_rec.attribute7
422      ,p_attribute8          => p_rec.attribute8
423      ,p_attribute9          => p_rec.attribute9
424      ,p_attribute10         => p_rec.attribute10
425      ,p_attribute11         => p_rec.attribute11
426      ,p_attribute12         => p_rec.attribute12
427      ,p_attribute13         => p_rec.attribute13
428      ,p_attribute14         => p_rec.attribute14
429      ,p_attribute15         => p_rec.attribute15
430      ,p_attribute16         => p_rec.attribute16
431      ,p_attribute17         => p_rec.attribute17
432      ,p_attribute18         => p_rec.attribute18
433      ,p_attribute19         => p_rec.attribute19
434      ,p_attribute20         => p_rec.attribute20
435      ,p_attribute21         => p_rec.attribute21
436      ,p_attribute22         => p_rec.attribute22
437      ,p_attribute23         => p_rec.attribute23
438      ,p_attribute24         => p_rec.attribute24
439      ,p_attribute25         => p_rec.attribute25
440      ,p_attribute26         => p_rec.attribute26
441      ,p_attribute27         => p_rec.attribute27
442      ,p_attribute28         => p_rec.attribute28
443      ,p_attribute29         => p_rec.attribute29
444      ,p_attribute30         => p_rec.attribute30
445           ,p_effective_date    => p_effective_date
446           ,p_validation_start_date => p_validation_start_date
447           ,p_validation_end_date   => p_validation_end_date
448           ,p_datetrack_mode        => p_datetrack_mode
449           ,p_person_id_o        => per_ptu_shd.g_old_rec.person_id,
450            p_person_type_id_o    => per_ptu_shd.g_old_rec.person_type_id,
451            p_effective_start_date_o
452                          => per_ptu_shd.g_old_rec.effective_start_date,
453            p_effective_end_date_o => per_ptu_shd.g_old_rec.effective_end_date,
454            p_object_version_number_o
455                          => per_ptu_shd.g_old_rec.object_version_number,
456            p_request_id_o         => per_ptu_shd.g_old_rec.request_id,
457            p_program_application_id_o
458                       => per_ptu_shd.g_old_rec.program_application_id,
459            p_program_id_o     => per_ptu_shd.g_old_rec.program_id,
460            p_program_update_date_o => per_ptu_shd.g_old_rec.program_update_date
461      ,p_attribute_category_o  => per_ptu_shd.g_old_rec.attribute_category
462      ,p_attribute1_o          => per_ptu_shd.g_old_rec.attribute1
463      ,p_attribute2_o          => per_ptu_shd.g_old_rec.attribute2
464      ,p_attribute3_o          => per_ptu_shd.g_old_rec.attribute3
465      ,p_attribute4_o          => per_ptu_shd.g_old_rec.attribute4
466      ,p_attribute5_o          => per_ptu_shd.g_old_rec.attribute5
467      ,p_attribute6_o          => per_ptu_shd.g_old_rec.attribute6
468      ,p_attribute7_o          => per_ptu_shd.g_old_rec.attribute7
469      ,p_attribute8_o          => per_ptu_shd.g_old_rec.attribute8
470      ,p_attribute9_o          => per_ptu_shd.g_old_rec.attribute9
471      ,p_attribute10_o         => per_ptu_shd.g_old_rec.attribute10
472      ,p_attribute11_o         => per_ptu_shd.g_old_rec.attribute11
473      ,p_attribute12_o         => per_ptu_shd.g_old_rec.attribute12
474      ,p_attribute13_o         => per_ptu_shd.g_old_rec.attribute13
475      ,p_attribute14_o         => per_ptu_shd.g_old_rec.attribute14
476      ,p_attribute15_o         => per_ptu_shd.g_old_rec.attribute15
477      ,p_attribute16_o         => per_ptu_shd.g_old_rec.attribute16
478      ,p_attribute17_o         => per_ptu_shd.g_old_rec.attribute17
479      ,p_attribute18_o         => per_ptu_shd.g_old_rec.attribute18
480      ,p_attribute19_o         => per_ptu_shd.g_old_rec.attribute19
481      ,p_attribute20_o         => per_ptu_shd.g_old_rec.attribute20
482      ,p_attribute21_o         => per_ptu_shd.g_old_rec.attribute21
483      ,p_attribute22_o         => per_ptu_shd.g_old_rec.attribute22
484      ,p_attribute23_o         => per_ptu_shd.g_old_rec.attribute23
485      ,p_attribute24_o         => per_ptu_shd.g_old_rec.attribute24
486      ,p_attribute25_o         => per_ptu_shd.g_old_rec.attribute25
487      ,p_attribute26_o         => per_ptu_shd.g_old_rec.attribute26
488      ,p_attribute27_o         => per_ptu_shd.g_old_rec.attribute27
489      ,p_attribute28_o         => per_ptu_shd.g_old_rec.attribute28
490      ,p_attribute29_o         => per_ptu_shd.g_old_rec.attribute29
491      ,p_attribute30_o         => per_ptu_shd.g_old_rec.attribute30
492       );
493   exception
494     when hr_api.cannot_find_prog_unit then
495       hr_api.cannot_find_prog_unit_error
496         (p_module_name => 'PER_PERSON_TYPE_USAGES'
497         ,p_hook_type   => 'AU'
498         );
499   end;
500   --
501   -- Start of Fix for WWBUG 1408379
502   --
503   l_old.person_type_usage_id := per_ptu_shd.g_old_rec.person_type_usage_id;
504   l_old.person_id := per_ptu_shd.g_old_rec.person_id;
505   l_old.person_type_id := per_ptu_shd.g_old_rec.person_type_id;
506   l_old.effective_start_date := per_ptu_shd.g_old_rec.effective_start_date;
507   l_old.effective_end_date := per_ptu_shd.g_old_rec.effective_end_date;
508   l_new.person_type_usage_id := p_rec.person_type_usage_id;
509   l_new.person_id := p_rec.person_id;
510   l_new.person_type_id := p_rec.person_type_id;
511   l_new.effective_start_date := p_rec.effective_start_date;
512   l_new.effective_end_date := p_rec.effective_end_date;
513   --
514   ben_ptu_ler.ler_chk(p_old            => l_old,
515                       p_new            => l_new,
516                       p_effective_date => p_effective_date);
517   --
518   -- End of Fix for WWBUG 1408379
519   --
520   -- End of API User Hook for post_update.
521   --
522   hr_utility.set_location(' Leaving:'||l_proc, 10);
523 End post_update;
524 --
525 -- ----------------------------------------------------------------------------
526 -- |-----------------------------< convert_defs >-----------------------------|
527 -- ----------------------------------------------------------------------------
528 -- {Start Of Comments}
529 --
530 -- Description:
531 --   The Convert_Defs procedure has one very important function:
532 --   It must return the record structure for the row with all system defaulted
533 --   values converted into its corresponding parameter value for update. When
534 --   we attempt to update a row through the Upd process , certain
535 --   parameters can be defaulted which enables flexibility in the calling of
536 --   the upd process (e.g. only attributes which need to be updated need to be
537 --   specified). For the upd process to determine which attributes
538 --   have NOT been specified we need to check if the parameter has a reserved
539 --   system default value. Therefore, for all parameters which have a
540 --   corresponding reserved system default mechanism specified we need to
541 --   check if a system default is being used. If a system default is being
542 --   used then we convert the defaulted value into its corresponding attribute
543 --   value held in the g_old_rec data structure.
544 --
545 -- Prerequisites:
546 --   This private function can only be called from the upd process.
547 --
548 -- In Parameters:
549 --   A Pl/Sql record structre.
550 --
551 -- Post Success:
552 --   The record structure will be returned with all system defaulted parameter
553 --   values converted into its current row attribute value.
554 --
555 -- Post Failure:
556 --   No direct error handling is required within this function. Any possible
557 --   errors within this procedure will be a PL/SQL value error due to conversion
558 --   of datatypes or data lengths.
559 --
560 -- Developer Implementation Notes:
561 --   None.
562 --
563 -- Access Status:
564 --   Internal Row Handler Use Only.
565 --
566 -- {End Of Comments}
567 -- ----------------------------------------------------------------------------
568 Procedure convert_defs(p_rec in out nocopy per_ptu_shd.g_rec_type) is
569 --
570   l_proc  varchar2(72) := g_package||'convert_defs';
571 --
572 Begin
573   --
574   hr_utility.set_location('Entering:'||l_proc, 5);
575   --
576   -- We must now examine each argument value in the
577   -- p_rec plsql record structure
578   -- to see if a system default is being used. If a system default
579   -- is being used then we must set to the 'current' argument value.
580   --
581   If (p_rec.person_id = hr_api.g_number) then
582     p_rec.person_id :=
583     per_ptu_shd.g_old_rec.person_id;
584   End If;
585   If (p_rec.person_type_id = hr_api.g_number) then
586     p_rec.person_type_id :=
587     per_ptu_shd.g_old_rec.person_type_id;
588   End If;
589   If (p_rec.request_id = hr_api.g_number) then
590     p_rec.request_id :=
591     per_ptu_shd.g_old_rec.request_id;
592   End If;
593   If (p_rec.program_application_id = hr_api.g_number) then
594     p_rec.program_application_id :=
595     per_ptu_shd.g_old_rec.program_application_id;
596   End If;
597   If (p_rec.program_id = hr_api.g_number) then
598     p_rec.program_id :=
599     per_ptu_shd.g_old_rec.program_id;
600   End If;
601   If (p_rec.program_update_date = hr_api.g_date) then
602     p_rec.program_update_date :=
603     per_ptu_shd.g_old_rec.program_update_date;
604   End If;
605   If (p_rec.attribute_category = hr_api.g_varchar2) then
606     p_rec.attribute_category :=
607     per_ptu_shd.g_old_rec.attribute_category;
608   End If;
609   If (p_rec.attribute1 = hr_api.g_varchar2) then
610     p_rec.attribute1 :=
611     per_ptu_shd.g_old_rec.attribute1;
612   End If;
613   If (p_rec.attribute2 = hr_api.g_varchar2) then
614     p_rec.attribute2 :=
615     per_ptu_shd.g_old_rec.attribute2;
616   End If;
617   If (p_rec.attribute3 = hr_api.g_varchar2) then
618     p_rec.attribute3 :=
619     per_ptu_shd.g_old_rec.attribute3;
620   End If;
621   If (p_rec.attribute4 = hr_api.g_varchar2) then
622     p_rec.attribute4 :=
623     per_ptu_shd.g_old_rec.attribute4;
624   End If;
625   If (p_rec.attribute5 = hr_api.g_varchar2) then
626     p_rec.attribute5 :=
627     per_ptu_shd.g_old_rec.attribute5;
628   End If;
629   If (p_rec.attribute6 = hr_api.g_varchar2) then
630     p_rec.attribute6 :=
631     per_ptu_shd.g_old_rec.attribute6;
632   End If;
633   If (p_rec.attribute7 = hr_api.g_varchar2) then
634     p_rec.attribute7 :=
635     per_ptu_shd.g_old_rec.attribute7;
636   End If;
637   If (p_rec.attribute8 = hr_api.g_varchar2) then
638     p_rec.attribute8 :=
639     per_ptu_shd.g_old_rec.attribute8;
640   End If;
641   If (p_rec.attribute9 = hr_api.g_varchar2) then
642     p_rec.attribute9 :=
643     per_ptu_shd.g_old_rec.attribute9;
644   End If;
645   If (p_rec.attribute10 = hr_api.g_varchar2) then
646     p_rec.attribute10 :=
647     per_ptu_shd.g_old_rec.attribute10;
648   End If;
649   If (p_rec.attribute11 = hr_api.g_varchar2) then
650     p_rec.attribute11 :=
651     per_ptu_shd.g_old_rec.attribute11;
652   End If;
653   If (p_rec.attribute12 = hr_api.g_varchar2) then
654     p_rec.attribute12 :=
655     per_ptu_shd.g_old_rec.attribute12;
656   End If;
657   If (p_rec.attribute13 = hr_api.g_varchar2) then
658     p_rec.attribute13 :=
659     per_ptu_shd.g_old_rec.attribute13;
660   End If;
661   If (p_rec.attribute14 = hr_api.g_varchar2) then
662     p_rec.attribute14 :=
663     per_ptu_shd.g_old_rec.attribute14;
664   End If;
665   If (p_rec.attribute15 = hr_api.g_varchar2) then
666     p_rec.attribute15 :=
667     per_ptu_shd.g_old_rec.attribute15;
668   End If;
669   If (p_rec.attribute16 = hr_api.g_varchar2) then
670     p_rec.attribute16 :=
671     per_ptu_shd.g_old_rec.attribute16;
672   End If;
673   If (p_rec.attribute17 = hr_api.g_varchar2) then
674     p_rec.attribute17 :=
675     per_ptu_shd.g_old_rec.attribute17;
676   End If;
677   If (p_rec.attribute18 = hr_api.g_varchar2) then
678     p_rec.attribute18 :=
679     per_ptu_shd.g_old_rec.attribute18;
680   End If;
681   If (p_rec.attribute19 = hr_api.g_varchar2) then
682     p_rec.attribute19 :=
683     per_ptu_shd.g_old_rec.attribute19;
684   End If;
685   If (p_rec.attribute20 = hr_api.g_varchar2) then
686     p_rec.attribute20 :=
687     per_ptu_shd.g_old_rec.attribute20;
688   End If;
689   If (p_rec.attribute21 = hr_api.g_varchar2) then
690     p_rec.attribute21 :=
691     per_ptu_shd.g_old_rec.attribute21;
692   End If;
693   If (p_rec.attribute22 = hr_api.g_varchar2) then
694     p_rec.attribute22 :=
695     per_ptu_shd.g_old_rec.attribute22;
696   End If;
697   If (p_rec.attribute23 = hr_api.g_varchar2) then
698     p_rec.attribute23 :=
699     per_ptu_shd.g_old_rec.attribute23;
700   End If;
701   If (p_rec.attribute24 = hr_api.g_varchar2) then
702     p_rec.attribute24 :=
703     per_ptu_shd.g_old_rec.attribute24;
704   End If;
705   If (p_rec.attribute25 = hr_api.g_varchar2) then
706     p_rec.attribute25 :=
707     per_ptu_shd.g_old_rec.attribute25;
708   End If;
709   If (p_rec.attribute26 = hr_api.g_varchar2) then
710     p_rec.attribute26 :=
711     per_ptu_shd.g_old_rec.attribute26;
712   End If;
713   If (p_rec.attribute27 = hr_api.g_varchar2) then
714     p_rec.attribute27 :=
715     per_ptu_shd.g_old_rec.attribute27;
716   End If;
717   If (p_rec.attribute28 = hr_api.g_varchar2) then
718     p_rec.attribute28 :=
719     per_ptu_shd.g_old_rec.attribute28;
720   End If;
721   If (p_rec.attribute29 = hr_api.g_varchar2) then
722     p_rec.attribute29 :=
723     per_ptu_shd.g_old_rec.attribute29;
724   End If;
725   If (p_rec.attribute30 = hr_api.g_varchar2) then
726     p_rec.attribute30 :=
727     per_ptu_shd.g_old_rec.attribute30;
728   End If;
729   --
730   hr_utility.set_location(' Leaving:'||l_proc, 10);
731 --
732 End convert_defs;
733 --
734 -- ----------------------------------------------------------------------------
735 -- |---------------------------------< upd >----------------------------------|
736 -- ----------------------------------------------------------------------------
737 Procedure upd
738   (
739   p_rec        in out nocopy  per_ptu_shd.g_rec_type,
740   p_effective_date   in    date,
741   p_datetrack_mode   in    varchar2
742   ) is
743 --
744   l_proc       varchar2(72) := g_package||'upd';
745   l_validation_start_date  date;
746   l_validation_end_date    date;
747 --
748 Begin
749   hr_utility.set_location('Entering:'||l_proc, 5);
750   --
751   -- Ensure that the DateTrack update mode is valid
752   --
753   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
754   --
755   -- We must lock the row which we need to update.
756   --
757   per_ptu_shd.lck
758    (p_effective_date  => p_effective_date,
759           p_datetrack_mode  => p_datetrack_mode,
760           p_person_type_usage_id  => p_rec.person_type_usage_id,
761           p_object_version_number => p_rec.object_version_number,
762           p_validation_start_date => l_validation_start_date,
763           p_validation_end_date   => l_validation_end_date);
764   --
765   -- 1. During an update system defaults are used to determine if
766   --    arguments have been defaulted or not. We must therefore
767   --    derive the full record structure values to be updated.
768   --
769   -- 2. Call the supporting update validate operations.
770   --
771   convert_defs(p_rec);
772   per_ptu_bus.update_validate
773    (p_rec          => p_rec,
774     p_effective_date  => p_effective_date,
775     p_datetrack_mode     => p_datetrack_mode,
776     p_validation_start_date => l_validation_start_date,
777     p_validation_end_date   => l_validation_end_date);
778   --
779   -- Call the supporting pre-update operation
780   --
781   pre_update
782    (p_rec          => p_rec,
783     p_effective_date  => p_effective_date,
784     p_datetrack_mode  => p_datetrack_mode,
785     p_validation_start_date => l_validation_start_date,
786     p_validation_end_date   => l_validation_end_date);
787   --
788   -- Update the row.
789   --
790   update_dml
791    (p_rec          => p_rec,
792     p_effective_date  => p_effective_date,
793     p_datetrack_mode  => p_datetrack_mode,
794     p_validation_start_date => l_validation_start_date,
795     p_validation_end_date   => l_validation_end_date);
796   --
797   -- Call the supporting post-update operation
798   --
799   post_update
800    (p_rec          => p_rec,
801     p_effective_date  => p_effective_date,
802     p_datetrack_mode  => p_datetrack_mode,
803     p_validation_start_date => l_validation_start_date,
804     p_validation_end_date   => l_validation_end_date);
805 End upd;
806 --
807 -- ----------------------------------------------------------------------------
808 -- |---------------------------------< upd >----------------------------------|
809 -- ----------------------------------------------------------------------------
810 Procedure upd
811   (
812   p_person_type_usage_id         in number,
813   p_person_type_id               in number           default hr_api.g_number,
814   p_effective_start_date         out nocopy date,
815   p_effective_end_date           out nocopy date,
816   p_object_version_number        in out nocopy number,
817   p_request_id                   in number           default hr_api.g_number,
818   p_program_application_id       in number           default hr_api.g_number,
819   p_program_id                   in number           default hr_api.g_number,
820   p_program_update_date          in date             default hr_api.g_date,
821   p_attribute_category           in varchar2         default hr_api.g_varchar2,
822   p_attribute1                   in varchar2         default hr_api.g_varchar2,
823   p_attribute2                   in varchar2         default hr_api.g_varchar2,
824   p_attribute3                   in varchar2         default hr_api.g_varchar2,
825   p_attribute4                   in varchar2         default hr_api.g_varchar2,
826   p_attribute5                   in varchar2         default hr_api.g_varchar2,
827   p_attribute6                   in varchar2         default hr_api.g_varchar2,
828   p_attribute7                   in varchar2         default hr_api.g_varchar2,
829   p_attribute8                   in varchar2         default hr_api.g_varchar2,
830   p_attribute9                   in varchar2         default hr_api.g_varchar2,
831   p_attribute10                  in varchar2         default hr_api.g_varchar2,
832   p_attribute11                  in varchar2         default hr_api.g_varchar2,
833   p_attribute12                  in varchar2         default hr_api.g_varchar2,
834   p_attribute13                  in varchar2         default hr_api.g_varchar2,
835   p_attribute14                  in varchar2         default hr_api.g_varchar2,
836   p_attribute15                  in varchar2         default hr_api.g_varchar2,
837   p_attribute16                  in varchar2         default hr_api.g_varchar2,
838   p_attribute17                  in varchar2         default hr_api.g_varchar2,
839   p_attribute18                  in varchar2         default hr_api.g_varchar2,
840   p_attribute19                  in varchar2         default hr_api.g_varchar2,
841   p_attribute20                  in varchar2         default hr_api.g_varchar2,
842   p_attribute21                  in varchar2         default hr_api.g_varchar2,
843   p_attribute22                  in varchar2         default hr_api.g_varchar2,
844   p_attribute23                  in varchar2         default hr_api.g_varchar2,
845   p_attribute24                  in varchar2         default hr_api.g_varchar2,
846   p_attribute25                  in varchar2         default hr_api.g_varchar2,
847   p_attribute26                  in varchar2         default hr_api.g_varchar2,
848   p_attribute27                  in varchar2         default hr_api.g_varchar2,
849   p_attribute28                  in varchar2         default hr_api.g_varchar2,
850   p_attribute29                  in varchar2         default hr_api.g_varchar2,
851   p_attribute30                  in varchar2         default hr_api.g_varchar2,
852   p_effective_date       in date,
853   p_datetrack_mode       in varchar2
854   ) is
855 --
856   l_rec     per_ptu_shd.g_rec_type;
857   l_proc varchar2(72) := g_package||'upd';
858 --
859 Begin
860   hr_utility.set_location('Entering:'||l_proc, 5);
861   --
862   -- Call conversion function to turn arguments into the
863   -- l_rec structure.
864   --
865   l_rec :=
866   per_ptu_shd.convert_args
867   (
868   p_person_type_usage_id,
869   hr_api.g_number,
870   p_person_type_id,
871   null,
872   null,
873   p_object_version_number,
874   p_request_id,
875   p_program_application_id,
876   p_program_id,
877   p_program_update_date,
878   p_attribute_category,
879   p_attribute1,
880   p_attribute2,
881   p_attribute3,
882   p_attribute4,
883   p_attribute5,
884   p_attribute6,
885   p_attribute7,
886   p_attribute8,
887   p_attribute9,
888   p_attribute10,
889   p_attribute11,
890   p_attribute12,
891   p_attribute13,
892   p_attribute14,
893   p_attribute15,
894   p_attribute16,
895   p_attribute17,
896   p_attribute18,
897   p_attribute19,
898   p_attribute20,
899   p_attribute21,
900   p_attribute22,
901   p_attribute23,
902   p_attribute24,
903   p_attribute25,
904   p_attribute26,
905   p_attribute27,
906   p_attribute28,
907   p_attribute29,
908   p_attribute30
909   );
910   --
911   -- Having converted the arguments into the
912   -- plsql record structure we call the corresponding record
913   -- business process.
914   --
915   upd(l_rec, p_effective_date, p_datetrack_mode);
916   p_object_version_number       := l_rec.object_version_number;
917   p_effective_start_date        := l_rec.effective_start_date;
918   p_effective_end_date          := l_rec.effective_end_date;
919   --
920   --
921   hr_utility.set_location(' Leaving:'||l_proc, 10);
922 End upd;
923 --
924 end per_ptu_upd;