DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TPS_UPD

Source


1 PACKAGE BODY OTA_TPS_UPD AS
2 /* $Header: ottpsrhi.pkb 120.2 2005/12/14 15:17:58 asud noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tps_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 -- Prerequisites:
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 Row Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 PROCEDURE update_dml
55   (p_rec IN OUT NOCOPY ota_tps_shd.g_rec_type
56   ) IS
57 --
58   l_proc  varchar2(72) := g_package||'update_dml';
59 --
60 BEGIN
61   hr_utility.set_location('Entering:'||l_proc, 5);
62   --
63   -- Increment the object version
64   p_rec.object_version_number := p_rec.object_version_number + 1;
65   --
66   ota_tps_shd.g_api_dml := TRUE;  -- Set the api dml status
67   --
68   -- Update the ota_training_plans Row
69   --
70   UPDATE ota_training_plans
71     SET
72      training_plan_id                = p_rec.training_plan_id
73     ,time_period_id                  = p_rec.time_period_id
74     ,plan_status_type_id             = p_rec.plan_status_type_id
75     ,budget_currency                 = p_rec.budget_currency
76     ,name                            = p_rec.name
77     ,description                     = p_rec.description
78     ,object_version_number           = p_rec.object_version_number
79     ,attribute_category              = p_rec.attribute_category
80     ,attribute1                      = p_rec.attribute1
81     ,attribute2                      = p_rec.attribute2
82     ,attribute3                      = p_rec.attribute3
83     ,attribute4                      = p_rec.attribute4
84     ,attribute5                      = p_rec.attribute5
85     ,attribute6                      = p_rec.attribute6
86     ,attribute7                      = p_rec.attribute7
87     ,attribute8                      = p_rec.attribute8
88     ,attribute9                      = p_rec.attribute9
89     ,attribute10                     = p_rec.attribute10
90     ,attribute11                     = p_rec.attribute11
91     ,attribute12                     = p_rec.attribute12
92     ,attribute13                     = p_rec.attribute13
93     ,attribute14                     = p_rec.attribute14
94     ,attribute15                     = p_rec.attribute15
95     ,attribute16                     = p_rec.attribute16
96     ,attribute17                     = p_rec.attribute17
97     ,attribute18                     = p_rec.attribute18
98     ,attribute19                     = p_rec.attribute19
99     ,attribute20                     = p_rec.attribute20
100     ,attribute21                     = p_rec.attribute21
101     ,attribute22                     = p_rec.attribute22
102     ,attribute23                     = p_rec.attribute23
103     ,attribute24                     = p_rec.attribute24
104     ,attribute25                     = p_rec.attribute25
105     ,attribute26                     = p_rec.attribute26
106     ,attribute27                     = p_rec.attribute27
107     ,attribute28                     = p_rec.attribute28
108     ,attribute29                     = p_rec.attribute29
109     ,attribute30                     = p_rec.attribute30
110     ,plan_source                     = p_rec.plan_source  --changed
111     ,start_date                      = p_rec.start_date
112     ,end_date                        = p_rec.end_date
113     ,creator_person_id              = p_rec.creator_person_id
114     ,additional_member_flag        = p_rec.additional_member_flag
115     ,learning_path_id              = p_rec.learning_path_id
116     ,contact_id                         = p_rec.contact_id
117     WHERE training_plan_id = p_rec.training_plan_id;
118   --
119   ota_tps_shd.g_api_dml := FALSE;   -- Unset the api dml status
120   --
121   hr_utility.set_location(' Leaving:'||l_proc, 10);
122 --
123 EXCEPTION
124   WHEN hr_api.check_integrity_violated THEN
125     -- A check constraint has been violated
126     ota_tps_shd.g_api_dml := FALSE;   -- Unset the api dml status
127     ota_tps_shd.constraint_error
128       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
129   WHEN hr_api.parent_integrity_violated THEN
130     -- Parent integrity has been violated
131     ota_tps_shd.g_api_dml := FALSE;   -- Unset the api dml status
132     ota_tps_shd.constraint_error
133       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
134   WHEN hr_api.unique_integrity_violated THEN
135     -- Unique integrity has been violated
136     ota_tps_shd.g_api_dml := FALSE;   -- Unset the api dml status
137     ota_tps_shd.constraint_error
138       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
139   WHEN Others THEN
140     ota_tps_shd.g_api_dml := FALSE;   -- Unset the api dml status
141     RAISE;
142 END update_dml;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |------------------------------< pre_update >------------------------------|
146 -- ----------------------------------------------------------------------------
147 -- {Start Of Comments}
148 --
149 -- Description:
150 --   This private procedure contains any processing which is required before
151 --   the update dml.
152 --
153 -- Prerequisites:
154 --   This is an internal procedure which is called from the upd procedure.
155 --
156 -- In Parameters:
157 --   A Pl/Sql record structure.
158 --
159 -- Post Success:
160 --   Processing continues.
161 --
162 -- Post Failure:
163 --   If an error has occurred, an error message and exception wil be raised
164 --   but not handled.
165 --
166 -- Developer Implementation Notes:
167 --   Any pre-processing required before the update dml is issued should be
168 --   coded within this procedure. It is important to note that any 3rd party
169 --   maintenance should be reviewed before placing in this procedure.
170 --
171 -- Access Status:
172 --   Internal Row Handler Use Only.
173 --
174 -- {End Of Comments}
175 -- ----------------------------------------------------------------------------
176 PROCEDURE pre_update
177   (p_rec IN ota_tps_shd.g_rec_type
178   ) IS
179 --
180   l_proc  varchar2(72) := g_package||'pre_update';
181 --
182 BEGIN
183   hr_utility.set_location('Entering:'||l_proc, 5);
184   --
185   hr_utility.set_location(' Leaving:'||l_proc, 10);
186 END pre_update;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< post_update >------------------------------|
190 -- ----------------------------------------------------------------------------
191 -- {Start Of Comments}
192 --
193 -- Description:
194 --   This private procedure contains any processing which is required after the
195 --   update dml.
196 --
197 -- Prerequisites:
198 --   This is an internal procedure which is called from the upd procedure.
199 --
200 -- In Parameters:
201 --   A Pl/Sql record structure.
202 --
203 -- Post Success:
204 --   Processing continues.
205 --
206 -- Post Failure:
207 --   If an error has occurred, an error message and exception will be raised
208 --   but not handled.
209 --
210 -- Developer Implementation Notes:
211 --   Any post-processing required after the update dml is issued should be
212 --   coded within this procedure. It is important to note that any 3rd party
213 --   maintenance should be reviewed before placing in this procedure.
214 --
215 -- Access Status:
216 --   Internal Row Handler Use Only.
217 --
218 -- {End Of Comments}
219 -- ----------------------------------------------------------------------------
220 PROCEDURE post_update
221   (p_effective_date               IN date
222   ,p_rec                          IN ota_tps_shd.g_rec_type
223   ) IS
224 --
225   l_proc  varchar2(72) := g_package||'post_update';
226 --
227 BEGIN
228   hr_utility.set_location('Entering:'||l_proc, 5);
229   BEGIN
230     --
231     ota_tps_rku.after_update
232       (p_effective_date              => p_effective_date
233       ,p_training_plan_id
234       => p_rec.training_plan_id
235       ,p_time_period_id
236       => p_rec.time_period_id
237       ,p_plan_status_type_id
238       => p_rec.plan_status_type_id
239       ,p_organization_id
240       => p_rec.organization_id
241       ,p_person_id
242       => p_rec.person_id
243       ,p_budget_currency
244       => p_rec.budget_currency
245       ,p_name
246       => p_rec.name
247       ,p_description
248       => p_rec.description
249       ,p_business_group_id
250       => p_rec.business_group_id
251       ,p_object_version_number
252       => p_rec.object_version_number
253       ,p_attribute_category
254       => p_rec.attribute_category
255       ,p_attribute1
256       => p_rec.attribute1
257       ,p_attribute2
258       => p_rec.attribute2
259       ,p_attribute3
260       => p_rec.attribute3
261       ,p_attribute4
262       => p_rec.attribute4
263       ,p_attribute5
264       => p_rec.attribute5
265       ,p_attribute6
266       => p_rec.attribute6
267       ,p_attribute7
268       => p_rec.attribute7
269       ,p_attribute8
270       => p_rec.attribute8
271       ,p_attribute9
272       => p_rec.attribute9
273       ,p_attribute10
274       => p_rec.attribute10
275       ,p_attribute11
276       => p_rec.attribute11
277       ,p_attribute12
278       => p_rec.attribute12
279       ,p_attribute13
280       => p_rec.attribute13
281       ,p_attribute14
282       => p_rec.attribute14
283       ,p_attribute15
284       => p_rec.attribute15
285       ,p_attribute16
286       => p_rec.attribute16
287       ,p_attribute17
288       => p_rec.attribute17
289       ,p_attribute18
290       => p_rec.attribute18
291       ,p_attribute19
292       => p_rec.attribute19
293       ,p_attribute20
294       => p_rec.attribute20
295       ,p_attribute21
296       => p_rec.attribute21
297       ,p_attribute22
298       => p_rec.attribute22
299       ,p_attribute23
300       => p_rec.attribute23
301       ,p_attribute24
302       => p_rec.attribute24
303       ,p_attribute25
304       => p_rec.attribute25
305       ,p_attribute26
306       => p_rec.attribute26
307       ,p_attribute27
308       => p_rec.attribute27
309       ,p_attribute28
310       => p_rec.attribute28
311       ,p_attribute29
312       => p_rec.attribute29
313       ,p_attribute30
314       => p_rec.attribute30
315       ,p_plan_source => p_rec.plan_source  --changed
316       ,p_start_date => p_rec.start_date
317       ,p_end_date => p_rec.end_date
318       ,p_creator_person_id  => p_rec.creator_person_id
319       ,p_additional_member_flag => p_rec.additional_member_flag
320       ,p_learning_path_id => p_rec.learning_path_id
321       ,p_contact_id             => p_rec.contact_id
322       ,p_time_period_id_o
323       => ota_tps_shd.g_old_rec.time_period_id
324       ,p_plan_status_type_id_o
325       => ota_tps_shd.g_old_rec.plan_status_type_id
326       ,p_organization_id_o
327       => ota_tps_shd.g_old_rec.organization_id
328       ,p_person_id_o
329       => ota_tps_shd.g_old_rec.person_id
330       ,p_budget_currency_o
331       => ota_tps_shd.g_old_rec.budget_currency
332       ,p_name_o
333       => ota_tps_shd.g_old_rec.name
334       ,p_description_o
335       => ota_tps_shd.g_old_rec.description
336       ,p_business_group_id_o
337       => ota_tps_shd.g_old_rec.business_group_id
338       ,p_object_version_number_o
339       => ota_tps_shd.g_old_rec.object_version_number
340       ,p_attribute_category_o
341       => ota_tps_shd.g_old_rec.attribute_category
342       ,p_attribute1_o
343       => ota_tps_shd.g_old_rec.attribute1
344       ,p_attribute2_o
345       => ota_tps_shd.g_old_rec.attribute2
346       ,p_attribute3_o
347       => ota_tps_shd.g_old_rec.attribute3
348       ,p_attribute4_o
349       => ota_tps_shd.g_old_rec.attribute4
350       ,p_attribute5_o
351       => ota_tps_shd.g_old_rec.attribute5
352       ,p_attribute6_o
353       => ota_tps_shd.g_old_rec.attribute6
354       ,p_attribute7_o
355       => ota_tps_shd.g_old_rec.attribute7
356       ,p_attribute8_o
357       => ota_tps_shd.g_old_rec.attribute8
358       ,p_attribute9_o
359       => ota_tps_shd.g_old_rec.attribute9
360       ,p_attribute10_o
361       => ota_tps_shd.g_old_rec.attribute10
362       ,p_attribute11_o
363       => ota_tps_shd.g_old_rec.attribute11
364       ,p_attribute12_o
365       => ota_tps_shd.g_old_rec.attribute12
366       ,p_attribute13_o
367       => ota_tps_shd.g_old_rec.attribute13
368       ,p_attribute14_o
369       => ota_tps_shd.g_old_rec.attribute14
370       ,p_attribute15_o
371       => ota_tps_shd.g_old_rec.attribute15
372       ,p_attribute16_o
373       => ota_tps_shd.g_old_rec.attribute16
374       ,p_attribute17_o
375       => ota_tps_shd.g_old_rec.attribute17
376       ,p_attribute18_o
377       => ota_tps_shd.g_old_rec.attribute18
378       ,p_attribute19_o
379       => ota_tps_shd.g_old_rec.attribute19
380       ,p_attribute20_o
381       => ota_tps_shd.g_old_rec.attribute20
382       ,p_attribute21_o
383       => ota_tps_shd.g_old_rec.attribute21
384       ,p_attribute22_o
385       => ota_tps_shd.g_old_rec.attribute22
386       ,p_attribute23_o
387       => ota_tps_shd.g_old_rec.attribute23
388       ,p_attribute24_o
389       => ota_tps_shd.g_old_rec.attribute24
390       ,p_attribute25_o
391       => ota_tps_shd.g_old_rec.attribute25
392       ,p_attribute26_o
393       => ota_tps_shd.g_old_rec.attribute26
394       ,p_attribute27_o
395       => ota_tps_shd.g_old_rec.attribute27
396       ,p_attribute28_o
397       => ota_tps_shd.g_old_rec.attribute28
398       ,p_attribute29_o
399       => ota_tps_shd.g_old_rec.attribute29
400       ,p_attribute30_o
401       => ota_tps_shd.g_old_rec.attribute30
402       ,p_plan_source_o => ota_tps_shd.g_old_rec.plan_source --changed
406       ,p_additional_member_flag_o => ota_tps_shd.g_old_rec.additional_member_flag
403       ,p_start_date_o => ota_tps_shd.g_old_rec.start_date
404       ,p_end_date_o => ota_tps_shd.g_old_rec.end_date
405       ,p_creator_person_id_o => ota_tps_shd.g_old_rec.creator_person_id
407       ,p_learning_path_id_o => ota_tps_shd.g_old_rec.learning_path_id
408       ,p_contact_id_o       => ota_tps_shd.g_old_rec.contact_id
409       );
410     --
411   EXCEPTION
412     --
413     WHEN hr_api.cannot_find_prog_unit THEN
414       --
415       hr_api.cannot_find_prog_unit_error
416         (p_module_name => 'OTA_TRAINING_PLANS'
417         ,p_hook_type   => 'AU');
418       --
419   END;
420   --
421   hr_utility.set_location(' Leaving:'||l_proc, 10);
422 END post_update;
423 --
424 -- ----------------------------------------------------------------------------
425 -- |-----------------------------< convert_defs >-----------------------------|
426 -- ----------------------------------------------------------------------------
427 -- {Start Of Comments}
428 --
429 -- Description:
430 --   The Convert_Defs procedure has one very important function:
431 --   It must return the record structure for the row with all system defaulted
432 --   values converted into its corresponding parameter value for update. When
433 --   we attempt to update a row through the Upd process , certain
434 --   parameters can be defaulted which enables flexibility in the calling of
435 --   the upd process (e.g. only attributes which need to be updated need to be
436 --   specified). For the upd process to determine which attributes
437 --   have NOT been specified we need to check if the parameter has a reserved
438 --   system default value. Therefore, for all parameters which have a
439 --   corresponding reserved system default mechanism specified we need to
440 --   check if a system default is being used. If a system default is being
441 --   used then we convert the defaulted value into its corresponding attribute
442 --   value held in the g_old_rec data structure.
443 --
444 -- Prerequisites:
445 --   This private function can only be called from the upd process.
446 --
447 -- In Parameters:
448 --   A Pl/Sql record structure.
449 --
450 -- Post Success:
451 --   The record structure will be returned with all system defaulted parameter
452 --   values converted into its current row attribute value.
453 --
454 -- Post Failure:
455 --   No direct error handling is required within this function. Any possible
456 --   errors within this procedure will be a PL/SQL value error due to
457 --   conversion of datatypes or data lengths.
458 --
459 -- Developer Implementation Notes:
460 --   None.
461 --
462 -- Access Status:
463 --   Internal Row Handler Use Only.
464 --
465 -- {End Of Comments}
466 -- ----------------------------------------------------------------------------
467 PROCEDURE convert_defs
468   (p_rec IN OUT NOCOPY ota_tps_shd.g_rec_type
469   ) IS
470 --
471 BEGIN
472   --
473   -- We must now examine each argument value in the
474   -- p_rec plsql record structure
475   -- to see if a system default is being used. If a system default
476   -- is being used then we must set to the 'current' argument value.
477   --
478    IF (p_rec.training_plan_id = hr_api.g_number) THEN
479     p_rec.training_plan_id :=
480     ota_tps_shd.g_old_rec.training_plan_id;
481   END IF;
482   IF (p_rec.time_period_id = hr_api.g_number) THEN
483     p_rec.time_period_id :=
484     ota_tps_shd.g_old_rec.time_period_id;
485   END IF;
486   IF (p_rec.plan_status_type_id = hr_api.g_varchar2) THEN
487     p_rec.plan_status_type_id :=
488     ota_tps_shd.g_old_rec.plan_status_type_id;
489   END IF;
490   IF (p_rec.organization_id = hr_api.g_number) THEN
491     p_rec.organization_id :=
492     ota_tps_shd.g_old_rec.organization_id;
493   END IF;
494   IF (p_rec.person_id = hr_api.g_number) THEN
495     p_rec.person_id :=
496     ota_tps_shd.g_old_rec.person_id;
497   END IF;
498   IF (p_rec.budget_currency = hr_api.g_varchar2) THEN
499     p_rec.budget_currency :=
500     ota_tps_shd.g_old_rec.budget_currency;
501   END IF;
502   IF (p_rec.name = hr_api.g_varchar2) THEN
503     p_rec.name :=
504     ota_tps_shd.g_old_rec.name;
505   END IF;
506   IF (p_rec.description = hr_api.g_varchar2) THEN
507     p_rec.description :=
508     ota_tps_shd.g_old_rec.description;
509   END IF;
510   IF (p_rec.business_group_id = hr_api.g_number) THEN
511     p_rec.business_group_id :=
512     ota_tps_shd.g_old_rec.business_group_id;
513   END IF;
514   IF (p_rec.attribute_category = hr_api.g_varchar2) THEN
515     p_rec.attribute_category :=
516     ota_tps_shd.g_old_rec.attribute_category;
517   END IF;
518   IF (p_rec.attribute1 = hr_api.g_varchar2) THEN
519     p_rec.attribute1 :=
520     ota_tps_shd.g_old_rec.attribute1;
521   END IF;
522   IF (p_rec.attribute2 = hr_api.g_varchar2) THEN
523     p_rec.attribute2 :=
524     ota_tps_shd.g_old_rec.attribute2;
525   END IF;
526   IF (p_rec.attribute3 = hr_api.g_varchar2) THEN
527     p_rec.attribute3 :=
528     ota_tps_shd.g_old_rec.attribute3;
529   END IF;
530   IF (p_rec.attribute4 = hr_api.g_varchar2) THEN
531     p_rec.attribute4 :=
535     p_rec.attribute5 :=
532     ota_tps_shd.g_old_rec.attribute4;
533   END IF;
534   IF (p_rec.attribute5 = hr_api.g_varchar2) THEN
536     ota_tps_shd.g_old_rec.attribute5;
537   END IF;
538   IF (p_rec.attribute6 = hr_api.g_varchar2) THEN
539     p_rec.attribute6 :=
540     ota_tps_shd.g_old_rec.attribute6;
541   END IF;
542   IF (p_rec.attribute7 = hr_api.g_varchar2) THEN
543     p_rec.attribute7 :=
544     ota_tps_shd.g_old_rec.attribute7;
545   END IF;
546   IF (p_rec.attribute8 = hr_api.g_varchar2) THEN
547     p_rec.attribute8 :=
548     ota_tps_shd.g_old_rec.attribute8;
549   END IF;
550   IF (p_rec.attribute9 = hr_api.g_varchar2) THEN
551     p_rec.attribute9 :=
552     ota_tps_shd.g_old_rec.attribute9;
553   END IF;
554   IF (p_rec.attribute10 = hr_api.g_varchar2) THEN
555     p_rec.attribute10 :=
556     ota_tps_shd.g_old_rec.attribute10;
557   END IF;
558   IF (p_rec.attribute11 = hr_api.g_varchar2) THEN
559     p_rec.attribute11 :=
560     ota_tps_shd.g_old_rec.attribute11;
561   END IF;
562   IF (p_rec.attribute12 = hr_api.g_varchar2) THEN
563     p_rec.attribute12 :=
564     ota_tps_shd.g_old_rec.attribute12;
565   END IF;
566   IF (p_rec.attribute13 = hr_api.g_varchar2) THEN
567     p_rec.attribute13 :=
568     ota_tps_shd.g_old_rec.attribute13;
569   END IF;
570   IF (p_rec.attribute14 = hr_api.g_varchar2) THEN
571     p_rec.attribute14 :=
572     ota_tps_shd.g_old_rec.attribute14;
573   END IF;
574   IF (p_rec.attribute15 = hr_api.g_varchar2) THEN
575     p_rec.attribute15 :=
576     ota_tps_shd.g_old_rec.attribute15;
577   END IF;
578   IF (p_rec.attribute16 = hr_api.g_varchar2) THEN
579     p_rec.attribute16 :=
580     ota_tps_shd.g_old_rec.attribute16;
581   END IF;
582   IF (p_rec.attribute17 = hr_api.g_varchar2) THEN
583     p_rec.attribute17 :=
584     ota_tps_shd.g_old_rec.attribute17;
585   END IF;
586   IF (p_rec.attribute18 = hr_api.g_varchar2) THEN
587     p_rec.attribute18 :=
588     ota_tps_shd.g_old_rec.attribute18;
589   END IF;
590   IF (p_rec.attribute19 = hr_api.g_varchar2) THEN
591     p_rec.attribute19 :=
592     ota_tps_shd.g_old_rec.attribute19;
593   END IF;
594   IF (p_rec.attribute20 = hr_api.g_varchar2) THEN
595     p_rec.attribute20 :=
596     ota_tps_shd.g_old_rec.attribute20;
597   END IF;
598   IF (p_rec.attribute21 = hr_api.g_varchar2) THEN
599     p_rec.attribute21 :=
600     ota_tps_shd.g_old_rec.attribute21;
601   END IF;
602   IF (p_rec.attribute22 = hr_api.g_varchar2) THEN
603     p_rec.attribute22 :=
604     ota_tps_shd.g_old_rec.attribute22;
605   END IF;
606   IF (p_rec.attribute23 = hr_api.g_varchar2) THEN
607     p_rec.attribute23 :=
608     ota_tps_shd.g_old_rec.attribute23;
609   END IF;
610   IF (p_rec.attribute24 = hr_api.g_varchar2) THEN
611     p_rec.attribute24 :=
612     ota_tps_shd.g_old_rec.attribute24;
613   END IF;
614   IF (p_rec.attribute25 = hr_api.g_varchar2) THEN
615     p_rec.attribute25 :=
616     ota_tps_shd.g_old_rec.attribute25;
617   END IF;
618   IF (p_rec.attribute26 = hr_api.g_varchar2) THEN
619     p_rec.attribute26 :=
620     ota_tps_shd.g_old_rec.attribute26;
621   END IF;
622   IF (p_rec.attribute27 = hr_api.g_varchar2) THEN
623     p_rec.attribute27 :=
624     ota_tps_shd.g_old_rec.attribute27;
625   END IF;
626   IF (p_rec.attribute28 = hr_api.g_varchar2) THEN
627     p_rec.attribute28 :=
628     ota_tps_shd.g_old_rec.attribute28;
629   END IF;
630   IF (p_rec.attribute29 = hr_api.g_varchar2) THEN
631     p_rec.attribute29 :=
632     ota_tps_shd.g_old_rec.attribute29;
633   END IF;
634   IF (p_rec.attribute30 = hr_api.g_varchar2) THEN
635     p_rec.attribute30 :=
636     ota_tps_shd.g_old_rec.attribute30;
637   END IF;
638   IF (p_rec.plan_source = hr_api.g_varchar2) THEN --cahnged
639     p_rec.plan_source :=
640     ota_tps_shd.g_old_rec.plan_source;
641   END IF;
642   IF (p_rec.start_date = hr_api.g_date) THEN
643     p_rec.start_date :=
644     ota_tps_shd.g_old_rec.start_date;
645   END IF;
646   IF (p_rec.end_date = hr_api.g_date) THEN
647     p_rec.end_date :=
648     ota_tps_shd.g_old_rec.end_date;
649   END IF;
650   IF (p_rec.creator_person_id = hr_api.g_number) THEN
651     p_rec.creator_person_id :=
652     ota_tps_shd.g_old_rec.creator_person_id;
653   END IF;
654   IF (p_rec.additional_member_flag = hr_api.g_varchar2) THEN --cahnged
655     p_rec.additional_member_flag :=
656     ota_tps_shd.g_old_rec.additional_member_flag;
657   END IF;
658   IF (p_rec.learning_path_id = hr_api.g_number) THEN --new
659     p_rec.learning_path_id :=
660     ota_tps_shd.g_old_rec.learning_path_id;
661   END IF;
662     IF (p_rec.contact_id = hr_api.g_number) THEN --new
663     p_rec.contact_id :=
664     ota_tps_shd.g_old_rec.contact_id;
665   END IF;
666   --
667 END convert_defs;
668 --
669 -- ----------------------------------------------------------------------------
670 -- |---------------------------------< upd >----------------------------------|
671 -- ----------------------------------------------------------------------------
672 PROCEDURE upd
673   (p_effective_date               IN date
674   ,p_rec                          IN OUT NOCOPY ota_tps_shd.g_rec_type
675   ) IS
676 --
680   hr_utility.set_location('Entering:'||l_proc, 5);
677   l_proc  varchar2(72) := g_package||'upd';
678 --
679 BEGIN
681   --
682   -- We must lock the row which we need to update.
683   --
684   ota_tps_shd.lck
685     (p_rec.training_plan_id
686     ,p_rec.object_version_number
687     );
688   --
689   -- 1. During an update system defaults are used to determine if
690   --    arguments have been defaulted or not. We must therefore
691   --    derive the full record structure values to be updated.
692   --
693   -- 2. Call the supporting update validate operations.
694   --
695   convert_defs(p_rec);
696   ota_tps_bus.update_validate
697      (p_effective_date
698      ,p_rec
699      );
700   --
701   --CALL TO RAISE ANY ERRORS ON MULTI MESSAGE LIST
702   hr_multi_message.end_validation_set;
703 
704 
705   -- Call the supporting pre-update operation
706   --
707   ota_tps_upd.pre_update(p_rec);
708   --
709   -- Update the row.
710   --
711   ota_tps_upd.update_dml(p_rec);
712   --
713   -- Call the supporting post-update operation
714   --
715   ota_tps_upd.post_update
716      (p_effective_date
717      ,p_rec
718      );
719 
720  --CALL TO RAISE ANY ERRORS ON MULTI MESSAGE LIST
721   hr_multi_message.end_validation_set;
722 
723 END upd;
724 --
725 -- ----------------------------------------------------------------------------
726 -- |---------------------------------< upd >----------------------------------|
727 -- ----------------------------------------------------------------------------
728 PROCEDURE upd
729   (p_effective_date               IN     date
730   ,p_training_plan_id             IN     number
731   ,p_object_version_number        IN OUT NOCOPY number
732   ,p_time_period_id               IN     number    DEFAULT hr_api.g_number
733   ,p_plan_status_type_id          IN     varchar2  DEFAULT hr_api.g_varchar2
734   ,p_budget_currency              IN     varchar2  DEFAULT hr_api.g_varchar2
735   ,p_name                         IN     varchar2  DEFAULT hr_api.g_varchar2
736   ,p_description                  IN     varchar2  DEFAULT hr_api.g_varchar2
737   ,p_attribute_category           IN     varchar2  DEFAULT hr_api.g_varchar2
738   ,p_attribute1                   IN     varchar2  DEFAULT hr_api.g_varchar2
739   ,p_attribute2                   IN     varchar2  DEFAULT hr_api.g_varchar2
740   ,p_attribute3                   IN     varchar2  DEFAULT hr_api.g_varchar2
741   ,p_attribute4                   IN     varchar2  DEFAULT hr_api.g_varchar2
742   ,p_attribute5                   IN     varchar2  DEFAULT hr_api.g_varchar2
743   ,p_attribute6                   IN     varchar2  DEFAULT hr_api.g_varchar2
744   ,p_attribute7                   IN     varchar2  DEFAULT hr_api.g_varchar2
745   ,p_attribute8                   IN     varchar2  DEFAULT hr_api.g_varchar2
746   ,p_attribute9                   IN     varchar2  DEFAULT hr_api.g_varchar2
747   ,p_attribute10                  IN     varchar2  DEFAULT hr_api.g_varchar2
748   ,p_attribute11                  IN     varchar2  DEFAULT hr_api.g_varchar2
749   ,p_attribute12                  IN     varchar2  DEFAULT hr_api.g_varchar2
750   ,p_attribute13                  IN     varchar2  DEFAULT hr_api.g_varchar2
751   ,p_attribute14                  IN     varchar2  DEFAULT hr_api.g_varchar2
752   ,p_attribute15                  IN     varchar2  DEFAULT hr_api.g_varchar2
753   ,p_attribute16                  IN     varchar2  DEFAULT hr_api.g_varchar2
754   ,p_attribute17                  IN     varchar2  DEFAULT hr_api.g_varchar2
755   ,p_attribute18                  IN     varchar2  DEFAULT hr_api.g_varchar2
756   ,p_attribute19                  IN     varchar2  DEFAULT hr_api.g_varchar2
757   ,p_attribute20                  IN     varchar2  DEFAULT hr_api.g_varchar2
758   ,p_attribute21                  IN     varchar2  DEFAULT hr_api.g_varchar2
759   ,p_attribute22                  IN     varchar2  DEFAULT hr_api.g_varchar2
760   ,p_attribute23                  IN     varchar2  DEFAULT hr_api.g_varchar2
761   ,p_attribute24                  IN     varchar2  DEFAULT hr_api.g_varchar2
762   ,p_attribute25                  IN     varchar2  DEFAULT hr_api.g_varchar2
763   ,p_attribute26                  IN     varchar2  DEFAULT hr_api.g_varchar2
764   ,p_attribute27                  IN     varchar2  DEFAULT hr_api.g_varchar2
765   ,p_attribute28                  IN     varchar2  DEFAULT hr_api.g_varchar2
766   ,p_attribute29                  IN     varchar2  DEFAULT hr_api.g_varchar2
767   ,p_attribute30                  IN     varchar2  DEFAULT hr_api.g_varchar2
768   ,p_plan_source                  IN     varchar2  DEFAULT hr_api.g_varchar2 --changed
769   ,p_start_date                   IN     date      DEFAULT hr_api.g_date
770   ,p_end_date                     IN     date      DEFAULT hr_api.g_date
771   ,p_creator_person_id            IN	 number    DEFAULT hr_api.g_number
772   ,p_additional_member_flag       IN     varchar2  DEFAULT hr_api.g_varchar2
773   ,p_learning_path_id             IN	 number    DEFAULT hr_api.g_number
774   ,p_contact_id                          IN	 number    DEFAULT hr_api.g_number
775   ) IS
776 --
777   l_rec	  ota_tps_shd.g_rec_type;
778   l_proc  varchar2(72) := g_package||'upd';
779 --
780 BEGIN
781   hr_utility.set_location('Entering:'||l_proc, 5);
782   --
783   -- Call conversion function to turn arguments into the
784   -- l_rec structure.
785   --
786   l_rec :=
787   ota_tps_shd.convert_args
788   (p_training_plan_id
789   ,p_time_period_id
790   ,p_plan_status_type_id
791   ,hr_api.g_number
792   ,hr_api.g_number
793   ,p_budget_currency
794   ,p_name
795   ,p_description
796   ,hr_api.g_number
797   ,p_object_version_number
798   ,p_attribute_category
799   ,p_attribute1
800   ,p_attribute2
801   ,p_attribute3
802   ,p_attribute4
803   ,p_attribute5
804   ,p_attribute6
805   ,p_attribute7
806   ,p_attribute8
807   ,p_attribute9
808   ,p_attribute10
809   ,p_attribute11
810   ,p_attribute12
811   ,p_attribute13
812   ,p_attribute14
813   ,p_attribute15
814   ,p_attribute16
815   ,p_attribute17
816   ,p_attribute18
817   ,p_attribute19
818   ,p_attribute20
819   ,p_attribute21
820   ,p_attribute22
821   ,p_attribute23
822   ,p_attribute24
823   ,p_attribute25
824   ,p_attribute26
825   ,p_attribute27
826   ,p_attribute28
827   ,p_attribute29
828   ,p_attribute30
829   ,p_plan_source --changed
830   ,p_start_date
831   ,p_end_date
832   ,p_creator_person_id
833   ,p_additional_member_flag
834   ,p_learning_path_id
835   ,p_contact_id
836   );
837   --
838   -- Having converted the arguments into the
839   -- plsql record structure we call the corresponding record
840   -- business process.
841   --
842   ota_tps_upd.upd
843      (p_effective_date
844      ,l_rec
845      );
846   p_object_version_number := l_rec.object_version_number;
847   --
848   hr_utility.set_location(' Leaving:'||l_proc, 10);
849 END upd;
850 --
851 END ota_tps_upd;