DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EFC_RNDG_CD_UPGRADE

Source


1 package body ben_efc_rndg_cd_upgrade as
2 /* $Header: beefcrcu.pkb 120.0 2005/05/28 02:08:15 appldev noship $ */
3 --
4 /*
5 +==============================================================================+
6 |			 Copyright (c) 1997 Oracle Corporation		       |
7 |			    Redwood Shores, California, USA		       |
8 |				All rights reserved.			       |
9 +==============================================================================+
10 --
11 History
12   Version    Date	Author	   Comments
13   ---------  ---------	---------- --------------------------------------------
14   115.0      12-Jul-01	mhoyes     Created.
15   115.1      26-Jul-01	mhoyes     Enhanced for Patchset E+ patch.
16   115.2      13-Aug-01	mhoyes     Enhanced for Patchset E+ patch.
17   115.3      27-Aug-01	mhoyes     Enhanced for BEN July patch.
18   -----------------------------------------------------------------------------
19 */
20 --
21 -- Globals.
22 --
23 g_package varchar2(50) := 'ben_efc_rndg_cd_upgrade.';
24 --
25 procedure upgrade_rounding_codes
26   (p_business_group_id in     number
27   ,p_action_id         in     number
28   --
29   ,p_modify            in     boolean default false
30   )
31 is
32   --
33   TYPE cur_type IS REF CURSOR;
34   --
35   -- PLSQL types
36   --
37   Type RndgTabDetsType      is record
38     (tab_name     varchar2(100)
39     ,pkcol_name   varchar2(100)
40     ,rndgcol_name varchar2(100)
41     ,ent_scode    varchar2(100)
42     ,datetracked  varchar2(1)
43     );
44   --
45   Type RndgCodeDetsType      is record
46     (id                   number
47     ,rndgcol_value        varchar2(100)
48     ,effective_start_date date
49     ,effective_end_date   date
50     );
51   --
52   type RndgTabDetsSetType  is table of RndgTabDetsType;
53   --
54   l_proc           varchar2(1000) := 'upgrade_rounding_codes';
55   --
56   c_rndgcd_tabs    cur_type;
57   --
58   l_rndgtabnm_set  RndgTabDetsSetType := RndgTabDetsSetType();
59   --
60   l_rndgcodedets   RndgCodeDetsType;
61   --
62   l_sel_str        long;
63   l_sql_str        long;
64   l_ele_num        pls_integer;
65   l_count          pls_integer;
66   --
67   l_backup         boolean;
68   l_rndgtab_name   varchar2(100);
69   l_currency_code  varchar2(100);
70   l_newrndg_code   varchar2(100);
71   --
72   l_esd            date;
73   l_eed            date;
74   --
75   cursor c_getactdets
76     (c_action_id number
77     )
78   is
79     select null
80     from ben_round_code_values_efc
81     where efc_action_id = c_action_id;
82   --
83   l_getactdets  c_getactdets%rowtype;
84   --
85   cursor c_get_apr_currcode
86     (c_apr_id    number
87     ,c_esd       date
88     ,c_action_id number
89     )
90   is
91     select efc.uom
92     from ben_actl_prem_f_efc efc
93     where efc.efc_action_id = c_action_id
94     and   efc.actl_prem_id  = c_apr_id
95     and   efc.effective_start_date = c_esd;
96   --
97   cursor c_get_abr_currcode
98     (c_abr_id    number
99     ,c_esd       date
100     ,c_action_id number
101     )
102   is
103     select nvl(efc.pgm_uom,efc.nip_pl_uom)
104     from ben_acty_base_rt_f_efc efc
105     where efc.efc_action_id   = c_action_id
106     and   efc.acty_base_rt_id = c_abr_id
107     and   efc.effective_start_date = c_esd;
108   --
109   cursor c_get_bpr_currcode
110     (c_bpr_id    number
111     ,c_esd       date
112     ,c_action_id number
113     )
114   is
115     select nvl(efc.pgm_uom,efc.nip_pl_uom)
116     from ben_bnft_pool_rlovr_rqmt_f_efc efc
117     where efc.efc_action_id   = c_action_id
118     and   efc.bnft_pool_rlovr_rqmt_id = c_bpr_id
119     and   efc.effective_start_date = c_esd;
120   --
121   cursor c_get_bpp_currcode
122     (c_bpp_id    number
123     ,c_esd       date
124     ,c_action_id number
125     )
126   is
127     select efc.pgm_uom
128     from ben_bnft_prvdr_pool_f_efc efc
129     where efc.efc_action_id   = c_action_id
130     and   efc.bnft_prvdr_pool_id = c_bpp_id
131     and   efc.effective_start_date = c_esd;
132   --
133   cursor c_get_clf_currcode
134     (c_clf_id    number
135     ,c_action_id number
136     )
137   is
138     select efc.comp_lvl_uom
139     from ben_comp_lvl_fctr_efc efc
140     where efc.efc_action_id    = c_action_id
141     and   efc.comp_lvl_fctr_id = c_clf_id;
142   --
143   cursor c_get_ccm_currcode
144     (c_ccm_id    number
145     ,c_esd       date
146     ,c_action_id number
147     )
148   is
149     select nvl(efc.pgm_uom,efc.nip_pl_uom)
150     from ben_cvg_amt_calc_mthd_f_efc efc
151     where efc.efc_action_id        = c_action_id
152     and   efc.cvg_amt_calc_mthd_id = c_ccm_id
153     and   efc.effective_start_date = c_esd;
154   --
155   cursor c_get_prt_currcode
156     (c_prt_id    number
157     ,c_esd       date
158     ,c_action_id number
159     )
160   is
161     select nvl(efc.pgm_uom,efc.nip_pl_uom)
162     from  ben_poe_rt_f prt,
163           ben_vrbl_rt_prfl_f_efc efc
164     where efc.efc_action_id   = c_action_id
165     and   prt.poe_rt_id       = c_prt_id
166     and   efc.vrbl_rt_prfl_id = prt.vrbl_rt_prfl_id
167     and   c_esd
168       between prt.effective_start_date and prt.effective_end_date
169     and   efc.effective_start_date = c_esd;
170   --
171   cursor c_get_ppv_currcode
172     (c_ppv_id    number
173     ,c_esd       date
174     ,c_action_id number
175     )
176   is
177     select nvl(efc.pgm_uom,efc.nip_pl_uom)
178     from  ben_prtl_mo_rt_prtn_val_f ppv,
179           ben_acty_base_rt_f_efc efc
180     where efc.efc_action_id   = c_action_id
181     and   ppv.acty_base_rt_id = c_ppv_id
182     and   efc.acty_base_rt_id = ppv.acty_base_rt_id
183     and   c_esd
184       between ppv.effective_start_date and ppv.effective_end_date
185     and   efc.effective_start_date = c_esd;
186   --
187   cursor c_get_vpf_currcode
188     (c_vpf_id    number
189     ,c_esd       date
190     ,c_action_id number
191     )
192   is
193     select nvl(efc.pgm_uom,efc.nip_pl_uom)
194     from  ben_vrbl_rt_prfl_f_efc efc
195     where efc.efc_action_id   = c_action_id
196     and   efc.vrbl_rt_prfl_id = c_vpf_id
197     and   efc.effective_start_date = c_esd;
198   --
199 begin
200   --
201   -- Check if rounding code information exists for the EFC action
202   --
203   l_backup := FALSE;
204   --
205   if p_action_id is not null then
206     --
207     open c_getactdets
208       (c_action_id => p_action_id
209       );
210     fetch c_getactdets into l_getactdets;
211     if c_getactdets%notfound then
212       --
213       l_backup := TRUE;
214       --
215     end if;
216     close c_getactdets;
217     --
218   end if;
219   --
220   l_ele_num := 1;
221   --
222   l_rndgtabnm_set.extend(1);
223   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_ACTL_PREM_F';
224   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'ACTL_PREM_ID';
225   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
226   l_rndgtabnm_set(l_ele_num).ent_scode    := 'APR';
227   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
228   l_ele_num := l_ele_num+1;
229   --
230   l_rndgtabnm_set.extend(1);
231   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_ACTY_BASE_RT_F';
232   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'ACTY_BASE_RT_ID';
233   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
234   l_rndgtabnm_set(l_ele_num).ent_scode    := 'ABR';
235   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
236   l_ele_num := l_ele_num+1;
237   --
238   l_rndgtabnm_set.extend(1);
239   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_BNFT_POOL_RLOVR_RQMT_F';
240   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'BNFT_POOL_RLOVR_RQMT_ID';
241   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'VAL_RNDG_CD';
242   l_rndgtabnm_set(l_ele_num).ent_scode    := 'BPR';
243   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
244   l_ele_num := l_ele_num+1;
245   --
246   l_rndgtabnm_set.extend(1);
247   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_BNFT_PRVDR_POOL_F';
248   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'BNFT_PRVDR_POOL_ID';
249   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'VAL_RNDG_CD';
250   l_rndgtabnm_set(l_ele_num).ent_scode    := 'BPP';
251   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
252   l_ele_num := l_ele_num+1;
253   --
254   l_rndgtabnm_set.extend(1);
255   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_COMP_LVL_FCTR';
256   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'COMP_LVL_FCTR_ID';
257   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
258   l_rndgtabnm_set(l_ele_num).ent_scode    := 'CLF';
259   l_rndgtabnm_set(l_ele_num).datetracked  := 'N';
260   l_ele_num := l_ele_num+1;
261   --
262   l_rndgtabnm_set.extend(1);
263   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_CVG_AMT_CALC_MTHD_F';
264   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'CVG_AMT_CALC_MTHD_ID';
265   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
266   l_rndgtabnm_set(l_ele_num).ent_scode    := 'CCM';
267   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
268   l_ele_num := l_ele_num+1;
269   --
270   l_rndgtabnm_set.extend(1);
271   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_POE_RT_F';
272   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'POE_RT_ID';
273   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
274   l_rndgtabnm_set(l_ele_num).ent_scode    := 'PRT';
275   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
276   l_ele_num := l_ele_num+1;
277   --
278   l_rndgtabnm_set.extend(1);
279   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_PRTL_MO_RT_PRTN_VAL_F';
280   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'PRTL_MO_RT_PRTN_VAL_ID';
281   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
282   l_rndgtabnm_set(l_ele_num).ent_scode    := 'PMRPV';
283   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
284   l_ele_num := l_ele_num+1;
285   --
286   l_rndgtabnm_set.extend(1);
287   l_rndgtabnm_set(l_ele_num).tab_name     := 'BEN_VRBL_RT_PRFL_F';
288   l_rndgtabnm_set(l_ele_num).pkcol_name   := 'VRBL_RT_PRFL_ID';
289   l_rndgtabnm_set(l_ele_num).rndgcol_name := 'RNDG_CD';
290   l_rndgtabnm_set(l_ele_num).ent_scode    := 'VPF';
291   l_rndgtabnm_set(l_ele_num).datetracked  := 'Y';
292   --
293   hr_efc_info.insert_line
294     ('-- ');
295   hr_efc_info.insert_line
296     ('-- Checking upgradeable rounding codes for business group ID '||p_business_group_id
297     ||' EFC action ID: '||p_action_id
298     );
299   hr_efc_info.insert_line
300     ('-- ');
301   --
302   for rndgele_num in l_rndgtabnm_set.first..l_rndgtabnm_set.last
303   loop
304     --
305     l_rndgtab_name := l_rndgtabnm_set(rndgele_num).tab_name;
306     --
307     l_sql_str := 'select count(*) '
308                  ||' from '||l_rndgtab_name
309                  ||' where '||l_rndgtabnm_set(rndgele_num).rndgcol_name||' is not null '
310                  ||' and business_group_id = '||p_business_group_id;
311     --
312     open c_rndgcd_tabs FOR l_sql_str;
313     FETCH c_rndgcd_tabs INTO l_count;
314     CLOSE c_rndgcd_tabs;
315     --
316     if l_count > 0 then
317       --
318       if p_modify then
319         --
320         hr_efc_info.insert_line
321           ('--   Mapping '||l_count||' rounding code values to EFC rounding code values in table '
322           ||l_rndgtab_name
323           );
324         --
325       elsif not l_backup then
326         --
327         hr_efc_info.insert_line
328           ('--   '||l_count||' Potential rounding code values to be upgraded exist in '
329           ||l_rndgtab_name
330           );
331         --
332       else
333         --
334         hr_efc_info.insert_line
335           ('--   '||l_count||' rounding code values being backed up from '
336           ||l_rndgtab_name
337           );
338         --
339       end if;
340       --
341       -- Check for a datetracked table
342       --
343       l_sel_str := l_rndgtabnm_set(rndgele_num).pkcol_name||', '
344                    ||' '||l_rndgtabnm_set(rndgele_num).rndgcol_name;
345       --
346       if l_rndgtabnm_set(rndgele_num).datetracked = 'Y' then
347         --
348         l_sel_str := l_sel_str||', effective_start_date, effective_end_date ';
349         --
350       else
351         --
352         l_sel_str := l_sel_str||', null, null ';
353         --
354       end if;
355       --
356       l_sql_str := 'select '||l_sel_str
357                    ||' from '||l_rndgtab_name
358                    ||' where '||l_rndgtabnm_set(rndgele_num).rndgcol_name||' is not null '
359                    ||' and business_group_id = '||p_business_group_id;
360       --
361       open c_rndgcd_tabs FOR l_sql_str;
362       loop
363         FETCH c_rndgcd_tabs INTO l_rndgcodedets;
364         EXIT WHEN c_rndgcd_tabs%NOTFOUND;
365         --
366         if l_backup then
367           --
368           l_esd := l_rndgcodedets.effective_start_date;
369           l_eed := l_rndgcodedets.effective_end_date;
370           --
371           if l_rndgcodedets.effective_start_date is null then
372             --
373             l_esd := hr_api.g_sot;
374             --
375           end if;
376           --
377           if l_rndgcodedets.effective_end_date is null then
378             --
379             l_eed := hr_api.g_eot;
380             --
381           end if;
382           --
383           insert into ben_round_code_values_efc
384             (efc_action_id
385             ,table_name
386             ,rndcdcol_name
390             ,rndcdcol_value
387             ,pk_id
388             ,effective_start_date
389             ,effective_end_date
391             )
392           values
393             (p_action_id
394             ,l_rndgtab_name
395             ,l_rndgtabnm_set(rndgele_num).rndgcol_name
396             ,l_rndgcodedets.id
397             ,l_esd
398             ,l_eed
399             ,l_rndgcodedets.rndgcol_value
400             );
401           --
402         end if;
403         --
404         -- Check if the rounding code needs to be modified
405         --
406         if p_modify then
407           --
408           -- Get the currency code
409           --
410           if l_rndgtab_name = 'BEN_ACTL_PREM_F'
411           then
412             --
413             open c_get_apr_currcode
414               (c_apr_id    => l_rndgcodedets.id
415               ,c_esd       => l_rndgcodedets.effective_start_date
416               ,c_action_id => p_action_id
417               );
418             fetch c_get_apr_currcode into l_currency_code;
419             if c_get_apr_currcode%notfound then
420               --
421               l_currency_code := null;
422               --
423             end if;
424             close c_get_apr_currcode;
425             --
426           elsif l_rndgtab_name = 'BEN_ACTY_BASE_RT_F'
427           then
428             --
429             open c_get_abr_currcode
430               (c_abr_id    => l_rndgcodedets.id
431               ,c_esd       => l_rndgcodedets.effective_start_date
432               ,c_action_id => p_action_id
433               );
434             fetch c_get_abr_currcode into l_currency_code;
435             if c_get_abr_currcode%notfound then
436               --
437               l_currency_code := null;
438               --
439             end if;
440             close c_get_abr_currcode;
441             --
442           elsif l_rndgtab_name = 'BEN_BNFT_POOL_RLOVR_RQMT_F'
443           then
444             --
445             open c_get_bpr_currcode
446               (c_bpr_id    => l_rndgcodedets.id
447               ,c_esd       => l_rndgcodedets.effective_start_date
448               ,c_action_id => p_action_id
449               );
450             fetch c_get_bpr_currcode into l_currency_code;
451             if c_get_bpr_currcode%notfound then
452               --
453               l_currency_code := null;
454               --
455             end if;
456             close c_get_bpr_currcode;
457             --
458           elsif l_rndgtab_name = 'BEN_BNFT_PRVDR_POOL_F'
459           then
460             --
461             open c_get_bpp_currcode
462               (c_bpp_id    => l_rndgcodedets.id
463               ,c_esd       => l_rndgcodedets.effective_start_date
464               ,c_action_id => p_action_id
465               );
466             fetch c_get_bpp_currcode into l_currency_code;
467             if c_get_bpp_currcode%notfound then
468               --
469               l_currency_code := null;
470               --
471             end if;
472             close c_get_bpp_currcode;
473             --
474           elsif l_rndgtab_name = 'BEN_COMP_LVL_FCTR'
475           then
476             --
477             open c_get_clf_currcode
478               (c_clf_id    => l_rndgcodedets.id
479               ,c_action_id => p_action_id
480               );
481             fetch c_get_clf_currcode into l_currency_code;
482             if c_get_clf_currcode%notfound then
483               --
484               l_currency_code := null;
485               --
486             end if;
487             close c_get_clf_currcode;
488             --
489           elsif l_rndgtab_name = 'BEN_CVG_AMT_CALC_MTHD_F'
490           then
491             --
492             open c_get_ccm_currcode
493               (c_ccm_id    => l_rndgcodedets.id
494               ,c_esd       => l_rndgcodedets.effective_start_date
495               ,c_action_id => p_action_id
496               );
497             fetch c_get_ccm_currcode into l_currency_code;
498             if c_get_ccm_currcode%notfound then
499               --
500               l_currency_code := null;
501               --
502             end if;
503             close c_get_ccm_currcode;
504             --
505           elsif l_rndgtab_name = 'BEN_POE_RT_F'
506           then
507             --
508             open c_get_prt_currcode
509               (c_prt_id    => l_rndgcodedets.id
510               ,c_esd       => l_rndgcodedets.effective_start_date
511               ,c_action_id => p_action_id
512               );
513             fetch c_get_prt_currcode into l_currency_code;
514             if c_get_prt_currcode%notfound then
515               --
516               l_currency_code := null;
517               --
518             end if;
519             close c_get_prt_currcode;
520             --
521           elsif l_rndgtab_name = 'BEN_PRTL_MO_RT_PRTN_VAL_F'
522           then
523             --
524             open c_get_ppv_currcode
525               (c_ppv_id    => l_rndgcodedets.id
526               ,c_esd       => l_rndgcodedets.effective_start_date
527               ,c_action_id => p_action_id
528               );
529             fetch c_get_ppv_currcode into l_currency_code;
530             if c_get_ppv_currcode%notfound then
534             end if;
531               --
532               l_currency_code := null;
533               --
535             close c_get_ppv_currcode;
536             --
537           elsif l_rndgtab_name = 'BEN_VRBL_RT_PRFL_F'
538           then
539             --
540             open c_get_vpf_currcode
541               (c_vpf_id    => l_rndgcodedets.id
542               ,c_esd       => l_rndgcodedets.effective_start_date
543               ,c_action_id => p_action_id
544               );
545             fetch c_get_vpf_currcode into l_currency_code;
546             if c_get_vpf_currcode%notfound then
547               --
548               l_currency_code := null;
549               --
550             end if;
551             close c_get_vpf_currcode;
552             --
553           end if;
554           --
555           -- Check if any rounding code mappings have been defined
556           --
557           if l_currency_code is not null
558           then
559             --
560             l_newrndg_code := ben_efc_stubs.get_cust_mapped_rounding_code
561               (p_rndcd_table_name => l_rndgtab_name
562               ,p_currency_code    => l_currency_code
563               ,p_rndcd_value      => l_rndgcodedets.rndgcol_value
564               );
565             --
566             if l_newrndg_code is not null
567               and l_rndgtab_name = 'BEN_ACTL_PREM_F'
568             then
569               --
570               update ben_actl_prem_f
571               set rndg_cd = l_newrndg_code
572               where actl_prem_id = l_rndgcodedets.id
573               and   effective_start_date = l_rndgcodedets.effective_start_date;
574             --
575             elsif l_newrndg_code is not null
576               and l_rndgtab_name = 'BEN_ACTY_BASE_RT_F'
577             then
578               --
579               update ben_acty_base_rt_f
580               set rndg_cd = l_newrndg_code
581               where acty_base_rt_id = l_rndgcodedets.id
582               and   effective_start_date = l_rndgcodedets.effective_start_date;
583             --
584             elsif l_newrndg_code is not null
585               and l_rndgtab_name = 'BEN_BNFT_POOL_RLOVR_RQMT_F'
586             then
587               --
588               update ben_bnft_pool_rlovr_rqmt_f
589               set val_rndg_cd = l_newrndg_code
590               where bnft_pool_rlovr_rqmt_id = l_rndgcodedets.id
591               and   effective_start_date = l_rndgcodedets.effective_start_date;
592             --
593             elsif l_newrndg_code is not null
594               and l_rndgtab_name = 'BEN_BNFT_PRVDR_POOL_F'
595             then
596               --
597               update ben_bnft_prvdr_pool_f
598               set val_rndg_cd = l_newrndg_code
599               where bnft_prvdr_pool_id = l_rndgcodedets.id
600               and   effective_start_date = l_rndgcodedets.effective_start_date;
601             --
602             elsif l_newrndg_code is not null
603               and l_rndgtab_name = 'BEN_COMP_LVL_FCTR'
604             then
605               --
606               update ben_comp_lvl_fctr
607               set rndg_cd = l_newrndg_code
608               where comp_lvl_fctr_id = l_rndgcodedets.id;
609             --
610             elsif l_newrndg_code is not null
611               and l_rndgtab_name = 'BEN_CVG_AMT_CALC_MTHD_F'
612             then
613               --
614               update ben_cvg_amt_calc_mthd_f
615               set rndg_cd = l_newrndg_code
616               where cvg_amt_calc_mthd_id = l_rndgcodedets.id
617               and   effective_start_date = l_rndgcodedets.effective_start_date;
618             --
619             elsif l_newrndg_code is not null
620               and l_rndgtab_name = 'BEN_POE_RT_F'
621             then
622               --
623               update ben_poe_rt_f
624               set rndg_cd = l_newrndg_code
625               where poe_rt_id = l_rndgcodedets.id
626               and   effective_start_date = l_rndgcodedets.effective_start_date;
627             --
628             elsif l_newrndg_code is not null
629               and l_rndgtab_name = 'BEN_PRTL_MO_RT_PRTN_VAL_F'
630             then
631               --
632               update ben_prtl_mo_rt_prtn_val_f
633               set rndg_cd = l_newrndg_code
634               where prtl_mo_rt_prtn_val_id = l_rndgcodedets.id
635               and   effective_start_date = l_rndgcodedets.effective_start_date;
636             --
637             elsif l_newrndg_code is not null
638               and l_rndgtab_name = 'BEN_VRBL_RT_PRFL_F'
639             then
640               --
641               update ben_vrbl_rt_prfl_f
642               set rndg_cd = l_newrndg_code
643               where vrbl_rt_prfl_id = l_rndgcodedets.id
644               and   effective_start_date = l_rndgcodedets.effective_start_date;
645               --
646             end if;
647             --
648             if l_newrndg_code is not null then
649               --
650               hr_efc_info.insert_line
651                 ('-- Mapped ID '||l_rndgcodedets.id||' in '||l_rndgtab_name
652                 ||' for to '||l_newrndg_code||' for currency '||l_currency_code
653                 );
654               --
655             end if;
656             --
657           end if;
658           --
659         end if;
660         --
661         commit;
662         --
663       end loop;
664       CLOSE c_rndgcd_tabs;
665       --
666     end if;
667     --
668   end loop;
669   --
670 end upgrade_rounding_codes;
671 --
672 end ben_efc_rndg_cd_upgrade;