DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ADD_UPD

Source


1 Package Body per_add_upd as
2 /* $Header: peaddrhi.pkb 120.8 2011/11/15 11:36:00 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_add_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The functions of this
17 --   procedure are as follows:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Pre Conditions:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Arguments:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' arguments list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Table Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml(p_rec in out nocopy per_add_shd.g_rec_type) is
55 --
56   l_proc  varchar2(72) := g_package||'update_dml';
57 --
58 Begin
59   hr_utility.set_location('Entering:'||l_proc, 5);
60   --
61   -- Increment the object version
62   --
63   p_rec.object_version_number := p_rec.object_version_number + 1;
64   --
65 hr_utility.set_location(l_proc, 6);
66   per_add_shd.g_api_dml := true;  -- Set the api dml status
67   --
68 hr_utility.set_location(l_proc, 7);
69   -- Update the per_addresses Row
70   --
71   update per_addresses
72   set
73   address_id                        = p_rec.address_id,
74   business_group_id                 = p_rec.business_group_id,
75   person_id                         = p_rec.person_id,
76 -- 70.2 change a start.
77   date_from                         = p_rec.date_from,
78 -- 70.2 change a end.
79   derived_locale                    = p_rec.derived_locale,
80   address_line1                     = p_rec.address_line1,
81   address_line2                     = p_rec.address_line2,
82   address_line3                     = p_rec.address_line3,
83   address_type                      = p_rec.address_type,
84   comments                          = p_rec.comments,
85   country                           = p_rec.country,
86   date_to                           = p_rec.date_to,
87   postal_code                       = p_rec.postal_code,
88   region_1                          = p_rec.region_1,
89   region_2                          = p_rec.region_2,
90   region_3                          = p_rec.region_3,
91   telephone_number_1                = p_rec.telephone_number_1,
92   telephone_number_2                = p_rec.telephone_number_2,
93   telephone_number_3                = p_rec.telephone_number_3,
94   town_or_city                      = p_rec.town_or_city,
95   request_id                        = p_rec.request_id,
96   program_application_id            = p_rec.program_application_id,
97   program_id                        = p_rec.program_id,
98   program_update_date               = p_rec.program_update_date,
99   addr_attribute_category           = p_rec.addr_attribute_category,
100   addr_attribute1                   = p_rec.addr_attribute1,
101   addr_attribute2                   = p_rec.addr_attribute2,
102   addr_attribute3                   = p_rec.addr_attribute3,
103   addr_attribute4                   = p_rec.addr_attribute4,
104   addr_attribute5                   = p_rec.addr_attribute5,
105   addr_attribute6                   = p_rec.addr_attribute6,
106   addr_attribute7                   = p_rec.addr_attribute7,
107   addr_attribute8                   = p_rec.addr_attribute8,
108   addr_attribute9                   = p_rec.addr_attribute9,
109   addr_attribute10                  = p_rec.addr_attribute10,
110   addr_attribute11                  = p_rec.addr_attribute11,
111   addr_attribute12                  = p_rec.addr_attribute12,
112   addr_attribute13                  = p_rec.addr_attribute13,
113   addr_attribute14                  = p_rec.addr_attribute14,
114   addr_attribute15                  = p_rec.addr_attribute15,
115   addr_attribute16                  = p_rec.addr_attribute16,
116   addr_attribute17                  = p_rec.addr_attribute17,
117   addr_attribute18                  = p_rec.addr_attribute18,
118   addr_attribute19                  = p_rec.addr_attribute19,
119   addr_attribute20                  = p_rec.addr_attribute20,
120   add_information13                 = p_rec.add_information13,
121   add_information14                 = p_rec.add_information14,
122   add_information15                 = p_rec.add_information15,
123   add_information16                 = p_rec.add_information16,
124   add_information17                 = p_rec.add_information17,
125   add_information18                 = p_rec.add_information18,
126   add_information19                 = p_rec.add_information19,
127   add_information20                 = p_rec.add_information20,
128   party_id                          = p_rec.party_id,
129   object_version_number             = p_rec.object_version_number,
130   geometry                          = p_rec.geometry,
131 -- Start of fix for Bug #2431588
132   primary_flag			    = p_rec.primary_flag,
133 -- End of fix for Bug #2431588
134   style                             = p_rec.style
135   where address_id = p_rec.address_id;
136   --
137 hr_utility.set_location(l_proc, 8);
138   per_add_shd.g_api_dml := false;   -- Unset the api dml status
139   --
140   hr_utility.set_location(' Leaving:'||l_proc, 10);
141 --
142 Exception
143   When hr_api.check_integrity_violated Then
144     -- A check constraint has been violated
145     per_add_shd.g_api_dml := false;   -- Unset the api dml status
146     per_add_shd.constraint_error
147       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148   When hr_api.parent_integrity_violated Then
149     -- Parent integrity has been violated
150     per_add_shd.g_api_dml := false;   -- Unset the api dml status
151     per_add_shd.constraint_error
152       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153   When hr_api.unique_integrity_violated Then
154     -- Unique integrity has been violated
155     per_add_shd.g_api_dml := false;   -- Unset the api dml status
156     per_add_shd.constraint_error
157       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158   When Others Then
159     per_add_shd.g_api_dml := false;   -- Unset the api dml status
160     Raise;
161 End update_dml;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |------------------------------< pre_update >------------------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 --   This private procedure contains any processing which is required before
170 --   the update dml.
171 --
172 -- Pre Conditions:
173 --   This is an internal procedure which is called from the upd procedure.
174 --
175 -- In Arguments:
176 --   A Pl/Sql record structre.
177 --
178 -- Post Success:
179 --   Processing continues.
180 --
181 -- Post Failure:
182 --   If an error has occurred, an error message and exception will be raised
183 --   but not handled.
184 --
185 -- Developer Implementation Notes:
186 --   Any pre-processing required before the update dml is issued should be
187 --   coded within this procedure. It is important to note that any 3rd party
188 --   maintenance should be reviewed before placing in this procedure.
189 --
190 -- Access Status:
191 --   Internal Table Handler Use Only.
192 --
193 -- {End Of Comments}
194 -- ----------------------------------------------------------------------------
195 Procedure pre_update(p_rec in out nocopy per_add_shd.g_rec_type) is
196 --
197   l_proc  varchar2(72) := g_package||'pre_update';
198 --
199 Begin
200   hr_utility.set_location('Entering:'||l_proc, 5);
201 --
202   --
203   -- WWBUG 2203479.
204   -- Removed for irecruitment
205   -- Bug# 2747048. Uncommented the code as it is required now.
206   per_add_shd.derive_locale(p_rec);
207   --
208   -- Enhancement added for Location Searching
209   --
210   if( (fnd_profile.value('IRC_INSTALLED_FLAG') in ('Y','D') )and
211       (fnd_profile.value('IRC_GEOCODE_HOST')is not null)
212     ) then
213     p_rec.geometry := Irc_location_utility.address2geometry
214       (address_line1       => p_rec.address_line1
215       ,address_line2       => p_rec.address_line2
216       ,address_line3       => p_rec.address_line3
217       ,address_line4       => p_rec.town_or_city
218       ,address_line5       => p_rec.region_1
219       ,address_line6       => p_rec.region_2
220       ,address_line7       => p_rec.region_3
221       ,address_line8       => p_rec.postal_code
222       ,country             => p_rec.country
223       );
224   end if;
225 --
226   hr_utility.set_location(' Leaving:'||l_proc, 10);
227 End pre_update;
228 --
229 -- ----------------------------------------------------------------------------
230 -- |-----------------------------< post_update >------------------------------|
231 -- ----------------------------------------------------------------------------
232 -- {Start Of Comments}
233 --
234 -- Description:
235 --   This private procedure contains any processing which is required after the
236 --   update dml.
237 --
238 -- Pre Conditions:
239 --   This is an internal procedure which is called from the upd procedure.
240 --
241 -- In Arguments:
242 --   A Pl/Sql record structre.
243 --
244 -- Post Success:
245 --   Processing continues.
246 --
247 -- Post Failure:
248 --   If an error has occurred, an error message and exception will be raised
249 --   but not handled.
250 --
251 -- Developer Implementation Notes:
252 --   Any post-processing required after the update dml is issued should be
253 --   coded within this procedure. It is important to note that any 3rd party
254 --   maintenance should be reviewed before placing in this procedure.
255 --
256 -- Access Status:
257 --   Internal Table Handler Use Only.
258 --
259 -- {End Of Comments}
260 -- ----------------------------------------------------------------------------
261 Procedure post_update
262   (p_rec                in per_add_shd.g_rec_type
263   ,p_effective_date     in date
264   ,p_prflagval_override in boolean
265   ,p_validate_county  in boolean
266   )
267 is
268 
269   --
270   l_proc  varchar2(72) := g_package||'post_update';
271   --
272   --
273   -- Fix for WWBUG 1408379
274   --
275   l_old               ben_add_ler.g_add_ler_rec;
276   l_new               ben_add_ler.g_add_ler_rec;
277   --
278   -- End of Fix for WWBUG 1408379
279   --
280 Begin
281   hr_utility.set_location('Entering:'||l_proc, 5);
282   --
283   -- Start of API User Hook for post_update.
284   begin
285     per_add_rku.after_update
286       (p_address_id                   => p_rec.address_id
287       ,p_business_group_id            => p_rec.business_group_id
288       ,p_person_id                    => p_rec.person_id
289       ,p_date_from                    => p_rec.date_from
290       ,p_address_line1                => p_rec.address_line1
291       ,p_address_line2                => p_rec.address_line2
292       ,p_address_line3                => p_rec.address_line3
293       ,p_address_type                 => p_rec.address_type
294       ,p_comments                     => p_rec.comments
295       ,p_country                      => p_rec.country
296       ,p_date_to                      => p_rec.date_to
297       ,p_postal_code                  => p_rec.postal_code
298       ,p_region_1                     => p_rec.region_1
299       ,p_region_2                     => p_rec.region_2
300       ,p_region_3                     => p_rec.region_3
301       ,p_telephone_number_1           => p_rec.telephone_number_1
302       ,p_telephone_number_2           => p_rec.telephone_number_2
303       ,p_telephone_number_3           => p_rec.telephone_number_3
304       ,p_town_or_city                 => p_rec.town_or_city
305       ,p_request_id                   => p_rec.request_id
306       ,p_program_application_id       => p_rec.program_application_id
307       ,p_program_id                   => p_rec.program_id
308       ,p_program_update_date          => p_rec.program_update_date
309       ,p_addr_attribute_category      => p_rec.addr_attribute_category
310       ,p_addr_attribute1              => p_rec.addr_attribute1
311       ,p_addr_attribute2              => p_rec.addr_attribute2
312       ,p_addr_attribute3              => p_rec.addr_attribute3
313       ,p_addr_attribute4              => p_rec.addr_attribute4
314       ,p_addr_attribute5              => p_rec.addr_attribute5
315       ,p_addr_attribute6              => p_rec.addr_attribute6
316       ,p_addr_attribute7              => p_rec.addr_attribute7
317       ,p_addr_attribute8              => p_rec.addr_attribute8
318       ,p_addr_attribute9              => p_rec.addr_attribute9
319       ,p_addr_attribute10             => p_rec.addr_attribute10
320       ,p_addr_attribute11             => p_rec.addr_attribute11
321       ,p_addr_attribute12             => p_rec.addr_attribute12
322       ,p_addr_attribute13             => p_rec.addr_attribute13
323       ,p_addr_attribute14             => p_rec.addr_attribute14
324       ,p_addr_attribute15             => p_rec.addr_attribute15
325       ,p_addr_attribute16             => p_rec.addr_attribute16
326       ,p_addr_attribute17             => p_rec.addr_attribute17
327       ,p_addr_attribute18             => p_rec.addr_attribute18
328       ,p_addr_attribute19             => p_rec.addr_attribute19
329       ,p_addr_attribute20             => p_rec.addr_attribute20
330       ,p_add_information13            => p_rec.add_information13
331       ,p_add_information14            => p_rec.add_information14
332       ,p_add_information15            => p_rec.add_information15
333       ,p_add_information16            => p_rec.add_information16
334       ,p_add_information17            => p_rec.add_information17
335       ,p_add_information18            => p_rec.add_information18
336       ,p_add_information19            => p_rec.add_information19
337       ,p_add_information20            => p_rec.add_information20
338       ,p_object_version_number        => p_rec.object_version_number
339       ,p_effective_date               => p_effective_date
340       ,p_prflagval_override           => p_prflagval_override
341       ,p_validate_county              => p_validate_county
342       ,p_business_group_id_o
343           => per_add_shd.g_old_rec.business_group_id
344       ,p_person_id_o
345           => per_add_shd.g_old_rec.person_id
346       ,p_date_from_o
347           => per_add_shd.g_old_rec.date_from
348       ,p_primary_flag_o
349           => per_add_shd.g_old_rec.primary_flag
350       ,p_style_o
351           => per_add_shd.g_old_rec.style
352       ,p_address_line1_o
353           => per_add_shd.g_old_rec.address_line1
354       ,p_address_line2_o
355           => per_add_shd.g_old_rec.address_line2
356       ,p_address_line3_o
357           => per_add_shd.g_old_rec.address_line3
358       ,p_address_type_o
359           => per_add_shd.g_old_rec.address_type
360       ,p_comments_o
361           => per_add_shd.g_old_rec.comments
362       ,p_country_o
363           => per_add_shd.g_old_rec.country
364       ,p_date_to_o
365           => per_add_shd.g_old_rec.date_to
366       ,p_postal_code_o
367           => per_add_shd.g_old_rec.postal_code
368       ,p_region_1_o
369           => per_add_shd.g_old_rec.region_1
370       ,p_region_2_o
371           => per_add_shd.g_old_rec.region_2
372       ,p_region_3_o
373           => per_add_shd.g_old_rec.region_3
374       ,p_telephone_number_1_o
375           => per_add_shd.g_old_rec.telephone_number_1
376       ,p_telephone_number_2_o
377           => per_add_shd.g_old_rec.telephone_number_2
378       ,p_telephone_number_3_o
379           => per_add_shd.g_old_rec.telephone_number_3
380       ,p_town_or_city_o
381           => per_add_shd.g_old_rec.town_or_city
382       ,p_request_id_o
383           => per_add_shd.g_old_rec.request_id
384       ,p_program_application_id_o
385           => per_add_shd.g_old_rec.program_application_id
386       ,p_program_id_o
387           => per_add_shd.g_old_rec.program_id
388       ,p_program_update_date_o
389           => per_add_shd.g_old_rec.program_update_date
390       ,p_addr_attribute_category_o
391           => per_add_shd.g_old_rec.addr_attribute_category
392       ,p_addr_attribute1_o
393           => per_add_shd.g_old_rec.addr_attribute1
394       ,p_addr_attribute2_o
395           => per_add_shd.g_old_rec.addr_attribute2
396       ,p_addr_attribute3_o
397           => per_add_shd.g_old_rec.addr_attribute3
398       ,p_addr_attribute4_o
399           => per_add_shd.g_old_rec.addr_attribute4
400       ,p_addr_attribute5_o
401           => per_add_shd.g_old_rec.addr_attribute5
402       ,p_addr_attribute6_o
403           => per_add_shd.g_old_rec.addr_attribute6
404       ,p_addr_attribute7_o
405           => per_add_shd.g_old_rec.addr_attribute7
406       ,p_addr_attribute8_o
407           => per_add_shd.g_old_rec.addr_attribute8
408       ,p_addr_attribute9_o
409           => per_add_shd.g_old_rec.addr_attribute9
410       ,p_addr_attribute10_o
411           => per_add_shd.g_old_rec.addr_attribute10
412       ,p_addr_attribute11_o
413           => per_add_shd.g_old_rec.addr_attribute11
414       ,p_addr_attribute12_o
415           => per_add_shd.g_old_rec.addr_attribute12
416       ,p_addr_attribute13_o
417           => per_add_shd.g_old_rec.addr_attribute13
418       ,p_addr_attribute14_o
419           => per_add_shd.g_old_rec.addr_attribute14
420       ,p_addr_attribute15_o
421           => per_add_shd.g_old_rec.addr_attribute15
422       ,p_addr_attribute16_o
423           => per_add_shd.g_old_rec.addr_attribute16
424       ,p_addr_attribute17_o
425           => per_add_shd.g_old_rec.addr_attribute17
426       ,p_addr_attribute18_o
427           => per_add_shd.g_old_rec.addr_attribute18
428       ,p_addr_attribute19_o
429           => per_add_shd.g_old_rec.addr_attribute19
430       ,p_addr_attribute20_o
431           => per_add_shd.g_old_rec.addr_attribute20
432       ,p_add_information13_o
433           => per_add_shd.g_old_rec.add_information13
434       ,p_add_information14_o
435           => per_add_shd.g_old_rec.add_information14
436       ,p_add_information15_o
437           => per_add_shd.g_old_rec.add_information15
438       ,p_add_information16_o
439           => per_add_shd.g_old_rec.add_information16
440       ,p_add_information17_o
441           => per_add_shd.g_old_rec.add_information17
442       ,p_add_information18_o
443           => per_add_shd.g_old_rec.add_information18
444       ,p_add_information19_o
445           => per_add_shd.g_old_rec.add_information19
446       ,p_add_information20_o
447           => per_add_shd.g_old_rec.add_information20
448       ,p_object_version_number_o
449           => per_add_shd.g_old_rec.object_version_number
450       ,p_party_id_o                             -- HR/TCA merge
451           => per_add_shd.g_old_rec.party_id
452       );
453   exception
454     when hr_api.cannot_find_prog_unit then
455       hr_api.cannot_find_prog_unit_error
456         (p_module_name => 'PER_ADDRESSES'
457         ,p_hook_type   => 'AU'
458         );
459   end;
460   --
461   -- Fix for WWBUG 1408379
462   --
463   l_old.person_id := per_add_shd.g_old_rec.person_id;
464   l_old.business_group_id := per_add_shd.g_old_rec.business_group_id;
465   l_old.date_from := per_add_shd.g_old_rec.date_from;
466   l_old.date_to := per_add_shd.g_old_rec.date_to;
467   l_old.primary_flag := per_add_shd.g_old_rec.primary_flag;
468   l_old.postal_code := per_add_shd.g_old_rec.postal_code;
469   l_old.region_2 := per_add_shd.g_old_rec.region_2;
470   l_old.address_type := per_add_shd.g_old_rec.address_type;
471   l_old.address_id := per_add_shd.g_old_rec.address_id;
472   l_new.person_id := p_rec.person_id;
473   l_new.business_group_id := p_rec.business_group_id;
474   l_new.date_from := p_rec.date_from;
475   l_new.date_to := p_rec.date_to;
476   l_new.primary_flag := p_rec.primary_flag;
477   l_new.postal_code := p_rec.postal_code;
478   l_new.region_2 := p_rec.region_2;
479   l_new.address_type := p_rec.address_type;
480   l_new.address_id := p_rec.address_id;
481   --
482   ben_add_ler.ler_chk(p_old            => l_old,
483                       p_new            => l_new,
484                       p_effective_date => l_new.date_from);
485   --
486   -- End of Fix for WWBUG 1408379
487   --
488   --
489   -- End of API User Hook for post_update.
490   --
491   hr_utility.set_location(' Leaving:'||l_proc, 10);
492 End post_update;
493 --
494 -- ----------------------------------------------------------------------------
495 -- |-----------------------------< convert_defs >-----------------------------|
496 -- ----------------------------------------------------------------------------
497 -- {Start Of Comments}
498 --
499 -- Description:
500 --   The Convert_Defs function has one very important function:
501 --   It must return the record structure for the row with all system defaulted
502 --   values converted into its corresponding argument value for update. When
503 --   we attempt to update a row through the Upd business process , certain
504 --   arguments can be defaulted which enables flexibility in the calling of
505 --   the upd process (e.g. only attributes which need to be updated need to be
506 --   specified). For the upd business process to determine which attributes
507 --   have NOT been specified we need to check if the argument has a reserved
508 --   system default value. Therefore, for all attributes which have a
509 --   corresponding reserved system default mechanism specified we need to
510 --   check if a system default is being used. If a system default is being
511 --   used then we convert the defaulted value into its corresponding attribute
512 --   value held in the g_old_rec data structure.
513 --
514 -- Pre Conditions:
515 --   This private function can only be called from the upd process.
516 --
517 -- In Arguments:
518 --   A Pl/Sql record structre.
519 --
520 -- Post Success:
521 --   The record structure will be returned with all system defaulted argument
522 --   values converted into its current row attribute value.
523 --
524 -- Post Failure:
525 --   No direct error handling is required within this function. Any possible
526 --   errors within this function will be a PL/SQL value error due to conversion
527 --   of datatypes or data lengths.
528 --
529 -- Developer Implementation Notes:
530 --   None.
531 --
532 -- Access Status:
533 --   Internal Table Handler Use Only.
534 --
535 -- {End Of Comments}
536 -- ----------------------------------------------------------------------------
537 Function convert_defs(p_rec in out nocopy per_add_shd.g_rec_type)
538          Return per_add_shd.g_rec_type is
539 --
540   l_proc  varchar2(72) := g_package||'convert_defs';
541 --
542 Begin
543   --
544   hr_utility.set_location('Entering:'||l_proc, 5);
545   --
546   -- We must now examine each argument value in the
547   -- p_rec plsql record structure
548   -- to see if a system default is being used. If a system default
549   -- is being used then we must set to the 'current' argument value.
550   --
551   If (p_rec.business_group_id = hr_api.g_number) then
552     p_rec.business_group_id :=
553     per_add_shd.g_old_rec.business_group_id;
554   End If;
555   If (p_rec.person_id = hr_api.g_number) then
556     p_rec.person_id :=
557     per_add_shd.g_old_rec.person_id;
558   End If;
559   If (p_rec.date_from = hr_api.g_date) then
560     p_rec.date_from :=
561     per_add_shd.g_old_rec.date_from;
562   End If;
563   If (p_rec.primary_flag = hr_api.g_varchar2) then
564     p_rec.primary_flag :=
565     per_add_shd.g_old_rec.primary_flag;
566   End If;
567   If (p_rec.style = hr_api.g_varchar2) then
568     p_rec.style :=
569     per_add_shd.g_old_rec.style;
570   End If;
571   If (p_rec.address_line1 = hr_api.g_varchar2) then
572     p_rec.address_line1 :=
573     per_add_shd.g_old_rec.address_line1;
574   End If;
575   If (p_rec.address_line2 = hr_api.g_varchar2) then
576     p_rec.address_line2 :=
577     per_add_shd.g_old_rec.address_line2;
578   End If;
579   If (p_rec.address_line3 = hr_api.g_varchar2) then
580     p_rec.address_line3 :=
581     per_add_shd.g_old_rec.address_line3;
582   End If;
583   If (p_rec.address_type = hr_api.g_varchar2) then
584     p_rec.address_type :=
585     per_add_shd.g_old_rec.address_type;
586   End If;
587   If (p_rec.comments = hr_api.g_varchar2) then
588     p_rec.comments :=
589     per_add_shd.g_old_rec.comments;
590   End If;
591   If (p_rec.country = hr_api.g_varchar2) then
592     p_rec.country :=
593     per_add_shd.g_old_rec.country;
594   End If;
595   If (p_rec.date_to = hr_api.g_date) then
596     p_rec.date_to :=
597     per_add_shd.g_old_rec.date_to;
598   End If;
599   If (p_rec.postal_code = hr_api.g_varchar2) then
600     p_rec.postal_code :=
601     per_add_shd.g_old_rec.postal_code;
602   End If;
603   If (p_rec.region_1 = hr_api.g_varchar2) then
604     p_rec.region_1 :=
605     per_add_shd.g_old_rec.region_1;
606   End If;
607   If (p_rec.region_2 = hr_api.g_varchar2) then
608     p_rec.region_2 :=
609     per_add_shd.g_old_rec.region_2;
610   End If;
611   If (p_rec.region_3 = hr_api.g_varchar2) then
612     p_rec.region_3 :=
613     per_add_shd.g_old_rec.region_3;
614   End If;
615   If (p_rec.telephone_number_1 = hr_api.g_varchar2) then
616     p_rec.telephone_number_1 :=
617     per_add_shd.g_old_rec.telephone_number_1;
618   End If;
619   If (p_rec.telephone_number_2 = hr_api.g_varchar2) then
620     p_rec.telephone_number_2 :=
621     per_add_shd.g_old_rec.telephone_number_2;
622   End If;
623   If (p_rec.telephone_number_3 = hr_api.g_varchar2) then
624     p_rec.telephone_number_3 :=
625     per_add_shd.g_old_rec.telephone_number_3;
626   End If;
627   If (p_rec.town_or_city = hr_api.g_varchar2) then
628     p_rec.town_or_city :=
629     per_add_shd.g_old_rec.town_or_city;
630   End If;
631   If (p_rec.request_id = hr_api.g_number) then
632     p_rec.request_id :=
633     per_add_shd.g_old_rec.request_id;
634   End If;
635   If (p_rec.program_application_id = hr_api.g_number) then
636     p_rec.program_application_id :=
637     per_add_shd.g_old_rec.program_application_id;
638   End If;
639   If (p_rec.program_id = hr_api.g_number) then
640     p_rec.program_id :=
641     per_add_shd.g_old_rec.program_id;
642   End If;
643   If (p_rec.program_update_date = hr_api.g_date) then
644     p_rec.program_update_date :=
645     per_add_shd.g_old_rec.program_update_date;
646   End If;
647   If (p_rec.addr_attribute_category = hr_api.g_varchar2) then
648     p_rec.addr_attribute_category :=
649     per_add_shd.g_old_rec.addr_attribute_category;
650   End If;
651   If (p_rec.addr_attribute1 = hr_api.g_varchar2) then
652     p_rec.addr_attribute1 :=
653     per_add_shd.g_old_rec.addr_attribute1;
654   End If;
655   If (p_rec.addr_attribute2 = hr_api.g_varchar2) then
656     p_rec.addr_attribute2 :=
657     per_add_shd.g_old_rec.addr_attribute2;
658   End If;
659   If (p_rec.addr_attribute3 = hr_api.g_varchar2) then
660     p_rec.addr_attribute3 :=
661     per_add_shd.g_old_rec.addr_attribute3;
662   End If;
663   If (p_rec.addr_attribute4 = hr_api.g_varchar2) then
664     p_rec.addr_attribute4 :=
665     per_add_shd.g_old_rec.addr_attribute4;
666   End If;
667   If (p_rec.addr_attribute5 = hr_api.g_varchar2) then
668     p_rec.addr_attribute5 :=
669     per_add_shd.g_old_rec.addr_attribute5;
670   End If;
671   If (p_rec.addr_attribute6 = hr_api.g_varchar2) then
672     p_rec.addr_attribute6 :=
673     per_add_shd.g_old_rec.addr_attribute6;
674   End If;
675   If (p_rec.addr_attribute7 = hr_api.g_varchar2) then
676     p_rec.addr_attribute7 :=
677     per_add_shd.g_old_rec.addr_attribute7;
678   End If;
679   If (p_rec.addr_attribute8 = hr_api.g_varchar2) then
680     p_rec.addr_attribute8 :=
681     per_add_shd.g_old_rec.addr_attribute8;
682   End If;
683   If (p_rec.addr_attribute9 = hr_api.g_varchar2) then
684     p_rec.addr_attribute9 :=
685     per_add_shd.g_old_rec.addr_attribute9;
686   End If;
687   If (p_rec.addr_attribute10 = hr_api.g_varchar2) then
688     p_rec.addr_attribute10 :=
689     per_add_shd.g_old_rec.addr_attribute10;
690   End If;
691   If (p_rec.addr_attribute11 = hr_api.g_varchar2) then
692     p_rec.addr_attribute11 :=
693     per_add_shd.g_old_rec.addr_attribute11;
694   End If;
695   If (p_rec.addr_attribute12 = hr_api.g_varchar2) then
696     p_rec.addr_attribute12 :=
697     per_add_shd.g_old_rec.addr_attribute12;
698   End If;
699   If (p_rec.addr_attribute13 = hr_api.g_varchar2) then
700     p_rec.addr_attribute13 :=
701     per_add_shd.g_old_rec.addr_attribute13;
702   End If;
703   If (p_rec.addr_attribute14 = hr_api.g_varchar2) then
704     p_rec.addr_attribute14 :=
705     per_add_shd.g_old_rec.addr_attribute14;
706   End If;
707   If (p_rec.addr_attribute15 = hr_api.g_varchar2) then
708     p_rec.addr_attribute15 :=
709     per_add_shd.g_old_rec.addr_attribute15;
710   End If;
711   If (p_rec.addr_attribute16 = hr_api.g_varchar2) then
712     p_rec.addr_attribute16 :=
713     per_add_shd.g_old_rec.addr_attribute16;
714   End If;
715   If (p_rec.addr_attribute17 = hr_api.g_varchar2) then
716     p_rec.addr_attribute17 :=
717     per_add_shd.g_old_rec.addr_attribute17;
718   End If;
719   If (p_rec.addr_attribute18 = hr_api.g_varchar2) then
720     p_rec.addr_attribute18 :=
721     per_add_shd.g_old_rec.addr_attribute18;
722   End If;
723   If (p_rec.addr_attribute19 = hr_api.g_varchar2) then
724     p_rec.addr_attribute19 :=
725     per_add_shd.g_old_rec.addr_attribute19;
726   End If;
727   If (p_rec.addr_attribute20 = hr_api.g_varchar2) then
728     p_rec.addr_attribute20 :=
729     per_add_shd.g_old_rec.addr_attribute20;
730   End If;
731   If (p_rec.add_information13 = hr_api.g_varchar2) then
732     p_rec.add_information13 :=
733     per_add_shd.g_old_rec.add_information13;
734   End If;
735   If (p_rec.add_information14 = hr_api.g_varchar2) then
736     p_rec.add_information14 :=
737     per_add_shd.g_old_rec.add_information14;
738   End If;
739   If (p_rec.add_information15 = hr_api.g_varchar2) then
740     p_rec.add_information15 :=
741     per_add_shd.g_old_rec.add_information15;
742   End If;
743   If (p_rec.add_information16 = hr_api.g_varchar2) then
744     p_rec.add_information16 :=
745     per_add_shd.g_old_rec.add_information16;
746   End If;
747   If (p_rec.add_information17 = hr_api.g_varchar2) then
748     p_rec.add_information17 :=
749     per_add_shd.g_old_rec.add_information17;
750   End If;
751   If (p_rec.add_information18 = hr_api.g_varchar2) then
752     p_rec.add_information18 :=
753     per_add_shd.g_old_rec.add_information18;
754   End If;
755   If (p_rec.add_information19 = hr_api.g_varchar2) then
756     p_rec.add_information19 :=
757     per_add_shd.g_old_rec.add_information19;
758   End If;
759   If (p_rec.add_information20 = hr_api.g_varchar2) then
760     p_rec.add_information20 :=
761     per_add_shd.g_old_rec.add_information20;
762   End If;
763   If (p_rec.party_id = hr_api.g_number) then   -- HR/TCA merge
764     p_rec.party_id :=
765     per_add_shd.g_old_rec.party_id;
766   End If;
767 
768   --
769   -- Return the plsql record structure.
770   --
771   hr_utility.set_location(' Leaving:'||l_proc, 10);
772   Return(p_rec);
773 --
774 End convert_defs;
775 --
776 -- ----------------------------------------------------------------------------
777 -- |---------------------------------< upd >----------------------------------|
778 -- ----------------------------------------------------------------------------
779 Procedure upd
780   (p_rec                in out nocopy per_add_shd.g_rec_type
781   ,p_validate           in     boolean default false
782   ,p_effective_date     in     date
783   ,p_prflagval_override in     boolean      default false
784   ,p_validate_county    in     boolean      default true
785   ) is
786 --
787   l_proc  varchar2(72) := g_package||'upd';
788   l_convert per_add_shd.g_rec_type;
789 --
790 Begin
791   hr_utility.set_location('Entering:'||l_proc, 5);
792   --
793   -- Determine if the business process is to be validated.
794   --
795   If p_validate then
796     --
797     -- Issue the savepoint.
798     --
799     SAVEPOINT upd_per_add;
800   End If;
801   --
802   -- We must lock the row which we need to update.
803   --
804   per_add_shd.lck
805 	(
806 	p_rec.address_id,
807 	p_rec.object_version_number
808 	);
809   --
810   -- 1. During an update system defaults are used to determine if
811   --    arguments have been defaulted or not. We must therefore
812   --    derive the full record structure values to be updated.
813   --
814   -- 2. Call the supporting update validate operations.
815   --
816   l_convert := convert_defs(p_rec);
817   --
818   per_add_bus.update_validate(l_convert
819                              ,p_effective_date
820                              ,p_prflagval_override
821                              ,p_validate_county
822                              );
823   --
824   -- Call to raise any errors on multi-message list
825   hr_multi_message.end_validation_set;
826   --
827   -- Call the supporting pre-update operation
828   --
829   pre_update(p_rec);
830   --
831   -- Update the row.
832   --
833   update_dml(p_rec);
834   --
835   -- Call the supporting post-update operation
836   --
837   post_update(p_rec
838              ,p_effective_date
839              ,p_prflagval_override
840              ,p_validate_county
841              );
842   -- Call to raise any errors on multi-message list
843   hr_multi_message.end_validation_set;
844   --
845   -- If we are validating then raise the Validate_Enabled exception
846   --
847   If p_validate then
848     Raise HR_Api.Validate_Enabled;
849   End If;
850   --
851   hr_utility.set_location(' Leaving:'||l_proc, 10);
852 Exception
853   When HR_Api.Validate_Enabled Then
854     --
855     -- As the Validate_Enabled exception has been raised
856     -- we must rollback to the savepoint
857     --
858     ROLLBACK TO upd_per_add;
859 End upd;
860 --
861 -- ----------------------------------------------------------------------------
862 -- |--------------------------------< upd >-----------------------------------|
863 -- ----------------------------------------------------------------------------
864 Procedure upd
865   (
866    p_address_id               in     number
867   ,p_business_group_id            in number           default hr_api.g_number
868   ,p_person_id                    in number           default hr_api.g_number
869 -- 70.2 change a start.
870   ,p_date_from                in     date             default hr_api.g_date
871 -- 70.2 change a end.
872 -- Start of fix for Bug #2431588
873   ,p_primary_flag             in     varchar2         default hr_api.g_varchar2
874 -- End of fix for Bug #2431588
875   ,p_address_line1            in     varchar2         default hr_api.g_varchar2
876   ,p_address_line2            in     varchar2         default hr_api.g_varchar2
877   ,p_address_line3            in     varchar2         default hr_api.g_varchar2
878   ,p_address_type             in     varchar2         default hr_api.g_varchar2
879   ,p_comments                 in     clob             default hr_api.g_varchar2	-- Bug#13362792
880   ,p_country                  in     varchar2         default hr_api.g_varchar2
881   ,p_date_to                  in     date             default hr_api.g_date
882   ,p_postal_code              in     varchar2         default hr_api.g_varchar2
883   ,p_region_1                 in     varchar2         default hr_api.g_varchar2
884   ,p_region_2                 in     varchar2         default hr_api.g_varchar2
885   ,p_region_3                 in     varchar2         default hr_api.g_varchar2
886   ,p_telephone_number_1       in     varchar2         default hr_api.g_varchar2
887   ,p_telephone_number_2       in     varchar2         default hr_api.g_varchar2
888   ,p_telephone_number_3       in     varchar2         default hr_api.g_varchar2
889   ,p_town_or_city             in     varchar2         default hr_api.g_varchar2
890   ,p_request_id               in     number           default hr_api.g_number
891   ,p_program_application_id   in     number           default hr_api.g_number
892   ,p_program_id               in     number           default hr_api.g_number
893   ,p_program_update_date      in     date             default hr_api.g_date
894   ,p_addr_attribute_category  in     varchar2         default hr_api.g_varchar2
895   ,p_addr_attribute1          in     varchar2         default hr_api.g_varchar2
896   ,p_addr_attribute2          in     varchar2         default hr_api.g_varchar2
897   ,p_addr_attribute3          in     varchar2         default hr_api.g_varchar2
898   ,p_addr_attribute4          in     varchar2         default hr_api.g_varchar2
899   ,p_addr_attribute5          in     varchar2         default hr_api.g_varchar2
900   ,p_addr_attribute6          in     varchar2         default hr_api.g_varchar2
901   ,p_addr_attribute7          in     varchar2         default hr_api.g_varchar2
902   ,p_addr_attribute8          in     varchar2         default hr_api.g_varchar2
903   ,p_addr_attribute9          in     varchar2         default hr_api.g_varchar2
904   ,p_addr_attribute10         in     varchar2         default hr_api.g_varchar2
905   ,p_addr_attribute11         in     varchar2         default hr_api.g_varchar2
906   ,p_addr_attribute12         in     varchar2         default hr_api.g_varchar2
907   ,p_addr_attribute13         in     varchar2         default hr_api.g_varchar2
908   ,p_addr_attribute14         in     varchar2         default hr_api.g_varchar2
909   ,p_addr_attribute15         in     varchar2         default hr_api.g_varchar2
910   ,p_addr_attribute16         in     varchar2         default hr_api.g_varchar2
911   ,p_addr_attribute17         in     varchar2         default hr_api.g_varchar2
912   ,p_addr_attribute18         in     varchar2         default hr_api.g_varchar2
913   ,p_addr_attribute19         in     varchar2         default hr_api.g_varchar2
914   ,p_addr_attribute20         in     varchar2         default hr_api.g_varchar2
915   ,p_add_information13        in     varchar2         default hr_api.g_varchar2
916   ,p_add_information14        in     varchar2         default hr_api.g_varchar2
917   ,p_add_information15        in     varchar2         default hr_api.g_varchar2
918   ,p_add_information16        in     varchar2         default hr_api.g_varchar2
919   ,p_add_information17        in     varchar2         default hr_api.g_varchar2
920   ,p_add_information18        in     varchar2         default hr_api.g_varchar2
921   ,p_add_information19        in     varchar2         default hr_api.g_varchar2
922   ,p_add_information20        in     varchar2         default hr_api.g_varchar2
923   ,p_object_version_number    in out nocopy number
924   ,p_party_id                 in     number           default hr_api.g_number
925   ,p_validate                 in     boolean      default false
926   ,p_effective_date           in     date
927   ,p_prflagval_override       in     boolean      default false
928   ,p_validate_county          in     boolean      default true
929   ,p_style                    in     varchar2         default hr_api.g_varchar2
930   ) is
931 --
932   l_rec	  per_add_shd.g_rec_type;
933   l_proc  varchar2(72) := g_package||'upd';
934 --
935 Begin
936   hr_utility.set_location('Entering:'||l_proc, 5);
937   --
938   -- Call conversion function to turn arguments into the
939   -- l_rec structure.
940   --
941   l_rec :=
942   per_add_shd.convert_args
943   (
944   p_address_id,
945 -- 70.2 change a start.
946   p_business_group_id,
947   p_person_id,
948 --  hr_api.g_number,
949 --  hr_api.g_number,
950   p_date_from,
951 -- Start of fix for Bug #2431588
952   p_primary_flag,
953 -- End of fix for Bug #2431588
954   p_style,
955 -- 70.2 change a end.
956   p_address_line1,
957   p_address_line2,
958   p_address_line3,
959   p_address_type,
960   p_comments,
961   p_country,
962   p_date_to,
963   p_postal_code,
964   p_region_1,
965   p_region_2,
966   p_region_3,
967   p_telephone_number_1,
968   p_telephone_number_2,
969   p_telephone_number_3,
970   p_town_or_city,
971   p_request_id,
972   p_program_application_id,
973   p_program_id,
974   p_program_update_date,
975   p_addr_attribute_category,
976   p_addr_attribute1,
977   p_addr_attribute2,
978   p_addr_attribute3,
979   p_addr_attribute4,
980   p_addr_attribute5,
981   p_addr_attribute6,
982   p_addr_attribute7,
983   p_addr_attribute8,
984   p_addr_attribute9,
985   p_addr_attribute10,
986   p_addr_attribute11,
987   p_addr_attribute12,
988   p_addr_attribute13,
989   p_addr_attribute14,
990   p_addr_attribute15,
991   p_addr_attribute16,
992   p_addr_attribute17,
993   p_addr_attribute18,
994   p_addr_attribute19,
995   p_addr_attribute20,
996   p_add_information13,
997   p_add_information14,
998   p_add_information15,
999   p_add_information16,
1000   p_add_information17,
1001   p_add_information18,
1002   p_add_information19,
1003   p_add_information20,
1004   p_object_version_number,
1005   p_party_id  -- HR/TCA merge
1006   );
1007   --
1008   -- Having converted the arguments into the
1009   -- plsql record structure we call the corresponding record
1010   -- business process.
1011   --
1012   upd(l_rec
1013      ,p_validate
1014      ,p_effective_date
1015      ,p_prflagval_override
1016      ,p_validate_county
1017      );
1018   p_object_version_number := l_rec.object_version_number;
1019   --
1020   hr_utility.set_location(' Leaving:'||l_proc, 10);
1021 End upd;
1022 --
1023 end per_add_upd;