1 Package Body per_spp_upd as
2 /* $Header: pespprhi.pkb 120.1.12000000.2 2007/08/30 07:19:59 ande noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_spp_upd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the execution of dml from the datetrack mode
17 -- of CORRECTION only. It is important to note that the object version
18 -- number is only increment by 1 because the datetrack correction is
19 -- soley for one datetracked row.
20 -- This procedure controls the actual dml update logic. The functions of this
21 -- procedure are as follows:
22 -- 1) Get the next object_version_number.
23 -- 2) To set and unset the g_api_dml status as required (as we are about to
24 -- perform dml).
25 -- 3) To update the specified row in the schema using the primary key in
26 -- the predicates.
27 -- 4) To trap any constraint violations that may have occurred.
28 -- 5) To raise any other errors.
29 --
30 -- Prerequisites:
31 -- This is an internal private procedure which must be called from the
32 -- update_dml procedure.
33 --
34 -- In Parameters:
35 -- A Pl/Sql record structure.
36 --
37 -- Post Success:
38 -- The specified row will be updated in the schema.
39 --
40 -- Post Failure:
41 -- On the update dml failure it is important to note that we always reset the
42 -- g_api_dml status to false.
43 -- If a check or unique integrity constraint violation is raised the
44 -- constraint_error procedure will be called.
45 -- If any other error is reported, the error will be raised after the
46 -- g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 -- The update 'set' arguments list should be modified if any of your
50 -- attributes are not updateable.
51 --
52 -- Access Status:
53 -- Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_update_dml
58 (p_rec in out nocopy per_spp_shd.g_rec_type
59 ,p_effective_date in date
60 ,p_datetrack_mode in varchar2
61 ,p_validation_start_date in date
62 ,p_validation_end_date in date
63 ) is
64 --
65 l_proc varchar2(72) := g_package||'dt_update_dml';
66 --
67 Begin
68 hr_utility.set_location('Entering:'||l_proc, 5);
69 --
70 If (p_datetrack_mode = hr_api.g_correction) then
71 hr_utility.set_location(l_proc, 10);
72 --
73 -- Because we are updating a row we must get the next object
74 -- version number.
75 --
76 p_rec.object_version_number :=
77 dt_api.get_object_version_number
78 (p_base_table_name => 'per_spinal_point_placements_f'
79 ,p_base_key_column => 'placement_id'
80 ,p_base_key_value => p_rec.placement_id
81 );
82 --
83 hr_utility.set_location('Entering:'||l_proc, 10);
84 hr_utility.set_location('Reason '|| p_rec.reason, 10);
85 hr_utility.set_location('Placement ID '||p_rec.placement_id, 10);
86 hr_utility.set_location('Step ID '||p_rec.step_id, 10);
87 hr_utility.set_location('OVN '||p_rec.object_version_number, 10);
88 hr_utility.set_location('Start Date '||p_validation_start_date, 10);
89 hr_utility.set_location('End Date '||p_validation_end_date, 10);
90 hr_utility.set_location('Increment Number'||p_rec.increment_number, 20);
91 per_spp_shd.g_api_dml := true; -- Set the api dml status
92 --
93 -- Update the per_spinal_point_placements_f Row
94 --
95 update per_spinal_point_placements_f
96 set
97 placement_id = p_rec.placement_id
98 ,business_group_id = p_rec.business_group_id
99 ,assignment_id = p_rec.assignment_id
100 ,step_id = p_rec.step_id
101 ,auto_increment_flag = p_rec.auto_increment_flag
102 ,parent_spine_id = p_rec.parent_spine_id
103 ,reason = p_rec.reason
104 ,request_id = p_rec.request_id
105 ,program_application_id = p_rec.program_application_id
106 ,program_id = p_rec.program_id
107 ,program_update_date = p_rec.program_update_date
108 ,increment_number = p_rec.increment_number
109 ,object_version_number = p_rec.object_version_number
110 ,information1 = p_rec.information1
111 ,information2 = p_rec.information2
112 ,information3 = p_rec.information3
113 ,information4 = p_rec.information4
114 ,information5 = p_rec.information5
115 ,information6 = p_rec.information6
116 ,information7 = p_rec.information7
117 ,information8 = p_rec.information8
118 ,information9 = p_rec.information9
119 ,information10 = p_rec.information10
120 ,information11 = p_rec.information11
121 ,information12 = p_rec.information12
122 ,information13 = p_rec.information13
123 ,information14 = p_rec.information14
124 ,information15 = p_rec.information15
125 ,information16 = p_rec.information16
126 ,information17 = p_rec.information17
127 ,information18 = p_rec.information18
128 ,information19 = p_rec.information19
129 ,information20 = p_rec.information20
130 ,information21 = p_rec.information21
131 ,information22 = p_rec.information22
132 ,information23 = p_rec.information23
133 ,information24 = p_rec.information24
134 ,information25 = p_rec.information25
135 ,information26 = p_rec.information26
136 ,information27 = p_rec.information27
137 ,information28 = p_rec.information28
138 ,information29 = p_rec.information29
139 ,information30 = p_rec.information30
140 ,information_category = p_rec.information_category
141 where placement_id = p_rec.placement_id
142 and effective_start_date = p_validation_start_date
143 and effective_end_date = p_validation_end_date;
144 --
145 per_spp_shd.g_api_dml := false; -- Unset the api dml status
146 hr_utility.set_location('Entering:'||l_proc, 15);
147 --
148 -- Set the effective start and end dates
149 --
150 p_rec.effective_start_date := p_validation_start_date;
151 p_rec.effective_end_date := p_validation_end_date;
152 End If;
153 --
154 hr_utility.set_location(' Leaving:'||l_proc, 20);
155 Exception
156 When hr_api.check_integrity_violated Then
157 -- A check constraint has been violated
158 per_spp_shd.g_api_dml := false; -- Unset the api dml status
159 per_spp_shd.constraint_error
160 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
161 When hr_api.unique_integrity_violated Then
162 -- Unique integrity has been violated
163 per_spp_shd.g_api_dml := false; -- Unset the api dml status
164 per_spp_shd.constraint_error
165 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
166 When Others Then
167 per_spp_shd.g_api_dml := false; -- Unset the api dml status
168 Raise;
169 End dt_update_dml;
170 --
171 -- ----------------------------------------------------------------------------
172 -- |------------------------------< update_dml >------------------------------|
173 -- ----------------------------------------------------------------------------
174 -- {Start Of Comments}
175 --
176 -- Description:
177 -- This procedure calls the dt_update_dml control logic which handles
178 -- the actual datetrack dml.
179 --
180 -- Prerequisites:
181 -- This is an internal private procedure which must be called from the upd
182 -- procedure.
183 --
184 -- In Parameters:
185 -- A Pl/Sql record structre.
186 --
187 -- Post Success:
188 -- Processing contines.
189 --
190 -- Post Failure:
191 -- No specific error handling is required within this procedure.
192 --
193 -- Developer Implementation Notes:
194 -- The update 'set' arguments list should be modified if any of your
195 -- attributes are not updateable.
196 --
197 -- Access Status:
198 -- Internal Row Handler Use Only.
199 --
200 -- {End Of Comments}
201 -- ----------------------------------------------------------------------------
202 Procedure update_dml
203 (p_rec in out nocopy per_spp_shd.g_rec_type
204 ,p_effective_date in date
205 ,p_datetrack_mode in varchar2
206 ,p_validation_start_date in date
207 ,p_validation_end_date in date
208 ) is
209 --
210 l_proc varchar2(72) := g_package||'update_dml';
211 --
212 Begin
213 hr_utility.set_location('Entering:'||l_proc, 5);
214 --
215 per_spp_upd.dt_update_dml
216 (p_rec => p_rec
217 ,p_effective_date => p_effective_date
218 ,p_datetrack_mode => p_datetrack_mode
219 ,p_validation_start_date => p_validation_start_date
220 ,p_validation_end_date => p_validation_end_date
221 );
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End update_dml;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |----------------------------< dt_pre_update >-----------------------------|
228 -- ----------------------------------------------------------------------------
229 -- {Start Of Comments}
230 --
231 -- Description:
232 -- The dt_pre_update procedure controls the execution
233 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
234 -- and UPDATE_CHANGE_INSERT only. The execution required is as
235 -- follows:
236 --
237 -- 1) Providing the datetrack update mode is not 'CORRECTION'
238 -- then set the effective end date of the current row (this
239 -- will be the validation_start_date - 1).
240 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
241 -- corresponding delete_dml process to delete any future rows
242 -- where the effective_start_date is greater than or equal to
243 -- the validation_start_date.
244 -- 3) Call the insert_dml process to insert the new updated row
245 -- details.
246 --
247 -- Prerequisites:
248 -- This is an internal procedure which is called from the
249 -- pre_update procedure.
250 --
251 -- In Parameters:
252 --
253 -- Post Success:
254 -- Processing continues.
255 --
256 -- Post Failure:
257 -- If an error has occurred, an error message and exception will be raised
258 -- but not handled.
259 --
260 -- Developer Implementation Notes:
261 -- This is an internal procedure which is required by Datetrack. Don't
262 -- remove or modify.
263 --
264 -- Access Status:
265 -- Internal Row Handler Use Only.
266 --
267 -- {End Of Comments}
268 -- ----------------------------------------------------------------------------
269 Procedure dt_pre_update
270 (p_rec in out nocopy per_spp_shd.g_rec_type
271 ,p_effective_date in date
272 ,p_datetrack_mode in varchar2
273 ,p_validation_start_date in date
274 ,p_validation_end_date in date
275 ) is
276 --
277 l_proc varchar2(72) := g_package||'dt_pre_update';
278 l_dummy_version_number number;
279 --
280 Begin
281 hr_utility.set_location('Entering:'||l_proc, 5);
282 If (p_datetrack_mode <> hr_api.g_correction) then
283 --
284 -- Update the current effective end date
285 --
286 per_spp_shd.upd_effective_end_date
287 (p_effective_date => p_effective_date
288 ,p_base_key_value => p_rec.placement_id
289 ,p_new_effective_end_date => (p_validation_start_date - 1)
290 ,p_validation_start_date => p_validation_start_date
291 ,p_validation_end_date => p_validation_end_date
292 ,p_object_version_number => l_dummy_version_number
293 );
294 --
295 If (p_datetrack_mode = hr_api.g_update_override) then
296 --
297 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
298 -- delete any future rows
299 --
300 per_spp_del.delete_dml
301 (p_rec => p_rec
302 ,p_effective_date => p_effective_date
303 ,p_datetrack_mode => p_datetrack_mode
304 ,p_validation_start_date => p_validation_start_date
305 ,p_validation_end_date => p_validation_end_date
306 );
307 End If;
308 --
309 -- We must now insert the updated row
310 --
311 per_spp_ins.insert_dml
312 (p_rec => p_rec
313 ,p_effective_date => p_effective_date
314 ,p_datetrack_mode => p_datetrack_mode
315 ,p_validation_start_date => p_validation_start_date
316 ,p_validation_end_date => p_validation_end_date
317 );
318 End If;
319 hr_utility.set_location(' Leaving:'||l_proc, 20);
320 End dt_pre_update;
321 --
322 -- ----------------------------------------------------------------------------
323 -- |------------------------------< pre_update >------------------------------|
324 -- ----------------------------------------------------------------------------
325 -- {Start Of Comments}
326 --
327 -- Description:
328 -- This private procedure contains any processing which is required before
329 -- the update dml.
330 --
331 -- Prerequisites:
332 -- This is an internal procedure which is called from the upd procedure.
333 --
334 -- In Parameters:
335 -- A Pl/Sql record structure.
336 --
337 -- Post Success:
338 -- Processing continues.
339 --
340 -- Post Failure:
341 -- If an error has occurred, an error message and exception will be raised
342 -- but not handled.
343 --
344 -- Developer Implementation Notes:
345 -- Any pre-processing required before the update dml is issued should be
346 -- coded within this procedure. It is important to note that any 3rd party
347 -- maintenance should be reviewed before placing in this procedure. The call
348 -- to the dt_update_dml procedure should NOT be removed.
349 --
350 -- Access Status:
351 -- Internal Row Handler Use Only.
352 --
353 -- {End Of Comments}
354 -- ----------------------------------------------------------------------------
355 Procedure pre_update
356 (p_rec in out nocopy per_spp_shd.g_rec_type
357 ,p_effective_date in date
358 ,p_datetrack_mode in varchar2
359 ,p_validation_start_date in date
360 ,p_validation_end_date in date
361 ) is
362 --
363 l_proc varchar2(72) := g_package||'pre_update';
364 --
365 Begin
366 hr_utility.set_location('Entering:'||l_proc, 5);
367 --
368 --
369 --
370 dt_pre_update
371 (p_rec => p_rec
372 ,p_effective_date => p_effective_date
373 ,p_datetrack_mode => p_datetrack_mode
374 ,p_validation_start_date => p_validation_start_date
375 ,p_validation_end_date => p_validation_end_date
376 );
377 --
378 hr_utility.set_location(' Leaving:'||l_proc, 10);
379 End pre_update;
380 --
381 -- ----------------------------------------------------------------------------
382 -- |----------------------------< post_update >-------------------------------|
383 -- ----------------------------------------------------------------------------
384 -- {Start Of Comments}
385 --
386 -- Description:
387 -- This private procedure contains any processing which is required after the
388 -- update dml.
389 --
390 -- Prerequisites:
391 -- This is an internal procedure which is called from the upd procedure.
392 --
393 -- In Parameters:
394 -- A Pl/Sql record structure.
395 --
396 -- Post Success:
397 -- Processing continues.
398 --
399 -- Post Failure:
400 -- If an error has occurred, an error message and exception will be raised
401 -- but not handled.
402 --
403 -- Developer Implementation Notes:
404 -- Any post-processing required after the update dml is issued should be
405 -- coded within this procedure. It is important to note that any 3rd party
406 -- maintenance should be reviewed before placing in this procedure.
407 --
408 -- Access Status:
409 -- Internal Row Handler Use Only.
410 --
411 -- {End Of Comments}
412 -- ----------------------------------------------------------------------------
413 Procedure post_update
414 (p_rec in per_spp_shd.g_rec_type
415 ,p_effective_date in date
416 ,p_datetrack_mode in varchar2
417 ,p_validation_start_date in date
418 ,p_validation_end_date in date
419 ) is
420 --
421 l_proc varchar2(72) := g_package||'post_update';
422 --
423 Begin
424 hr_utility.set_location('Entering:'||l_proc, 5);
425 begin
426 --
427 per_spp_rku.after_update
428 (p_effective_date
429 => p_effective_date
430 ,p_datetrack_mode
431 => p_datetrack_mode
432 ,p_validation_start_date
433 => p_validation_start_date
434 ,p_validation_end_date
435 => p_validation_end_date
436 ,p_placement_id
437 => p_rec.placement_id
438 ,p_effective_start_date
439 => p_rec.effective_start_date
440 ,p_effective_end_date
441 => p_rec.effective_end_date
442 ,p_business_group_id
443 => p_rec.business_group_id
444 ,p_assignment_id
445 => p_rec.assignment_id
446 ,p_step_id
447 => p_rec.step_id
448 ,p_auto_increment_flag
449 => p_rec.auto_increment_flag
450 ,p_parent_spine_id
451 => p_rec.parent_spine_id
452 ,p_reason
453 => p_rec.reason
454 ,p_request_id
455 => p_rec.request_id
456 ,p_program_application_id
457 => p_rec.program_application_id
458 ,p_program_id
459 => p_rec.program_id
460 ,p_program_update_date
461 => p_rec.program_update_date
462 ,p_increment_number
463 => p_rec.increment_number
464 ,p_information1 => p_rec.information1
465 ,p_information2 => p_rec.information2
466 ,p_information3 => p_rec.information3
467 ,p_information4 => p_rec.information4
468 ,p_information5 => p_rec.information5
469 ,p_information6 => p_rec.information6
470 ,p_information7 => p_rec.information7
471 ,p_information8 => p_rec.information8
472 ,p_information9 => p_rec.information9
473 ,p_information10 => p_rec.information10
474 ,p_information11 => p_rec.information11
475 ,p_information12 => p_rec.information12
476 ,p_information13 => p_rec.information13
477 ,p_information14 => p_rec.information14
478 ,p_information15 => p_rec.information15
479 ,p_information16 => p_rec.information16
480 ,p_information17 => p_rec.information17
481 ,p_information18 => p_rec.information18
482 ,p_information19 => p_rec.information19
483 ,p_information20 => p_rec.information20
484 ,p_information21 => p_rec.information21
485 ,p_information22 => p_rec.information22
486 ,p_information23 => p_rec.information23
487 ,p_information24 => p_rec.information24
488 ,p_information25 => p_rec.information25
489 ,p_information26 => p_rec.information26
490 ,p_information27 => p_rec.information27
491 ,p_information28 => p_rec.information28
492 ,p_information29 => p_rec.information29
493 ,p_information30 => p_rec.information30
494 ,p_information_category => p_rec.information_category
495 ,p_object_version_number
496 => p_rec.object_version_number
497 ,p_effective_start_date_o
498 => per_spp_shd.g_old_rec.effective_start_date
499 ,p_effective_end_date_o
500 => per_spp_shd.g_old_rec.effective_end_date
501 ,p_business_group_id_o
502 => per_spp_shd.g_old_rec.business_group_id
503 ,p_assignment_id_o
504 => per_spp_shd.g_old_rec.assignment_id
505 ,p_step_id_o
506 => per_spp_shd.g_old_rec.step_id
507 ,p_auto_increment_flag_o
508 => per_spp_shd.g_old_rec.auto_increment_flag
509 ,p_parent_spine_id_o
510 => per_spp_shd.g_old_rec.parent_spine_id
511 ,p_reason_o
512 => per_spp_shd.g_old_rec.reason
513 ,p_request_id_o
514 => per_spp_shd.g_old_rec.request_id
515 ,p_program_application_id_o
516 => per_spp_shd.g_old_rec.program_application_id
517 ,p_program_id_o
518 => per_spp_shd.g_old_rec.program_id
519 ,p_program_update_date_o
520 => per_spp_shd.g_old_rec.program_update_date
521 ,p_increment_number_o
522 => per_spp_shd.g_old_rec.increment_number
523 ,p_information1_o => per_spp_shd.g_old_rec.information1
524 ,p_information2_o => per_spp_shd.g_old_rec.information2
525 ,p_information3_o => per_spp_shd.g_old_rec.information3
526 ,p_information4_o => per_spp_shd.g_old_rec.information4
527 ,p_information5_o => per_spp_shd.g_old_rec.information5
528 ,p_information6_o => per_spp_shd.g_old_rec.information6
529 ,p_information7_o => per_spp_shd.g_old_rec.information7
530 ,p_information8_o => per_spp_shd.g_old_rec.information8
531 ,p_information9_o => per_spp_shd.g_old_rec.information9
532 ,p_information10_o => per_spp_shd.g_old_rec.information10
533 ,p_information11_o => per_spp_shd.g_old_rec.information11
534 ,p_information12_o => per_spp_shd.g_old_rec.information12
535 ,p_information13_o => per_spp_shd.g_old_rec.information13
536 ,p_information14_o => per_spp_shd.g_old_rec.information14
537 ,p_information15_o => per_spp_shd.g_old_rec.information15
538 ,p_information16_o => per_spp_shd.g_old_rec.information16
539 ,p_information17_o => per_spp_shd.g_old_rec.information17
540 ,p_information18_o => per_spp_shd.g_old_rec.information18
541 ,p_information19_o => per_spp_shd.g_old_rec.information19
542 ,p_information20_o => per_spp_shd.g_old_rec.information20
543 ,p_information21_o => per_spp_shd.g_old_rec.information21
544 ,p_information22_o => per_spp_shd.g_old_rec.information22
545 ,p_information23_o => per_spp_shd.g_old_rec.information23
546 ,p_information24_o => per_spp_shd.g_old_rec.information24
547 ,p_information25_o => per_spp_shd.g_old_rec.information25
548 ,p_information26_o => per_spp_shd.g_old_rec.information26
549 ,p_information27_o => per_spp_shd.g_old_rec.information27
550 ,p_information28_o => per_spp_shd.g_old_rec.information28
551 ,p_information29_o => per_spp_shd.g_old_rec.information29
552 ,p_information30_o => per_spp_shd.g_old_rec.information30
553 ,p_information_category_o => per_spp_shd.g_old_rec.information_category
554 ,p_object_version_number_o
555 => per_spp_shd.g_old_rec.object_version_number
556 );
557 --
558 exception
559 --
560 when hr_api.cannot_find_prog_unit then
561 --
562 hr_api.cannot_find_prog_unit_error
563 (p_module_name => 'PER_SPINAL_POINT_PLACEMENTS_F'
564 ,p_hook_type => 'AU');
565 --
566 end;
567 --
568 hr_utility.set_location(' Leaving:'||l_proc, 10);
569 End post_update;
570 --
571 -- ----------------------------------------------------------------------------
572 -- |-----------------------------< convert_defs >-----------------------------|
573 -- ----------------------------------------------------------------------------
574 -- {Start Of Comments}
575 --
576 -- Description:
577 -- The Convert_Defs procedure has one very important function:
578 -- It must return the record structure for the row with all system defaulted
579 -- values converted into its corresponding parameter value for update. When
580 -- we attempt to update a row through the Upd process , certain
581 -- parameters can be defaulted which enables flexibility in the calling of
582 -- the upd process (e.g. only attributes which need to be updated need to be
583 -- specified). For the upd process to determine which attributes
584 -- have NOT been specified we need to check if the parameter has a reserved
585 -- system default value. Therefore, for all parameters which have a
586 -- corresponding reserved system default mechanism specified we need to
587 -- check if a system default is being used. If a system default is being
588 -- used then we convert the defaulted value into its corresponding attribute
589 -- value held in the g_old_rec data structure.
590 --
591 -- Prerequisites:
592 -- This private function can only be called from the upd process.
593 --
594 -- In Parameters:
595 -- A Pl/Sql record structure.
596 --
597 -- Post Success:
598 -- The record structure will be returned with all system defaulted parameter
599 -- values converted into its current row attribute value.
600 --
601 -- Post Failure:
602 -- No direct error handling is required within this function. Any possible
603 -- errors within this procedure will be a PL/SQL value error due to
604 -- conversion of datatypes or data lengths.
605 --
606 -- Developer Implementation Notes:
607 -- None.
608 --
609 -- Access Status:
610 -- Internal Row Handler Use Only.
611 --
612 -- {End Of Comments}
613 -- ----------------------------------------------------------------------------
614 Procedure convert_defs
615 (p_rec in out nocopy per_spp_shd.g_rec_type
616 ) is
617 --
618 Begin
619 --
620 -- We must now examine each argument value in the
621 -- p_rec plsql record structure
622 -- to see if a system default is being used. If a system default
623 -- is being used then we must set to the 'current' argument value.
624 --
625 If (p_rec.business_group_id = hr_api.g_number) then
626 p_rec.business_group_id :=
627 per_spp_shd.g_old_rec.business_group_id;
628 End If;
629 If (p_rec.assignment_id = hr_api.g_number) then
630 p_rec.assignment_id :=
631 per_spp_shd.g_old_rec.assignment_id;
632 End If;
633 If (p_rec.step_id = hr_api.g_number) then
634 p_rec.step_id :=
635 per_spp_shd.g_old_rec.step_id;
636 End If;
637 If (p_rec.auto_increment_flag = hr_api.g_varchar2) then
638 p_rec.auto_increment_flag :=
639 per_spp_shd.g_old_rec.auto_increment_flag;
640 End If;
641 If (p_rec.parent_spine_id = hr_api.g_number) then
642 p_rec.parent_spine_id :=
643 per_spp_shd.g_old_rec.parent_spine_id;
644 End If;
645 If (p_rec.reason = hr_api.g_varchar2) then
646 p_rec.reason :=
647 per_spp_shd.g_old_rec.reason;
648 End If;
649 If (p_rec.request_id = hr_api.g_number) then
650 p_rec.request_id :=
651 per_spp_shd.g_old_rec.request_id;
652 End If;
653 If (p_rec.program_application_id = hr_api.g_number) then
654 p_rec.program_application_id :=
655 per_spp_shd.g_old_rec.program_application_id;
656 End If;
657 If (p_rec.program_id = hr_api.g_number) then
658 p_rec.program_id :=
659 per_spp_shd.g_old_rec.program_id;
660 End If;
661 If (p_rec.program_update_date = hr_api.g_date) then
662 p_rec.program_update_date :=
663 per_spp_shd.g_old_rec.program_update_date;
664 End If;
665 If (p_rec.increment_number = hr_api.g_number) then
666 p_rec.increment_number :=
667 per_spp_shd.g_old_rec.increment_number;
668 End If;
669 If (p_rec.information1 = hr_api.g_varchar2) then
670 p_rec.information1 := per_spp_shd.g_old_rec.information1;
671 End If;
672 If (p_rec.information2 = hr_api.g_varchar2) then
673 p_rec.information2 := per_spp_shd.g_old_rec.information2;
674 End If;
675 If (p_rec.information3 = hr_api.g_varchar2) then
676 p_rec.information3 := per_spp_shd.g_old_rec.information3;
677 End If;
678 If (p_rec.information3 = hr_api.g_varchar2) then
679 p_rec.information3 := per_spp_shd.g_old_rec.information3;
680 End If;
681 If (p_rec.information4 = hr_api.g_varchar2) then
682 p_rec.information4 := per_spp_shd.g_old_rec.information4;
683 End If;
684 If (p_rec.information5 = hr_api.g_varchar2) then
685 p_rec.information5 := per_spp_shd.g_old_rec.information5;
686 End If;
687 If (p_rec.information6 = hr_api.g_varchar2) then
688 p_rec.information6 := per_spp_shd.g_old_rec.information6;
689 End If;
690 If (p_rec.information7 = hr_api.g_varchar2) then
691 p_rec.information7 := per_spp_shd.g_old_rec.information7;
692 End If;
693 If (p_rec.information8 = hr_api.g_varchar2) then
694 p_rec.information8 := per_spp_shd.g_old_rec.information8;
695 End If;
696 If (p_rec.information9 = hr_api.g_varchar2) then
697 p_rec.information9 := per_spp_shd.g_old_rec.information9;
698 End If;
699 If (p_rec.information10 = hr_api.g_varchar2) then
700 p_rec.information10 := per_spp_shd.g_old_rec.information10;
701 End If;
702 If (p_rec.information11 = hr_api.g_varchar2) then
703 p_rec.information11 := per_spp_shd.g_old_rec.information11;
704 End If;
705 If (p_rec.information12 = hr_api.g_varchar2) then
706 p_rec.information12 := per_spp_shd.g_old_rec.information12;
707 End If;
708 If (p_rec.information13 = hr_api.g_varchar2) then
709 p_rec.information13 := per_spp_shd.g_old_rec.information13;
710 End If;
711 If (p_rec.information14 = hr_api.g_varchar2) then
712 p_rec.information14 := per_spp_shd.g_old_rec.information14;
713 End If;
714 If (p_rec.information15 = hr_api.g_varchar2) then
715 p_rec.information15 := per_spp_shd.g_old_rec.information15;
716 End If;
717 If (p_rec.information16 = hr_api.g_varchar2) then
718 p_rec.information16 := per_spp_shd.g_old_rec.information16;
719 End If;
720 If (p_rec.information17 = hr_api.g_varchar2) then
721 p_rec.information17 := per_spp_shd.g_old_rec.information17;
722 End If;
723 If (p_rec.information18 = hr_api.g_varchar2) then
724 p_rec.information18 := per_spp_shd.g_old_rec.information18;
725 End If;
726 If (p_rec.information19 = hr_api.g_varchar2) then
727 p_rec.information19 := per_spp_shd.g_old_rec.information19;
728 End If;
729 If (p_rec.information20 = hr_api.g_varchar2) then
730 p_rec.information20 := per_spp_shd.g_old_rec.information20;
731 End If;
732 If (p_rec.information21 = hr_api.g_varchar2) then
733 p_rec.information21 := per_spp_shd.g_old_rec.information21;
734 End If;
735 If (p_rec.information22 = hr_api.g_varchar2) then
736 p_rec.information22 := per_spp_shd.g_old_rec.information22;
737 End If;
738 If (p_rec.information23 = hr_api.g_varchar2) then
739 p_rec.information23 := per_spp_shd.g_old_rec.information23;
740 End If;
741 If (p_rec.information24 = hr_api.g_varchar2) then
742 p_rec.information24 := per_spp_shd.g_old_rec.information24;
743 End If;
744 If (p_rec.information25 = hr_api.g_varchar2) then
745 p_rec.information25 := per_spp_shd.g_old_rec.information25;
746 End If;
747 If (p_rec.information26 = hr_api.g_varchar2) then
748 p_rec.information26 := per_spp_shd.g_old_rec.information26;
749 End If;
750 If (p_rec.information27 = hr_api.g_varchar2) then
751 p_rec.information27 := per_spp_shd.g_old_rec.information27;
752 End If;
753 If (p_rec.information28 = hr_api.g_varchar2) then
754 p_rec.information28 := per_spp_shd.g_old_rec.information28;
755 End If;
756 If (p_rec.information29 = hr_api.g_varchar2) then
757 p_rec.information29 := per_spp_shd.g_old_rec.information29;
758 End If;
759 If (p_rec.information30 = hr_api.g_varchar2) then
760 p_rec.information30 := per_spp_shd.g_old_rec.information30;
761 End If;
762 If (p_rec.information_category = hr_api.g_varchar2) then
763 p_rec.information_category := per_spp_shd.g_old_rec.information_category;
764 End If;
765 --
766 End convert_defs;
767 --
768 -- ----------------------------------------------------------------------------
769 -- |---------------------------------< upd >----------------------------------|
770 -- ----------------------------------------------------------------------------
771 Procedure upd
772 (p_effective_date in date
773 ,p_datetrack_mode in out nocopy varchar2
774 ,p_rec in out nocopy per_spp_shd.g_rec_type
775 ) is
776 --
777 l_proc varchar2(72) := g_package||'upd';
778 l_validation_start_date date;
779 l_validation_end_date date;
780 l_datetrack_mode varchar2(30);
781 --
782 Begin
783 hr_utility.set_location('Entering:'||l_proc, 5);
784 --
785 --
786 -- Ensure that the DateTrack update mode is valid
787 --
788 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
789 --
790 -- We must lock the row which we need to update.
791 --
792 per_spp_shd.lck
793 (p_effective_date => p_effective_date
794 ,p_datetrack_mode => p_datetrack_mode
795 ,p_placement_id => p_rec.placement_id
796 ,p_object_version_number => p_rec.object_version_number
797 ,p_validation_start_date => l_validation_start_date
798 ,p_validation_end_date => l_validation_end_date
799 );
800 --
801 -- 1. During an update system defaults are used to determine if
802 -- arguments have been defaulted or not. We must therefore
803 -- derive the full record structure values to be updated.
804 --
805 -- 2. Call the supporting update validate operations.
806 --
807 per_spp_upd.convert_defs(p_rec);
808 --
809 per_spp_bus.update_validate
810 (p_rec => p_rec
811 ,p_effective_date => p_effective_date
812 ,p_datetrack_mode => p_datetrack_mode
813 ,p_validation_start_date => l_validation_start_date
814 ,p_validation_end_date => l_validation_end_date
815 );
816 --
817 -- Call the supporting pre-update operation
818 --
819 pre_update
820 (p_rec => p_rec
821 ,p_effective_date => p_effective_date
822 ,p_datetrack_mode => p_datetrack_mode
823 ,p_validation_start_date => l_validation_start_date
824 ,p_validation_end_date => l_validation_end_date
825 );
826 --
827 -- Update the row.
828 --
829 update_dml
830 (p_rec => p_rec
831 ,p_effective_date => p_effective_date
832 ,p_datetrack_mode => p_datetrack_mode
833 ,p_validation_start_date => l_validation_start_date
834 ,p_validation_end_date => l_validation_end_date
835 );
836 --
837 -- Call the supporting post-update operation
838 --
839
840 post_update
841 (p_rec => p_rec
842 ,p_effective_date => p_effective_date
843 ,p_datetrack_mode => p_datetrack_mode
844 ,p_validation_start_date => l_validation_start_date
845 ,p_validation_end_date => l_validation_end_date
846 );
847
848 End upd;
849 --
850 -- ----------------------------------------------------------------------------
851 -- |------------------------------< upd >-------------------------------------|
852 -- ----------------------------------------------------------------------------
853 Procedure upd
854 (p_effective_date in date
855 ,p_datetrack_mode in out nocopy varchar2
856 ,p_placement_id in number
857 ,p_object_version_number in out nocopy number
858 ,p_business_group_id in number
859 ,p_assignment_id in number
860 ,p_step_id in number
861 ,p_auto_increment_flag in varchar2
862 -- ,p_parent_spine_id in number
863 ,p_reason in varchar2
864 ,p_request_id in number
865 ,p_program_application_id in number
866 ,p_program_id in number
867 ,p_program_update_date in date
868 ,p_increment_number in number
869 ,p_information1 in varchar2
870 ,p_information2 in varchar2
871 ,p_information3 in varchar2
872 ,p_information4 in varchar2
873 ,p_information5 in varchar2
874 ,p_information6 in varchar2
875 ,p_information7 in varchar2
876 ,p_information8 in varchar2
877 ,p_information9 in varchar2
878 ,p_information10 in varchar2
879 ,p_information11 in varchar2
880 ,p_information12 in varchar2
881 ,p_information13 in varchar2
882 ,p_information14 in varchar2
883 ,p_information15 in varchar2
884 ,p_information16 in varchar2
885 ,p_information17 in varchar2
886 ,p_information18 in varchar2
887 ,p_information19 in varchar2
888 ,p_information20 in varchar2
889 ,p_information21 in varchar2
890 ,p_information22 in varchar2
891 ,p_information23 in varchar2
892 ,p_information24 in varchar2
893 ,p_information25 in varchar2
894 ,p_information26 in varchar2
895 ,p_information27 in varchar2
896 ,p_information28 in varchar2
897 ,p_information29 in varchar2
898 ,p_information30 in varchar2
899 ,p_information_category in varchar2
900 ,p_effective_start_date in out nocopy date
901 ,p_effective_end_date in out nocopy date
902 ) is
903 --
904 l_rec per_spp_shd.g_rec_type;
905 l_proc varchar2(72) := g_package||'upd';
906 l_parent_spine_id per_spinal_point_placements_f.parent_spine_id%TYPE;
907 --
908 Begin
909 hr_utility.set_location('Entering:'||l_proc, 5);
910 hr_utility.set_location('assignment_id :'||p_assignment_id,5);
911 hr_utility.set_location('effective_date :'||p_effective_date,5);
912 --
913 -- Get the parent_spine_id
914 --
915 select distinct parent_spine_id
916 into l_parent_spine_id
917 from per_grade_spines_f pgs,
918 per_all_assignments_f paa
919 where paa.grade_id = pgs.grade_id
920 and paa.assignment_id = p_assignment_id
921 and p_effective_date between paa.effective_start_date
922 and paa.effective_end_date
923 and p_effective_date between pgs.effective_start_date
924 and pgs.effective_end_date;
925 --
926 hr_utility.set_location('Entering:'||l_proc, 6);
927 --
928 -- Call conversion function to turn arguments into the
929 -- l_rec structure.
930 --
931 l_rec :=
932 per_spp_shd.convert_args
933 (p_placement_id
934 ,p_effective_start_date
935 ,p_effective_end_date
936 ,p_business_group_id
937 ,p_assignment_id
938 ,p_step_id
939 ,p_auto_increment_flag
940 ,l_parent_spine_id
941 ,p_reason
942 ,p_request_id
943 ,p_program_application_id
944 ,p_program_id
945 ,p_program_update_date
946 ,p_increment_number
947 ,p_information1
948 ,p_information2
949 ,p_information3
950 ,p_information4
951 ,p_information5
952 ,p_information6
953 ,p_information7
954 ,p_information8
955 ,p_information9
956 ,p_information10
957 ,p_information11
958 ,p_information12
959 ,p_information13
960 ,p_information14
961 ,p_information15
962 ,p_information16
963 ,p_information17
964 ,p_information18
965 ,p_information19
966 ,p_information20
967 ,p_information21
968 ,p_information22
969 ,p_information23
970 ,p_information24
971 ,p_information25
972 ,p_information26
973 ,p_information27
974 ,p_information28
975 ,p_information29
976 ,p_information30
977 ,p_information_category
978 ,p_object_version_number
979 );
980 hr_utility.set_location('Entering:'||l_proc, 7);
981 /*
982 select effective_start_date,effective_end_date
983 into l_rec.effective_start_date, l_rec.effective_end_date
984 from per_spinal_point_placements_f
985 where placement_id = p_placement_id
986 and p_effective_date between effective_start_date
987 and effective_end_date;
988 */
989 hr_utility.set_location('Entering:'||l_proc, 8);
990 --
991 -- Having converted the arguments into the
992 -- plsql record structure we call the corresponding record
993 -- business process.
994 --
995 per_spp_upd.upd
996 (p_effective_date
997 ,p_datetrack_mode
998 ,l_rec
999 );
1000 --
1001 -- Set the out parameters
1002 --
1003 p_object_version_number := l_rec.object_version_number;
1004 p_effective_start_date := l_rec.effective_start_date;
1005 p_effective_end_date := l_rec.effective_end_date;
1006 --
1007 --
1008 hr_utility.set_location(' Leaving:'||l_proc, 10);
1009
1010 /* added this exception for bug 6346478 which will fix 6024292.
1011 The fix for 6024292 has been reverted as it is raising bug 6346478*/
1012
1013 exception
1014 when no_data_found then
1015 hr_utility.set_message(800, 'HR_289829_NO_SPP_REC_FOR_EDATE');
1016 hr_utility.raise_error;
1017 End upd;
1018 --
1019 end per_spp_upd;