[Home] [Help]
PACKAGE BODY: APPS.BEN_CCT_SHD
Source
1 Package Body ben_cct_shd as
2 /* $Header: becctrhi.pkb 120.0 2005/05/28 00:58:57 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_cct_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'AVCON_BEN_C_WHNVR_000') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 ElsIf (p_constraint_name = 'BEN_CM_TYP_F_PK') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 Else
47 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50 hr_utility.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (p_effective_date in date,
61 p_cm_typ_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 cm_typ_id,
71 effective_start_date,
72 effective_end_date,
73 name,
74 desc_txt,
75 cm_typ_rl,
76 cm_usg_cd,
77 whnvr_trgrd_flag,
78 shrt_name,
79 pc_kit_cd,
80 trk_mlg_flag,
81 mx_num_avlbl_val,
82 to_be_sent_dt_cd,
83 to_be_sent_dt_rl,
84 inspn_rqd_flag,
85 inspn_rqd_rl,
86 rcpent_cd,
87 parnt_cm_typ_id,
88 business_group_id,
89 cct_attribute_category,
90 cct_attribute1,
91 cct_attribute10,
92 cct_attribute11,
93 cct_attribute12,
94 cct_attribute13,
95 cct_attribute14,
96 cct_attribute15,
97 cct_attribute16,
98 cct_attribute17,
99 cct_attribute18,
100 cct_attribute19,
101 cct_attribute2,
102 cct_attribute20,
103 cct_attribute21,
104 cct_attribute22,
105 cct_attribute23,
106 cct_attribute24,
107 cct_attribute25,
108 cct_attribute26,
109 cct_attribute27,
110 cct_attribute28,
111 cct_attribute29,
112 cct_attribute3,
113 cct_attribute30,
114 cct_attribute4,
115 cct_attribute5,
116 cct_attribute6,
117 cct_attribute7,
118 cct_attribute8,
119 cct_attribute9,
120 object_version_number
121 from ben_cm_typ_f
122 where cm_typ_id = p_cm_typ_id
123 and p_effective_date
124 between effective_start_date and effective_end_date;
125 --
126 l_proc varchar2(72) := g_package||'api_updating';
127 l_fct_ret boolean;
128 --
129 Begin
130 hr_utility.set_location('Entering:'||l_proc, 5);
131 --
132 If (p_effective_date is null or
133 p_cm_typ_id is null or
134 p_object_version_number is null) Then
135 --
136 -- One of the primary key arguments is null therefore we must
137 -- set the returning function value to false
138 --
139 l_fct_ret := false;
140 Else
141 If (p_cm_typ_id = g_old_rec.cm_typ_id and
142 p_object_version_number = g_old_rec.object_version_number) Then
143 hr_utility.set_location(l_proc, 10);
144 --
145 -- The g_old_rec is current therefore we must
146 -- set the returning function to true
147 --
148 l_fct_ret := true;
149 Else
150 --
151 -- Select the current row
152 --
153 Open C_Sel1;
154 Fetch C_Sel1 Into g_old_rec;
155 If C_Sel1%notfound Then
156 Close C_Sel1;
157 --
158 -- The primary key is invalid therefore we must error
159 --
160 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
161 hr_utility.raise_error;
162 End If;
163 Close C_Sel1;
164 If (p_object_version_number <> g_old_rec.object_version_number) Then
165 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
166 hr_utility.raise_error;
167 End If;
168 hr_utility.set_location(l_proc, 15);
169 l_fct_ret := true;
170 End If;
171 End If;
172 hr_utility.set_location(' Leaving:'||l_proc, 20);
173 Return (l_fct_ret);
174 --
175 End api_updating;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |--------------------------< find_dt_del_modes >---------------------------|
179 -- ----------------------------------------------------------------------------
180 Procedure find_dt_del_modes
181 (p_effective_date in date,
182 p_base_key_value in number,
183 p_zap out nocopy boolean,
184 p_delete out nocopy boolean,
185 p_future_change out nocopy boolean,
186 p_delete_next_change out nocopy boolean) is
187 --
188 l_proc varchar2(72) := g_package||'find_dt_del_modes';
189 --
190 l_parent_key_value1 number;
191 --
192 Cursor C_Sel1 Is
193 select t.parnt_cm_typ_id
194 from ben_cm_typ_f t
195 where t.cm_typ_id = p_base_key_value
196 and p_effective_date
197 between t.effective_start_date and t.effective_end_date;
198 --
199 Begin
200 hr_utility.set_location('Entering:'||l_proc, 5);
201 Open C_Sel1;
202 Fetch C_Sel1 Into l_parent_key_value1;
203 If C_Sel1%notfound then
204 Close C_Sel1;
205 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
206 hr_utility.set_message_token('PROCEDURE', l_proc);
207 hr_utility.set_message_token('STEP','10');
208 hr_utility.raise_error;
209 End If;
210 Close C_Sel1;
211 --
212 -- Call the corresponding datetrack api
213 --
214 dt_api.find_dt_del_modes
215 (p_effective_date => p_effective_date,
216 p_base_table_name => 'ben_cm_typ_f',
217 p_base_key_column => 'cm_typ_id',
218 p_base_key_value => p_base_key_value,
219 p_parent_table_name1 => 'ben_cm_typ_f',
220 p_parent_key_column1 => 'cm_typ_id',
221 p_parent_key_value1 => l_parent_key_value1,
222 p_zap => p_zap,
223 p_delete => p_delete,
224 p_future_change => p_future_change,
225 p_delete_next_change => p_delete_next_change);
226 --
227 hr_utility.set_location(' Leaving:'||l_proc, 10);
228 End find_dt_del_modes;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |--------------------------< find_dt_upd_modes >---------------------------|
232 -- ----------------------------------------------------------------------------
233 Procedure find_dt_upd_modes
234 (p_effective_date in date,
235 p_base_key_value in number,
236 p_correction out nocopy boolean,
237 p_update out nocopy boolean,
238 p_update_override out nocopy boolean,
239 p_update_change_insert out nocopy boolean) is
240 --
241 l_proc varchar2(72) := g_package||'find_dt_upd_modes';
242 --
243 Begin
244 hr_utility.set_location('Entering:'||l_proc, 5);
245 --
246 -- Call the corresponding datetrack api
247 --
248 dt_api.find_dt_upd_modes
249 (p_effective_date => p_effective_date,
250 p_base_table_name => 'ben_cm_typ_f',
251 p_base_key_column => 'cm_typ_id',
252 p_base_key_value => p_base_key_value,
253 p_correction => p_correction,
254 p_update => p_update,
255 p_update_override => p_update_override,
256 p_update_change_insert => p_update_change_insert);
257 --
258 hr_utility.set_location(' Leaving:'||l_proc, 10);
259 End find_dt_upd_modes;
260 --
261 -- ----------------------------------------------------------------------------
262 -- |------------------------< upd_effective_end_date >------------------------|
263 -- ----------------------------------------------------------------------------
264 Procedure upd_effective_end_date
265 (p_effective_date in date,
266 p_base_key_value in number,
267 p_new_effective_end_date in date,
268 p_validation_start_date in date,
269 p_validation_end_date in date,
270 p_object_version_number out nocopy number) is
271 --
272 l_proc varchar2(72) := g_package||'upd_effective_end_date';
273 l_object_version_number number;
274 --
275 Begin
276 hr_utility.set_location('Entering:'||l_proc, 5);
277 --
278 -- Because we are updating a row we must get the next object
279 -- version number.
280 --
281 l_object_version_number :=
282 dt_api.get_object_version_number
283 (p_base_table_name => 'ben_cm_typ_f',
284 p_base_key_column => 'cm_typ_id',
285 p_base_key_value => p_base_key_value);
286 --
287 hr_utility.set_location(l_proc, 10);
288 g_api_dml := true; -- Set the api dml status
289 --
290 -- Update the specified datetrack row setting the effective
291 -- end date to the specified new effective end date.
292 --
293 update ben_cm_typ_f t
294 set t.effective_end_date = p_new_effective_end_date,
295 t.object_version_number = l_object_version_number
296 where t.cm_typ_id = p_base_key_value
297 and p_effective_date
298 between t.effective_start_date and t.effective_end_date;
299 --
300 update ben_cm_typ_f_tl t
301 set t.effective_end_date = p_new_effective_end_date,
302 t.last_update_date = sysdate,
303 t.last_updated_by = fnd_global.user_id,
304 t.last_update_login = fnd_global.login_id
305 where t.cm_typ_id = p_base_key_value
306 and p_effective_date
307 between t.effective_start_date and t.effective_end_date;
308 --
309 g_api_dml := false; -- Unset the api dml status
310 p_object_version_number := l_object_version_number;
311 hr_utility.set_location(' Leaving:'||l_proc, 15);
312 --
313 Exception
314 When Others Then
315 g_api_dml := false; -- Unset the api dml status
316 Raise;
317 End upd_effective_end_date;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< lck >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure lck
323 (p_effective_date in date,
324 p_datetrack_mode in varchar2,
325 p_cm_typ_id in number,
326 p_object_version_number in number,
327 p_validation_start_date out nocopy date,
328 p_validation_end_date out nocopy date) is
329 --
330 l_proc varchar2(72) := g_package||'lck';
331 l_validation_start_date date;
332 l_validation_end_date date;
333 l_object_invalid exception;
334 l_argument varchar2(30);
335 --
336 -- Cursor C_Sel1 selects the current locked row as of session date
337 -- ensuring that the object version numbers match.
338 --
339 Cursor C_Sel1 is
340 select
341 cm_typ_id,
342 effective_start_date,
343 effective_end_date,
344 name,
345 desc_txt,
346 cm_typ_rl,
347 cm_usg_cd,
348 whnvr_trgrd_flag,
349 shrt_name,
350 pc_kit_cd,
351 trk_mlg_flag,
352 mx_num_avlbl_val,
353 to_be_sent_dt_cd,
354 to_be_sent_dt_rl,
355 inspn_rqd_flag,
356 inspn_rqd_rl,
357 rcpent_cd,
358 parnt_cm_typ_id,
359 business_group_id,
360 cct_attribute_category,
361 cct_attribute1,
362 cct_attribute10,
363 cct_attribute11,
364 cct_attribute12,
365 cct_attribute13,
366 cct_attribute14,
367 cct_attribute15,
368 cct_attribute16,
369 cct_attribute17,
370 cct_attribute18,
371 cct_attribute19,
372 cct_attribute2,
373 cct_attribute20,
374 cct_attribute21,
375 cct_attribute22,
376 cct_attribute23,
377 cct_attribute24,
378 cct_attribute25,
379 cct_attribute26,
380 cct_attribute27,
381 cct_attribute28,
382 cct_attribute29,
383 cct_attribute3,
384 cct_attribute30,
385 cct_attribute4,
386 cct_attribute5,
387 cct_attribute6,
388 cct_attribute7,
389 cct_attribute8,
390 cct_attribute9,
391 object_version_number
392 from ben_cm_typ_f
393 where cm_typ_id = p_cm_typ_id
394 and p_effective_date
395 between effective_start_date and effective_end_date
396 for update nowait;
397 --
398 --
399 --
400 Begin
401 hr_utility.set_location('Entering:'||l_proc, 5);
402 --
403 -- Ensure that all the mandatory arguments are not null
404 --
405 hr_api.mandatory_arg_error(p_api_name => l_proc,
406 p_argument => 'effective_date',
407 p_argument_value => p_effective_date);
408 --
409 hr_api.mandatory_arg_error(p_api_name => l_proc,
410 p_argument => 'datetrack_mode',
414 p_argument => 'cm_typ_id',
411 p_argument_value => p_datetrack_mode);
412 --
413 hr_api.mandatory_arg_error(p_api_name => l_proc,
415 p_argument_value => p_cm_typ_id);
416 --
417 hr_api.mandatory_arg_error(p_api_name => l_proc,
418 p_argument => 'object_version_number',
419 p_argument_value => p_object_version_number);
420 --
421 -- Check to ensure the datetrack mode is not INSERT.
422 --
423 If (p_datetrack_mode <> 'INSERT') then
424 --
425 -- We must select and lock the current row.
426 --
427 Open C_Sel1;
428 Fetch C_Sel1 Into g_old_rec;
429 If C_Sel1%notfound then
430 Close C_Sel1;
431 --
432 -- The primary key is invalid therefore we must error
433 --
434 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
435 hr_utility.raise_error;
436 End If;
437 Close C_Sel1;
438 If (p_object_version_number <> g_old_rec.object_version_number) Then
439 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
440 hr_utility.raise_error;
441 End If;
442 hr_utility.set_location(l_proc, 15);
443 --
444 --
445 -- Validate the datetrack mode mode getting the validation start
446 -- and end dates for the specified datetrack operation.
447 --
448 dt_api.validate_dt_mode
449 (p_effective_date => p_effective_date,
450 p_datetrack_mode => p_datetrack_mode,
451 p_base_table_name => 'ben_cm_typ_f',
452 p_base_key_column => 'cm_typ_id',
453 p_base_key_value => p_cm_typ_id,
454 p_parent_table_name1 => 'ben_cm_typ_f',
455 p_parent_key_column1 => 'cm_typ_id',
456 p_parent_key_value1 => g_old_rec.parnt_cm_typ_id,
457 -- p_child_table_name1 => 'ben_cm_typ_f',
458 -- p_child_key_column1 => 'parnt_cm_typ_id',
459 -- p_child_table_name2 => 'ben_cm_typ_trgr_f',
460 -- p_child_key_column2 => 'cm_typ_trgr_id',
461 -- p_child_table_name3 => 'ben_cm_typ_usg_f',
462 -- p_child_key_column3 => 'cm_typ_usg_id',
463 -- p_child_table_name4 => 'ben_per_cm_f',
464 -- p_child_key_column4 => 'per_cm_id',
465 p_enforce_foreign_locking => true,
466 p_validation_start_date => l_validation_start_date,
467 p_validation_end_date => l_validation_end_date);
468 Else
469 --
470 -- We are doing a datetrack 'INSERT' which is illegal within this
471 -- procedure therefore we must error (note: to lck on insert the
472 -- private procedure ins_lck should be called).
473 --
474 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
475 hr_utility.set_message_token('PROCEDURE', l_proc);
476 hr_utility.set_message_token('STEP','20');
477 hr_utility.raise_error;
478 End If;
479 --
480 -- Set the validation start and end date OUT arguments
481 --
482 p_validation_start_date := l_validation_start_date;
483 p_validation_end_date := l_validation_end_date;
484 --
485 hr_utility.set_location(' Leaving:'||l_proc, 30);
486 --
487 -- We need to trap the ORA LOCK exception
488 --
489 Exception
490 When HR_Api.Object_Locked then
491 --
492 -- The object is locked therefore we need to supply a meaningful
493 -- error message.
494 --
495 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
496 hr_utility.set_message_token('TABLE_NAME', 'ben_cm_typ_f');
497 hr_utility.raise_error;
498 When l_object_invalid then
499 --
500 -- The object doesn't exist or is invalid
501 --
502 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
503 hr_utility.set_message_token('TABLE_NAME', 'ben_cm_typ_f');
504 hr_utility.raise_error;
505 End lck;
506 --
507 -- ----------------------------------------------------------------------------
508 -- |-----------------------------< convert_args >-----------------------------|
509 -- ----------------------------------------------------------------------------
510 Function convert_args
511 (
512 p_cm_typ_id in number,
513 p_effective_start_date in date,
514 p_effective_end_date in date,
515 p_name in varchar2,
516 p_desc_txt in varchar2,
517 p_cm_typ_rl in number,
518 p_cm_usg_cd in varchar2,
519 p_whnvr_trgrd_flag in varchar2,
520 p_shrt_name in varchar2,
521 p_pc_kit_cd in varchar2,
522 p_trk_mlg_flag in varchar2,
523 p_mx_num_avlbl_val in number,
524 p_to_be_sent_dt_cd in varchar2,
525 p_to_be_sent_dt_rl in number,
526 p_inspn_rqd_flag in varchar2,
527 p_inspn_rqd_rl in number,
528 p_rcpent_cd in varchar2,
529 p_parnt_cm_typ_id in number,
530 p_business_group_id in number,
531 p_cct_attribute_category in varchar2,
532 p_cct_attribute1 in varchar2,
533 p_cct_attribute10 in varchar2,
534 p_cct_attribute11 in varchar2,
535 p_cct_attribute12 in varchar2,
539 p_cct_attribute16 in varchar2,
536 p_cct_attribute13 in varchar2,
537 p_cct_attribute14 in varchar2,
538 p_cct_attribute15 in varchar2,
540 p_cct_attribute17 in varchar2,
541 p_cct_attribute18 in varchar2,
542 p_cct_attribute19 in varchar2,
543 p_cct_attribute2 in varchar2,
544 p_cct_attribute20 in varchar2,
545 p_cct_attribute21 in varchar2,
546 p_cct_attribute22 in varchar2,
547 p_cct_attribute23 in varchar2,
548 p_cct_attribute24 in varchar2,
549 p_cct_attribute25 in varchar2,
550 p_cct_attribute26 in varchar2,
551 p_cct_attribute27 in varchar2,
552 p_cct_attribute28 in varchar2,
553 p_cct_attribute29 in varchar2,
554 p_cct_attribute3 in varchar2,
555 p_cct_attribute30 in varchar2,
556 p_cct_attribute4 in varchar2,
557 p_cct_attribute5 in varchar2,
558 p_cct_attribute6 in varchar2,
559 p_cct_attribute7 in varchar2,
560 p_cct_attribute8 in varchar2,
561 p_cct_attribute9 in varchar2,
562 p_object_version_number in number
563 )
564 Return g_rec_type is
565 --
566 l_rec g_rec_type;
567 l_proc varchar2(72) := g_package||'convert_args';
568 --
569 Begin
570 --
571 hr_utility.set_location('Entering:'||l_proc, 5);
572 --
573 -- Convert arguments into local l_rec structure.
574 --
575 l_rec.cm_typ_id := p_cm_typ_id;
576 l_rec.effective_start_date := p_effective_start_date;
577 l_rec.effective_end_date := p_effective_end_date;
578 l_rec.name := p_name;
579 l_rec.desc_txt := p_desc_txt;
580 l_rec.cm_typ_rl := p_cm_typ_rl;
581 l_rec.cm_usg_cd := p_cm_usg_cd;
582 l_rec.whnvr_trgrd_flag := p_whnvr_trgrd_flag;
583 l_rec.shrt_name := p_shrt_name;
584 l_rec.pc_kit_cd := p_pc_kit_cd;
585 l_rec.trk_mlg_flag := p_trk_mlg_flag;
586 l_rec.mx_num_avlbl_val := p_mx_num_avlbl_val;
587 l_rec.to_be_sent_dt_cd := p_to_be_sent_dt_cd;
588 l_rec.to_be_sent_dt_rl := p_to_be_sent_dt_rl;
589 l_rec.inspn_rqd_flag := p_inspn_rqd_flag;
590 l_rec.inspn_rqd_rl := p_inspn_rqd_rl;
591 l_rec.rcpent_cd := p_rcpent_cd;
592 l_rec.parnt_cm_typ_id := p_parnt_cm_typ_id;
593 l_rec.business_group_id := p_business_group_id;
594 l_rec.cct_attribute_category := p_cct_attribute_category;
595 l_rec.cct_attribute1 := p_cct_attribute1;
596 l_rec.cct_attribute10 := p_cct_attribute10;
597 l_rec.cct_attribute11 := p_cct_attribute11;
598 l_rec.cct_attribute12 := p_cct_attribute12;
599 l_rec.cct_attribute13 := p_cct_attribute13;
600 l_rec.cct_attribute14 := p_cct_attribute14;
601 l_rec.cct_attribute15 := p_cct_attribute15;
602 l_rec.cct_attribute16 := p_cct_attribute16;
603 l_rec.cct_attribute17 := p_cct_attribute17;
604 l_rec.cct_attribute18 := p_cct_attribute18;
605 l_rec.cct_attribute19 := p_cct_attribute19;
606 l_rec.cct_attribute2 := p_cct_attribute2;
607 l_rec.cct_attribute20 := p_cct_attribute20;
608 l_rec.cct_attribute21 := p_cct_attribute21;
609 l_rec.cct_attribute22 := p_cct_attribute22;
610 l_rec.cct_attribute23 := p_cct_attribute23;
611 l_rec.cct_attribute24 := p_cct_attribute24;
612 l_rec.cct_attribute25 := p_cct_attribute25;
613 l_rec.cct_attribute26 := p_cct_attribute26;
614 l_rec.cct_attribute27 := p_cct_attribute27;
615 l_rec.cct_attribute28 := p_cct_attribute28;
616 l_rec.cct_attribute29 := p_cct_attribute29;
617 l_rec.cct_attribute3 := p_cct_attribute3;
618 l_rec.cct_attribute30 := p_cct_attribute30;
619 l_rec.cct_attribute4 := p_cct_attribute4;
620 l_rec.cct_attribute5 := p_cct_attribute5;
621 l_rec.cct_attribute6 := p_cct_attribute6;
622 l_rec.cct_attribute7 := p_cct_attribute7;
623 l_rec.cct_attribute8 := p_cct_attribute8;
624 l_rec.cct_attribute9 := p_cct_attribute9;
625 l_rec.object_version_number := p_object_version_number;
626 --
627 -- Return the plsql record structure.
628 --
629 hr_utility.set_location(' Leaving:'||l_proc, 10);
630 Return(l_rec);
631 --
632 End convert_args;
633 --
634 --
635 -- ----------------------------------------------------------------------------
636 -- |--------------------------<add_language>----------------------------------|
637 -- ----------------------------------------------------------------------------
638 Procedure add_language
639 is
640 begin
641 delete from ben_cm_typ_f_tl t
642 where not exists
643 (select null
644 from ben_cm_typ_f_tl b
645 where b.cm_typ_id = t.cm_typ_id
649 update ben_cm_typ_f_tl t set (
646 and b.effective_start_date = t.effective_start_date
647 );
648
650 shrt_name,
651 name
652 ) = (select
653 b.shrt_name,
654 b.name
655 from ben_cm_typ_f_tl b
656 where b.cm_typ_id = t.cm_typ_id
657 and b.effective_start_date = t.effective_start_date
658 and b.language = t.source_lang)
659 where (
660 t.cm_typ_id,
661 t.effective_start_date,
662 t.language
663 ) in (select
664 subt.cm_typ_id,
665 subt.effective_start_date,
666 subt.language
667 from ben_cm_typ_f_tl subb, ben_cm_typ_f_tl subt
668 where subb.cm_typ_id = subt.cm_typ_id
669 and subb.effective_start_date = subt.effective_start_date
670 and subb.language = subt.source_lang
671 and (subb.name <> subt.name
672 or subb.shrt_name <> subt.shrt_name
673 ));
674 --
675 insert into ben_cm_typ_f_tl (
676 cm_typ_id,
677 effective_start_date,
678 effective_end_date,
679 shrt_name,
680 name,
681 language,
682 source_lang,
683 last_update_date,
684 last_updated_by,
685 last_update_login,
686 created_by,
687 creation_date
688 ) select
689 b.cm_typ_id,
690 b.effective_start_date,
691 b.effective_end_date,
692 b.shrt_name,
693 b.name,
694 l.language_code,
695 b.source_lang,
696 b.last_update_date,
697 b.last_updated_by,
698 b.last_update_login,
699 b.created_by,
700 b.creation_date
701 from ben_cm_typ_f_tl b, fnd_languages l
702 where l.installed_flag in ('I', 'B')
703 and b.language = userenv('LANG')
704 and not exists
705 (select null
706 from ben_cm_typ_f_tl t
707 where t.cm_typ_id = b.cm_typ_id
708 and t.effective_start_date = b.effective_start_date
709 and t.language = l.language_code);
710 end add_language;
711 --
712 end ben_cct_shd;