DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ELC_UPD

Source


1 Package Body per_elc_upd as
2 /* $Header: peelcrhi.pkb 115.10 2002/12/05 10:37:58 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_elc_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 per_elc_shd.g_rec_type
56   ) is
57 --
58   l_proc  varchar2(72) := g_package||'update_dml';
59   l_last_update_date    per_elections.last_update_date%TYPE;
60   l_last_updated_by     per_elections.last_updated_by%TYPE;
61   l_last_update_login   per_elections.last_update_login%TYPE;
62 --
63 Begin
64   hr_utility.set_location('Entering:'||l_proc, 5);
65   --
66   -- Increment the object version
67   p_rec.object_version_number := p_rec.object_version_number + 1;
68   --
69   per_elc_shd.g_api_dml := true;  -- Set the api dml status
70   --
71   --
72   -- Set the who columns
73   --
74   l_last_update_date   := sysdate;
75   l_last_updated_by    := fnd_global.user_id;
76   l_last_update_login  := fnd_global.login_id;
77   --
78   -- Update the per_elections Row
79   --
80   update per_elections
81     set
82      election_id                     = p_rec.election_id
83     ,business_group_id               = p_rec.business_group_id
84     ,election_date                   = p_rec.election_date
85     ,description		     = p_rec.description
86     ,rep_body_id                     = p_rec.rep_body_id
87     ,previous_election_date          = p_rec.previous_election_date
88     ,next_election_date              = p_rec.next_election_date
89     ,result_publish_date             = p_rec.result_publish_date
90     ,attribute_category              = p_rec.attribute_category
91     ,attribute1                      = p_rec.attribute1
92     ,attribute2                      = p_rec.attribute2
93     ,attribute3                      = p_rec.attribute3
94     ,attribute4                      = p_rec.attribute4
95     ,attribute5                      = p_rec.attribute5
96     ,attribute6                      = p_rec.attribute6
97     ,attribute7                      = p_rec.attribute7
98     ,attribute8                      = p_rec.attribute8
99     ,attribute9                      = p_rec.attribute9
100     ,attribute10                     = p_rec.attribute10
101     ,attribute11                     = p_rec.attribute11
102     ,attribute12                     = p_rec.attribute12
103     ,attribute13                     = p_rec.attribute13
104     ,attribute14                     = p_rec.attribute14
105     ,attribute15                     = p_rec.attribute15
106     ,attribute16                     = p_rec.attribute16
107     ,attribute17                     = p_rec.attribute17
108     ,attribute18                     = p_rec.attribute18
109     ,attribute19                     = p_rec.attribute19
110     ,attribute20                     = p_rec.attribute20
111     ,attribute21                     = p_rec.attribute21
112     ,attribute22                     = p_rec.attribute22
113     ,attribute23                     = p_rec.attribute23
114     ,attribute24                     = p_rec.attribute24
115     ,attribute25                     = p_rec.attribute25
116     ,attribute26                     = p_rec.attribute26
117     ,attribute27                     = p_rec.attribute27
118     ,attribute28                     = p_rec.attribute28
119     ,attribute29                     = p_rec.attribute29
120     ,attribute30                     = p_rec.attribute30
121     ,election_info_category   	  = p_rec.election_info_category
122     ,election_information1           = p_rec.election_information1
123     ,election_information2           = p_rec.election_information2
124     ,election_information3           = p_rec.election_information3
125     ,election_information4           = p_rec.election_information4
126     ,election_information5           = p_rec.election_information5
127     ,election_information6           = p_rec.election_information6
128     ,election_information7           = p_rec.election_information7
129     ,election_information8           = p_rec.election_information8
130     ,election_information9           = p_rec.election_information9
131     ,election_information10          = p_rec.election_information10
132     ,election_information11          = p_rec.election_information11
133     ,election_information12          = p_rec.election_information12
134     ,election_information13          = p_rec.election_information13
135     ,election_information14          = p_rec.election_information14
136     ,election_information15          = p_rec.election_information15
137     ,election_information16          = p_rec.election_information16
138     ,election_information17          = p_rec.election_information17
139     ,election_information18          = p_rec.election_information18
140     ,election_information19          = p_rec.election_information19
141     ,election_information20          = p_rec.election_information20
142     ,election_information21          = p_rec.election_information21
143     ,election_information22          = p_rec.election_information22
144     ,election_information23          = p_rec.election_information23
145     ,election_information24          = p_rec.election_information24
146     ,election_information25          = p_rec.election_information25
147     ,election_information26          = p_rec.election_information26
148     ,election_information27          = p_rec.election_information27
149     ,election_information28          = p_rec.election_information28
150     ,election_information29          = p_rec.election_information29
151     ,election_information30          = p_rec.election_information30
152     ,object_version_number           = p_rec.object_version_number
153     ,last_update_date                = l_last_update_date
154     ,last_updated_by                 = l_last_updated_by
155     ,last_update_login               = l_last_update_login
156     where election_id = p_rec.election_id;
157   --
158   per_elc_shd.g_api_dml := false;   -- Unset the api dml status
159   --
160   hr_utility.set_location(' Leaving:'||l_proc, 10);
161 --
162 Exception
163   When hr_api.check_integrity_violated Then
164     -- A check constraint has been violated
165     per_elc_shd.g_api_dml := false;   -- Unset the api dml status
166     per_elc_shd.constraint_error
167       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
168   When hr_api.parent_integrity_violated Then
169     -- Parent integrity has been violated
170     per_elc_shd.g_api_dml := false;   -- Unset the api dml status
171     per_elc_shd.constraint_error
172       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
173   When hr_api.unique_integrity_violated Then
174     -- Unique integrity has been violated
175     per_elc_shd.g_api_dml := false;   -- Unset the api dml status
176     per_elc_shd.constraint_error
177       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
178   When Others Then
179     per_elc_shd.g_api_dml := false;   -- Unset the api dml status
180     Raise;
181 End update_dml;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |------------------------------< pre_update >------------------------------|
185 -- ----------------------------------------------------------------------------
186 -- {Start Of Comments}
187 --
188 -- Description:
189 --   This private procedure contains any processing which is required before
190 --   the update dml.
191 --
192 -- Prerequisites:
193 --   This is an internal procedure which is called from the upd procedure.
194 --
195 -- In Parameters:
196 --   A Pl/Sql record structure.
197 --
198 -- Post Success:
199 --   Processing continues.
200 --
201 -- Post Failure:
202 --   If an error has occurred, an error message and exception wil be raised
203 --   but not handled.
204 --
205 -- Developer Implementation Notes:
206 --   Any pre-processing required before the update dml is issued should be
207 --   coded within this procedure. It is important to note that any 3rd party
208 --   maintenance should be reviewed before placing in this procedure.
209 --
210 -- Access Status:
211 --   Internal Row Handler Use Only.
212 --
213 -- {End Of Comments}
214 -- ----------------------------------------------------------------------------
215 Procedure pre_update
216   (p_rec in per_elc_shd.g_rec_type
217   ) is
218 --
219   l_proc  varchar2(72) := g_package||'pre_update';
220 --
221 Begin
222   hr_utility.set_location('Entering:'||l_proc, 5);
223   --
224   hr_utility.set_location(' Leaving:'||l_proc, 10);
225 End pre_update;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |-----------------------------< post_update >------------------------------|
229 -- ----------------------------------------------------------------------------
230 -- {Start Of Comments}
231 --
232 -- Description:
233 --   This private procedure contains any processing which is required after the
234 --   update dml.
235 --
236 -- Prerequisites:
237 --   This is an internal procedure which is called from the upd procedure.
238 --
239 -- In Parameters:
240 --   A Pl/Sql record structure.
241 --
242 -- Post Success:
243 --   Processing continues.
244 --
245 -- Post Failure:
246 --   If an error has occurred, an error message and exception will be raised
247 --   but not handled.
248 --
249 -- Developer Implementation Notes:
250 --   Any post-processing required after the update dml is issued should be
251 --   coded within this procedure. It is important to note that any 3rd party
252 --   maintenance should be reviewed before placing in this procedure.
253 --
254 -- Access Status:
255 --   Internal Row Handler Use Only.
256 --
257 -- {End Of Comments}
258 -- ----------------------------------------------------------------------------
259 Procedure post_update
260   (p_effective_date               in date
261   ,p_rec                          in per_elc_shd.g_rec_type
262   ) is
263 --
264   l_proc  varchar2(72) := g_package||'post_update';
265 --
266 Begin
267   hr_utility.set_location('Entering:'||l_proc, 5);
268   begin
269     --
270     per_elc_rku.after_update
271       (p_effective_date              => p_effective_date
272       ,p_election_id
273       => p_rec.election_id
274       ,p_business_group_id
275       => p_rec.business_group_id
276       ,p_election_date
277       => p_rec.election_date
278       ,p_description
279       => p_rec.description
280       ,p_rep_body_id
281       => p_rec.rep_body_id
282       ,p_previous_election_date
283       => p_rec.previous_election_date
284       ,p_next_election_date
285       => p_rec.next_election_date
286       ,p_result_publish_date
287       => p_rec.result_publish_date
288       ,p_attribute_category
289       => p_rec.attribute_category
290       ,p_attribute1
291       => p_rec.attribute1
292       ,p_attribute2
293       => p_rec.attribute2
294       ,p_attribute3
295       => p_rec.attribute3
296       ,p_attribute4
297       => p_rec.attribute4
298       ,p_attribute5
299       => p_rec.attribute5
300       ,p_attribute6
301       => p_rec.attribute6
302       ,p_attribute7
303       => p_rec.attribute7
304       ,p_attribute8
305       => p_rec.attribute8
306       ,p_attribute9
307       => p_rec.attribute9
308       ,p_attribute10
309       => p_rec.attribute10
310       ,p_attribute11
311       => p_rec.attribute11
312       ,p_attribute12
313       => p_rec.attribute12
314       ,p_attribute13
315       => p_rec.attribute13
316       ,p_attribute14
317       => p_rec.attribute14
318       ,p_attribute15
319       => p_rec.attribute15
320       ,p_attribute16
321       => p_rec.attribute16
322       ,p_attribute17
323       => p_rec.attribute17
324       ,p_attribute18
325       => p_rec.attribute18
326       ,p_attribute19
327       => p_rec.attribute19
328       ,p_attribute20
329       => p_rec.attribute20
330       ,p_attribute21
331       => p_rec.attribute21
332       ,p_attribute22
333       => p_rec.attribute22
334       ,p_attribute23
335       => p_rec.attribute23
336       ,p_attribute24
337       => p_rec.attribute24
338       ,p_attribute25
339       => p_rec.attribute25
340       ,p_attribute26
341       => p_rec.attribute26
342       ,p_attribute27
343       => p_rec.attribute27
344       ,p_attribute28
345       => p_rec.attribute28
346       ,p_attribute29
347       => p_rec.attribute29
348       ,p_attribute30
349       => p_rec.attribute30
350       ,p_election_info_category
351       => p_rec.election_info_category
352       ,p_election_information1
353       => p_rec.election_information1
354       ,p_election_information2
355       => p_rec.election_information2
356       ,p_election_information3
357       => p_rec.election_information3
358       ,p_election_information4
359       => p_rec.election_information4
360       ,p_election_information5
361       => p_rec.election_information5
362       ,p_election_information6
363       => p_rec.election_information6
364       ,p_election_information7
365       => p_rec.election_information7
366       ,p_election_information8
367       => p_rec.election_information8
368       ,p_election_information9
369       => p_rec.election_information9
370       ,p_election_information10
371       => p_rec.election_information10
372       ,p_election_information11
373       => p_rec.election_information11
374       ,p_election_information12
375       => p_rec.election_information12
376       ,p_election_information13
377       => p_rec.election_information13
378       ,p_election_information14
379       => p_rec.election_information14
380       ,p_election_information15
381       => p_rec.election_information15
382       ,p_election_information16
383       => p_rec.election_information16
384       ,p_election_information17
385       => p_rec.election_information17
386       ,p_election_information18
387       => p_rec.election_information18
388       ,p_election_information19
389       => p_rec.election_information19
390       ,p_election_information20
391       => p_rec.election_information20
392       ,p_election_information21
393       => p_rec.election_information21
394       ,p_election_information22
395       => p_rec.election_information22
396       ,p_election_information23
397       => p_rec.election_information23
398       ,p_election_information24
399       => p_rec.election_information24
400       ,p_election_information25
401       => p_rec.election_information25
402       ,p_election_information26
403       => p_rec.election_information26
404       ,p_election_information27
405       => p_rec.election_information27
406       ,p_election_information28
407       => p_rec.election_information28
408       ,p_election_information29
409       => p_rec.election_information29
410       ,p_election_information30
411       => p_rec.election_information30
412       ,p_object_version_number
413       => p_rec.object_version_number
414       ,p_business_group_id_o
415       => per_elc_shd.g_old_rec.business_group_id
416       ,p_election_date_o
417       => per_elc_shd.g_old_rec.election_date
418       ,p_description_o
419       => per_elc_shd.g_old_rec.description
420       ,p_rep_body_id_o
421       => per_elc_shd.g_old_rec.rep_body_id
422       ,p_previous_election_date_o
423       => per_elc_shd.g_old_rec.previous_election_date
424       ,p_next_election_date_o
425       => per_elc_shd.g_old_rec.next_election_date
426       ,p_result_publish_date_o
427       => per_elc_shd.g_old_rec.result_publish_date
428       ,p_attribute_category_o
429       => per_elc_shd.g_old_rec.attribute_category
430       ,p_attribute1_o
431       => per_elc_shd.g_old_rec.attribute1
432       ,p_attribute2_o
433       => per_elc_shd.g_old_rec.attribute2
434       ,p_attribute3_o
435       => per_elc_shd.g_old_rec.attribute3
436       ,p_attribute4_o
437       => per_elc_shd.g_old_rec.attribute4
438       ,p_attribute5_o
439       => per_elc_shd.g_old_rec.attribute5
440       ,p_attribute6_o
441       => per_elc_shd.g_old_rec.attribute6
442       ,p_attribute7_o
443       => per_elc_shd.g_old_rec.attribute7
444       ,p_attribute8_o
445       => per_elc_shd.g_old_rec.attribute8
446       ,p_attribute9_o
447       => per_elc_shd.g_old_rec.attribute9
448       ,p_attribute10_o
449       => per_elc_shd.g_old_rec.attribute10
450       ,p_attribute11_o
451       => per_elc_shd.g_old_rec.attribute11
452       ,p_attribute12_o
453       => per_elc_shd.g_old_rec.attribute12
454       ,p_attribute13_o
455       => per_elc_shd.g_old_rec.attribute13
456       ,p_attribute14_o
457       => per_elc_shd.g_old_rec.attribute14
458       ,p_attribute15_o
459       => per_elc_shd.g_old_rec.attribute15
460       ,p_attribute16_o
461       => per_elc_shd.g_old_rec.attribute16
462       ,p_attribute17_o
463       => per_elc_shd.g_old_rec.attribute17
464       ,p_attribute18_o
465       => per_elc_shd.g_old_rec.attribute18
466       ,p_attribute19_o
467       => per_elc_shd.g_old_rec.attribute19
468       ,p_attribute20_o
469       => per_elc_shd.g_old_rec.attribute20
470       ,p_attribute21_o
471       => per_elc_shd.g_old_rec.attribute21
472       ,p_attribute22_o
473       => per_elc_shd.g_old_rec.attribute22
474       ,p_attribute23_o
475       => per_elc_shd.g_old_rec.attribute23
476       ,p_attribute24_o
477       => per_elc_shd.g_old_rec.attribute24
478       ,p_attribute25_o
479       => per_elc_shd.g_old_rec.attribute25
480       ,p_attribute26_o
481       => per_elc_shd.g_old_rec.attribute26
482       ,p_attribute27_o
483       => per_elc_shd.g_old_rec.attribute27
484       ,p_attribute28_o
485       => per_elc_shd.g_old_rec.attribute28
486       ,p_attribute29_o
487       => per_elc_shd.g_old_rec.attribute29
488       ,p_attribute30_o
489       => per_elc_shd.g_old_rec.attribute30
490       ,p_election_info_category_o
491       => per_elc_shd.g_old_rec.election_info_category
492       ,p_election_information1_o
493       => per_elc_shd.g_old_rec.election_information1
494       ,p_election_information2_o
495       => per_elc_shd.g_old_rec.election_information2
496       ,p_election_information3_o
497       => per_elc_shd.g_old_rec.election_information3
498       ,p_election_information4_o
499       => per_elc_shd.g_old_rec.election_information4
500       ,p_election_information5_o
501       => per_elc_shd.g_old_rec.election_information5
502       ,p_election_information6_o
503       => per_elc_shd.g_old_rec.election_information6
504       ,p_election_information7_o
505       => per_elc_shd.g_old_rec.election_information7
506       ,p_election_information8_o
507       => per_elc_shd.g_old_rec.election_information8
508       ,p_election_information9_o
509       => per_elc_shd.g_old_rec.election_information9
510       ,p_election_information10_o
511       => per_elc_shd.g_old_rec.election_information10
512       ,p_election_information11_o
513       => per_elc_shd.g_old_rec.election_information11
514       ,p_election_information12_o
515       => per_elc_shd.g_old_rec.election_information12
516       ,p_election_information13_o
517       => per_elc_shd.g_old_rec.election_information13
518       ,p_election_information14_o
519       => per_elc_shd.g_old_rec.election_information14
520       ,p_election_information15_o
521       => per_elc_shd.g_old_rec.election_information15
522       ,p_election_information16_o
523       => per_elc_shd.g_old_rec.election_information16
524       ,p_election_information17_o
525       => per_elc_shd.g_old_rec.election_information17
526       ,p_election_information18_o
527       => per_elc_shd.g_old_rec.election_information18
528       ,p_election_information19_o
529       => per_elc_shd.g_old_rec.election_information19
530       ,p_election_information20_o
531       => per_elc_shd.g_old_rec.election_information20
532       ,p_election_information21_o
533       => per_elc_shd.g_old_rec.election_information21
534       ,p_election_information22_o
535       => per_elc_shd.g_old_rec.election_information22
536       ,p_election_information23_o
537       => per_elc_shd.g_old_rec.election_information23
538       ,p_election_information24_o
539       => per_elc_shd.g_old_rec.election_information24
540       ,p_election_information25_o
541       => per_elc_shd.g_old_rec.election_information25
542       ,p_election_information26_o
543       => per_elc_shd.g_old_rec.election_information26
544       ,p_election_information27_o
545       => per_elc_shd.g_old_rec.election_information27
546       ,p_election_information28_o
547       => per_elc_shd.g_old_rec.election_information28
548       ,p_election_information29_o
549       => per_elc_shd.g_old_rec.election_information29
550       ,p_election_information30_o
551       => per_elc_shd.g_old_rec.election_information30
552       ,p_object_version_number_o
553       => per_elc_shd.g_old_rec.object_version_number
554       );
555     --
556   exception
557     --
558     when hr_api.cannot_find_prog_unit then
559       --
560       hr_api.cannot_find_prog_unit_error
561         (p_module_name => 'PER_ELECTIONS'
562         ,p_hook_type   => 'AU');
563       --
564   end;
565   --
566   hr_utility.set_location(' Leaving:'||l_proc, 10);
567 End post_update;
568 --
569 -- ----------------------------------------------------------------------------
570 -- |-----------------------------< convert_defs >-----------------------------|
571 -- ----------------------------------------------------------------------------
572 -- {Start Of Comments}
573 --
574 -- Description:
575 --   The Convert_Defs procedure has one very important function:
576 --   It must return the record structure for the row with all system defaulted
577 --   values converted into its corresponding parameter value for update. When
578 --   we attempt to update a row through the Upd process , certain
579 --   parameters can be defaulted which enables flexibility in the calling of
580 --   the upd process (e.g. only attributes which need to be updated need to be
581 --   specified). For the upd process to determine which attributes
582 --   have NOT been specified we need to check if the parameter has a reserved
583 --   system default value. Therefore, for all parameters which have a
584 --   corresponding reserved system default mechanism specified we need to
585 --   check if a system default is being used. If a system default is being
586 --   used then we convert the defaulted value into its corresponding attribute
587 --   value held in the g_old_rec data structure.
588 --
589 -- Prerequisites:
590 --   This private function can only be called from the upd process.
591 --
592 -- In Parameters:
593 --   A Pl/Sql record structure.
594 --
595 -- Post Success:
596 --   The record structure will be returned with all system defaulted parameter
597 --   values converted into its current row attribute value.
598 --
599 -- Post Failure:
600 --   No direct error handling is required within this function. Any possible
601 --   errors within this procedure will be a PL/SQL value error due to
602 --   conversion of datatypes or data lengths.
603 --
604 -- Developer Implementation Notes:
605 --   None.
606 --
607 -- Access Status:
608 --   Internal Row Handler Use Only.
609 --
610 -- {End Of Comments}
611 -- ----------------------------------------------------------------------------
612 Procedure convert_defs
613   (p_rec in out nocopy per_elc_shd.g_rec_type
614   ) is
615 --
616 Begin
617   --
618   -- We must now examine each argument value in the
619   -- p_rec plsql record structure
620   -- to see if a system default is being used. If a system default
621   -- is being used then we must set to the 'current' argument value.
622   --
623   If (p_rec.business_group_id = hr_api.g_number) then
624     p_rec.business_group_id :=
625     per_elc_shd.g_old_rec.business_group_id;
626   End If;
627   If (p_rec.election_date = hr_api.g_date) then
628     p_rec.election_date :=
629     per_elc_shd.g_old_rec.election_date;
630   End If;
631   IF (p_rec.description = hr_api.g_varchar2) then
632     p_rec.description :=
633     per_elc_shd.g_old_rec.description;
634   End If;
635   If (p_rec.rep_body_id = hr_api.g_number) then
636     p_rec.rep_body_id :=
637     per_elc_shd.g_old_rec.rep_body_id;
638   End If;
639   If (p_rec.previous_election_date = hr_api.g_date) then
640     p_rec.previous_election_date :=
641     per_elc_shd.g_old_rec.previous_election_date;
642   End If;
643   If (p_rec.next_election_date = hr_api.g_date) then
644     p_rec.next_election_date :=
645     per_elc_shd.g_old_rec.next_election_date;
646   End If;
647   If (p_rec.result_publish_date = hr_api.g_date) then
648     p_rec.result_publish_date :=
649     per_elc_shd.g_old_rec.result_publish_date;
650   End If;
651   If (p_rec.attribute_category = hr_api.g_varchar2) then
652     p_rec.attribute_category :=
653     per_elc_shd.g_old_rec.attribute_category;
654   End If;
655   If (p_rec.attribute1 = hr_api.g_varchar2) then
656     p_rec.attribute1 :=
657     per_elc_shd.g_old_rec.attribute1;
658   End If;
659   If (p_rec.attribute2 = hr_api.g_varchar2) then
660     p_rec.attribute2 :=
661     per_elc_shd.g_old_rec.attribute2;
662   End If;
663   If (p_rec.attribute3 = hr_api.g_varchar2) then
664     p_rec.attribute3 :=
665     per_elc_shd.g_old_rec.attribute3;
666   End If;
667   If (p_rec.attribute4 = hr_api.g_varchar2) then
668     p_rec.attribute4 :=
669     per_elc_shd.g_old_rec.attribute4;
670   End If;
671   If (p_rec.attribute5 = hr_api.g_varchar2) then
672     p_rec.attribute5 :=
673     per_elc_shd.g_old_rec.attribute5;
674   End If;
675   If (p_rec.attribute6 = hr_api.g_varchar2) then
676     p_rec.attribute6 :=
677     per_elc_shd.g_old_rec.attribute6;
678   End If;
679   If (p_rec.attribute7 = hr_api.g_varchar2) then
680     p_rec.attribute7 :=
681     per_elc_shd.g_old_rec.attribute7;
682   End If;
683   If (p_rec.attribute8 = hr_api.g_varchar2) then
684     p_rec.attribute8 :=
685     per_elc_shd.g_old_rec.attribute8;
686   End If;
687   If (p_rec.attribute9 = hr_api.g_varchar2) then
688     p_rec.attribute9 :=
689     per_elc_shd.g_old_rec.attribute9;
690   End If;
691   If (p_rec.attribute10 = hr_api.g_varchar2) then
692     p_rec.attribute10 :=
693     per_elc_shd.g_old_rec.attribute10;
694   End If;
695   If (p_rec.attribute11 = hr_api.g_varchar2) then
696     p_rec.attribute11 :=
697     per_elc_shd.g_old_rec.attribute11;
698   End If;
699   If (p_rec.attribute12 = hr_api.g_varchar2) then
700     p_rec.attribute12 :=
701     per_elc_shd.g_old_rec.attribute12;
702   End If;
703   If (p_rec.attribute13 = hr_api.g_varchar2) then
704     p_rec.attribute13 :=
705     per_elc_shd.g_old_rec.attribute13;
706   End If;
707   If (p_rec.attribute14 = hr_api.g_varchar2) then
708     p_rec.attribute14 :=
709     per_elc_shd.g_old_rec.attribute14;
710   End If;
711   If (p_rec.attribute15 = hr_api.g_varchar2) then
712     p_rec.attribute15 :=
713     per_elc_shd.g_old_rec.attribute15;
714   End If;
715   If (p_rec.attribute16 = hr_api.g_varchar2) then
716     p_rec.attribute16 :=
717     per_elc_shd.g_old_rec.attribute16;
718   End If;
719   If (p_rec.attribute17 = hr_api.g_varchar2) then
720     p_rec.attribute17 :=
721     per_elc_shd.g_old_rec.attribute17;
722   End If;
723   If (p_rec.attribute18 = hr_api.g_varchar2) then
724     p_rec.attribute18 :=
725     per_elc_shd.g_old_rec.attribute18;
726   End If;
727   If (p_rec.attribute19 = hr_api.g_varchar2) then
728     p_rec.attribute19 :=
729     per_elc_shd.g_old_rec.attribute19;
730   End If;
731   If (p_rec.attribute20 = hr_api.g_varchar2) then
732     p_rec.attribute20 :=
733     per_elc_shd.g_old_rec.attribute20;
734   End If;
735   If (p_rec.attribute21 = hr_api.g_varchar2) then
736     p_rec.attribute21 :=
737     per_elc_shd.g_old_rec.attribute21;
738   End If;
739   If (p_rec.attribute22 = hr_api.g_varchar2) then
740     p_rec.attribute22 :=
741     per_elc_shd.g_old_rec.attribute22;
742   End If;
743   If (p_rec.attribute23 = hr_api.g_varchar2) then
744     p_rec.attribute23 :=
745     per_elc_shd.g_old_rec.attribute23;
746   End If;
747   If (p_rec.attribute24 = hr_api.g_varchar2) then
748     p_rec.attribute24 :=
749     per_elc_shd.g_old_rec.attribute24;
750   End If;
751   If (p_rec.attribute25 = hr_api.g_varchar2) then
752     p_rec.attribute25 :=
753     per_elc_shd.g_old_rec.attribute25;
754   End If;
755   If (p_rec.attribute26 = hr_api.g_varchar2) then
756     p_rec.attribute26 :=
757     per_elc_shd.g_old_rec.attribute26;
758   End If;
759   If (p_rec.attribute27 = hr_api.g_varchar2) then
760     p_rec.attribute27 :=
761     per_elc_shd.g_old_rec.attribute27;
762   End If;
763   If (p_rec.attribute28 = hr_api.g_varchar2) then
764     p_rec.attribute28 :=
765     per_elc_shd.g_old_rec.attribute28;
766   End If;
767   If (p_rec.attribute29 = hr_api.g_varchar2) then
768     p_rec.attribute29 :=
769     per_elc_shd.g_old_rec.attribute29;
770   End If;
771   If (p_rec.attribute30 = hr_api.g_varchar2) then
772     p_rec.attribute30 :=
773     per_elc_shd.g_old_rec.attribute30;
774   End If;
775   If (p_rec.election_info_category = hr_api.g_varchar2) then
776     p_rec.election_info_category :=
777     per_elc_shd.g_old_rec.election_info_category;
778   End If;
779   If (p_rec.election_information1 = hr_api.g_varchar2) then
780     p_rec.election_information1 :=
781     per_elc_shd.g_old_rec.election_information1;
782   End If;
783   If (p_rec.election_information2 = hr_api.g_varchar2) then
784     p_rec.election_information2 :=
785     per_elc_shd.g_old_rec.election_information2;
786   End If;
787   If (p_rec.election_information3 = hr_api.g_varchar2) then
788     p_rec.election_information3 :=
789     per_elc_shd.g_old_rec.election_information3;
790   End If;
791   If (p_rec.election_information4 = hr_api.g_varchar2) then
792     p_rec.election_information4 :=
793     per_elc_shd.g_old_rec.election_information4;
794   End If;
795   If (p_rec.election_information5 = hr_api.g_varchar2) then
796     p_rec.election_information5 :=
797     per_elc_shd.g_old_rec.election_information5;
798   End If;
799   If (p_rec.election_information6 = hr_api.g_varchar2) then
800     p_rec.election_information6 :=
801     per_elc_shd.g_old_rec.election_information6;
802   End If;
803   If (p_rec.election_information7 = hr_api.g_varchar2) then
804     p_rec.election_information7 :=
805     per_elc_shd.g_old_rec.election_information7;
806   End If;
807   If (p_rec.election_information8 = hr_api.g_varchar2) then
808     p_rec.election_information8 :=
809     per_elc_shd.g_old_rec.election_information8;
810   End If;
811   If (p_rec.election_information9 = hr_api.g_varchar2) then
812     p_rec.election_information9 :=
813     per_elc_shd.g_old_rec.election_information9;
814   End If;
815   If (p_rec.election_information10 = hr_api.g_varchar2) then
816     p_rec.election_information10 :=
817     per_elc_shd.g_old_rec.election_information10;
818   End If;
819   If (p_rec.election_information11 = hr_api.g_varchar2) then
820     p_rec.election_information11 :=
821     per_elc_shd.g_old_rec.election_information11;
822   End If;
823   If (p_rec.election_information12 = hr_api.g_varchar2) then
824     p_rec.election_information12 :=
825     per_elc_shd.g_old_rec.election_information12;
826   End If;
827   If (p_rec.election_information13 = hr_api.g_varchar2) then
828     p_rec.election_information13 :=
829     per_elc_shd.g_old_rec.election_information13;
830   End If;
831   If (p_rec.election_information14 = hr_api.g_varchar2) then
832     p_rec.election_information14 :=
833     per_elc_shd.g_old_rec.election_information14;
834   End If;
835   If (p_rec.election_information15 = hr_api.g_varchar2) then
836     p_rec.election_information15 :=
837     per_elc_shd.g_old_rec.election_information15;
838   End If;
839   If (p_rec.election_information16 = hr_api.g_varchar2) then
840     p_rec.election_information16 :=
841     per_elc_shd.g_old_rec.election_information16;
842   End If;
843   If (p_rec.election_information17 = hr_api.g_varchar2) then
844     p_rec.election_information17 :=
845     per_elc_shd.g_old_rec.election_information17;
846   End If;
847   If (p_rec.election_information18 = hr_api.g_varchar2) then
848     p_rec.election_information18 :=
849     per_elc_shd.g_old_rec.election_information18;
850   End If;
851   If (p_rec.election_information19 = hr_api.g_varchar2) then
852     p_rec.election_information19 :=
853     per_elc_shd.g_old_rec.election_information19;
854   End If;
855   If (p_rec.election_information20 = hr_api.g_varchar2) then
856     p_rec.election_information20 :=
857     per_elc_shd.g_old_rec.election_information20;
858   End If;
859   If (p_rec.election_information21 = hr_api.g_varchar2) then
860     p_rec.election_information21 :=
861     per_elc_shd.g_old_rec.election_information21;
862   End If;
863   If (p_rec.election_information22 = hr_api.g_varchar2) then
864     p_rec.election_information22 :=
865     per_elc_shd.g_old_rec.election_information22;
866   End If;
867   If (p_rec.election_information23 = hr_api.g_varchar2) then
868     p_rec.election_information23 :=
869     per_elc_shd.g_old_rec.election_information23;
870   End If;
871   If (p_rec.election_information24 = hr_api.g_varchar2) then
872     p_rec.election_information24 :=
873     per_elc_shd.g_old_rec.election_information24;
874   End If;
875   If (p_rec.election_information25 = hr_api.g_varchar2) then
876     p_rec.election_information25 :=
877     per_elc_shd.g_old_rec.election_information25;
878   End If;
879   If (p_rec.election_information26 = hr_api.g_varchar2) then
880     p_rec.election_information26 :=
881     per_elc_shd.g_old_rec.election_information26;
882   End If;
883   If (p_rec.election_information27 = hr_api.g_varchar2) then
884     p_rec.election_information27 :=
885     per_elc_shd.g_old_rec.election_information27;
886   End If;
887   If (p_rec.election_information28 = hr_api.g_varchar2) then
888     p_rec.election_information28 :=
889     per_elc_shd.g_old_rec.election_information28;
890   End If;
891   If (p_rec.election_information29 = hr_api.g_varchar2) then
892     p_rec.election_information29 :=
893     per_elc_shd.g_old_rec.election_information29;
894   End If;
895   If (p_rec.election_information30 = hr_api.g_varchar2) then
896     p_rec.election_information30 :=
897     per_elc_shd.g_old_rec.election_information30;
898   End If;
899   --
900 End convert_defs;
901 --
902 -- ----------------------------------------------------------------------------
903 -- |---------------------------------< upd >----------------------------------|
904 -- ----------------------------------------------------------------------------
905 Procedure upd
906   (p_effective_date               in date
907   ,p_validate				    in boolean default false
908   ,p_rec                          in out nocopy per_elc_shd.g_rec_type
909   ) is
910 --
911   l_proc  varchar2(72) := g_package||'upd';
912 --
913 Begin
914   hr_utility.set_location('Entering:'||l_proc, 5);
915   --
916   -- Determine if the business process is to be validated.
917   --
918   If p_validate then
919   --
920   -- Issue the savepoint.
921   --
922   SAVEPOINT upd_per_elc;
923   End If;
924   --
925   -- We must lock the row which we need to update.
926   --
927   per_elc_shd.lck
928     (p_rec.election_id
929     ,p_rec.object_version_number
930     );
931   --
932   -- 1. During an update system defaults are used to determine if
933   --    arguments have been defaulted or not. We must therefore
934   --    derive the full record structure values to be updated.
935   --
936   -- 2. Call the supporting update validate operations.
937   --
938   convert_defs(p_rec);
939   per_elc_bus.update_validate
940      (p_effective_date
941      ,p_rec
942      );
943   --
944   -- Call the supporting pre-update operation
945   --
946   per_elc_upd.pre_update(p_rec);
947   --
948   -- Update the row.
949   --
950   per_elc_upd.update_dml(p_rec);
951   --
952   -- Call the supporting post-update operation
953   --
954   per_elc_upd.post_update
955      (p_effective_date
956      ,p_rec
957      );
958   --
959   -- If we are validating then raise the Validate_Enabled exception
960   --
961   If p_validate then
962   Raise HR_Api.Validate_Enabled;
963   End If;
964   --
965   hr_utility.set_location(' Leaving:'||l_proc, 10);
966   Exception
967     When HR_Api.Validate_Enabled Then
968   --
969   -- As the Validate_Enabled exception has been raised
970   -- we must rollback to the savepoint
971   --
972   ROLLBACK TO upd_per_elc;
973   --
974 End upd;
975 --
976 -- ----------------------------------------------------------------------------
977 -- |---------------------------------< upd >----------------------------------|
978 -- ----------------------------------------------------------------------------
979 Procedure upd
980   (p_effective_date               in     date
981   ,p_validate                     in     boolean   default false
982   ,p_election_id                  in out nocopy number
983   ,p_object_version_number        in out nocopy number
984   ,p_business_group_id            in     number    default hr_api.g_number
985   ,p_election_date                in     date      default hr_api.g_date
986     ,p_description                in     varchar2  default hr_api.g_varchar2
987   ,p_rep_body_id                  in     number    default hr_api.g_number
988   ,p_previous_election_date       in     date      default hr_api.g_date
989   ,p_next_election_date           in     date      default hr_api.g_date
990   ,p_result_publish_date          in     date      default hr_api.g_date
991   ,p_attribute_category           in     varchar2  default hr_api.g_varchar2
992   ,p_attribute1                   in     varchar2  default hr_api.g_varchar2
993   ,p_attribute2                   in     varchar2  default hr_api.g_varchar2
994   ,p_attribute3                   in     varchar2  default hr_api.g_varchar2
995   ,p_attribute4                   in     varchar2  default hr_api.g_varchar2
996   ,p_attribute5                   in     varchar2  default hr_api.g_varchar2
997   ,p_attribute6                   in     varchar2  default hr_api.g_varchar2
998   ,p_attribute7                   in     varchar2  default hr_api.g_varchar2
999   ,p_attribute8                   in     varchar2  default hr_api.g_varchar2
1000   ,p_attribute9                   in     varchar2  default hr_api.g_varchar2
1001   ,p_attribute10                  in     varchar2  default hr_api.g_varchar2
1002   ,p_attribute11                  in     varchar2  default hr_api.g_varchar2
1003   ,p_attribute12                  in     varchar2  default hr_api.g_varchar2
1004   ,p_attribute13                  in     varchar2  default hr_api.g_varchar2
1005   ,p_attribute14                  in     varchar2  default hr_api.g_varchar2
1006   ,p_attribute15                  in     varchar2  default hr_api.g_varchar2
1007   ,p_attribute16                  in     varchar2  default hr_api.g_varchar2
1008   ,p_attribute17                  in     varchar2  default hr_api.g_varchar2
1009   ,p_attribute18                  in     varchar2  default hr_api.g_varchar2
1010   ,p_attribute19                  in     varchar2  default hr_api.g_varchar2
1011   ,p_attribute20                  in     varchar2  default hr_api.g_varchar2
1012   ,p_attribute21                  in     varchar2  default hr_api.g_varchar2
1013   ,p_attribute22                  in     varchar2  default hr_api.g_varchar2
1014   ,p_attribute23                  in     varchar2  default hr_api.g_varchar2
1015   ,p_attribute24                  in     varchar2  default hr_api.g_varchar2
1016   ,p_attribute25                  in     varchar2  default hr_api.g_varchar2
1017   ,p_attribute26                  in     varchar2  default hr_api.g_varchar2
1018   ,p_attribute27                  in     varchar2  default hr_api.g_varchar2
1019   ,p_attribute28                  in     varchar2  default hr_api.g_varchar2
1020   ,p_attribute29                  in     varchar2  default hr_api.g_varchar2
1021   ,p_attribute30                  in     varchar2  default hr_api.g_varchar2
1022   ,p_election_info_category	    in     varchar2  default hr_api.g_varchar2
1023   ,p_election_information1        in     varchar2  default hr_api.g_varchar2
1024   ,p_election_information2        in     varchar2  default hr_api.g_varchar2
1025   ,p_election_information3        in     varchar2  default hr_api.g_varchar2
1026   ,p_election_information4        in     varchar2  default hr_api.g_varchar2
1027   ,p_election_information5        in     varchar2  default hr_api.g_varchar2
1028   ,p_election_information6        in     varchar2  default hr_api.g_varchar2
1029   ,p_election_information7        in     varchar2  default hr_api.g_varchar2
1030   ,p_election_information8        in     varchar2  default hr_api.g_varchar2
1031   ,p_election_information9        in     varchar2  default hr_api.g_varchar2
1032   ,p_election_information10       in     varchar2  default hr_api.g_varchar2
1033   ,p_election_information11       in     varchar2  default hr_api.g_varchar2
1034   ,p_election_information12       in     varchar2  default hr_api.g_varchar2
1035   ,p_election_information13       in     varchar2  default hr_api.g_varchar2
1036   ,p_election_information14       in     varchar2  default hr_api.g_varchar2
1037   ,p_election_information15       in     varchar2  default hr_api.g_varchar2
1038   ,p_election_information16       in     varchar2  default hr_api.g_varchar2
1039   ,p_election_information17       in     varchar2  default hr_api.g_varchar2
1040   ,p_election_information18       in     varchar2  default hr_api.g_varchar2
1041   ,p_election_information19       in     varchar2  default hr_api.g_varchar2
1042   ,p_election_information20       in     varchar2  default hr_api.g_varchar2
1043   ,p_election_information21       in     varchar2  default hr_api.g_varchar2
1044   ,p_election_information22       in     varchar2  default hr_api.g_varchar2
1045   ,p_election_information23       in     varchar2  default hr_api.g_varchar2
1046   ,p_election_information24       in     varchar2  default hr_api.g_varchar2
1047   ,p_election_information25       in     varchar2  default hr_api.g_varchar2
1048   ,p_election_information26       in     varchar2  default hr_api.g_varchar2
1049   ,p_election_information27       in     varchar2  default hr_api.g_varchar2
1050   ,p_election_information28       in     varchar2  default hr_api.g_varchar2
1051   ,p_election_information29       in     varchar2  default hr_api.g_varchar2
1052   ,p_election_information30       in     varchar2  default hr_api.g_varchar2
1053   ) is
1054 --
1055   l_rec	  per_elc_shd.g_rec_type;
1056   l_proc  varchar2(72) := g_package||'upd';
1057 --
1058 Begin
1059   hr_utility.set_location('Entering:'||l_proc, 5);
1060   --
1061   -- Call conversion function to turn arguments into the
1062   -- l_rec structure.
1063   --
1064   l_rec :=
1065   per_elc_shd.convert_args
1066   (p_election_id
1067   ,p_business_group_id
1068   ,p_election_date
1069   ,p_description
1070   ,p_rep_body_id
1071   ,p_previous_election_date
1072   ,p_next_election_date
1073   ,p_result_publish_date
1074   ,p_attribute_category
1075   ,p_attribute1
1076   ,p_attribute2
1077   ,p_attribute3
1078   ,p_attribute4
1079   ,p_attribute5
1080   ,p_attribute6
1081   ,p_attribute7
1082   ,p_attribute8
1083   ,p_attribute9
1084   ,p_attribute10
1085   ,p_attribute11
1086   ,p_attribute12
1087   ,p_attribute13
1088   ,p_attribute14
1089   ,p_attribute15
1090   ,p_attribute16
1091   ,p_attribute17
1092   ,p_attribute18
1093   ,p_attribute19
1094   ,p_attribute20
1095   ,p_attribute21
1096   ,p_attribute22
1097   ,p_attribute23
1098   ,p_attribute24
1099   ,p_attribute25
1100   ,p_attribute26
1101   ,p_attribute27
1102   ,p_attribute28
1103   ,p_attribute29
1104   ,p_attribute30
1105   ,p_election_info_category
1106   ,p_election_information1
1107   ,p_election_information2
1108   ,p_election_information3
1109   ,p_election_information4
1110   ,p_election_information5
1111   ,p_election_information6
1112   ,p_election_information7
1113   ,p_election_information8
1114   ,p_election_information9
1115   ,p_election_information10
1116   ,p_election_information11
1117   ,p_election_information12
1118   ,p_election_information13
1119   ,p_election_information14
1120   ,p_election_information15
1121   ,p_election_information16
1122   ,p_election_information17
1123   ,p_election_information18
1124   ,p_election_information19
1125   ,p_election_information20
1126   ,p_election_information21
1127   ,p_election_information22
1128   ,p_election_information23
1129   ,p_election_information24
1130   ,p_election_information25
1131   ,p_election_information26
1132   ,p_election_information27
1133   ,p_election_information28
1134   ,p_election_information29
1135   ,p_election_information30
1136   ,p_object_version_number
1137   );
1138   --
1139   -- Having converted the arguments into the
1140   -- plsql record structure we call the corresponding record
1141   -- business process.
1142   --
1143   per_elc_upd.upd
1144      (p_effective_date
1145 	,p_validate
1146      ,l_rec
1147      );
1148   p_object_version_number := l_rec.object_version_number;
1149   --
1150   hr_utility.set_location(' Leaving:'||l_proc, 10);
1151 End upd;
1152 --
1153 end per_elc_upd;