DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CEP_CACHE1

Source


1 package body ben_cep_cache1 as
2 /* $Header: bencepc1.pkb 120.1 2006/05/04 03:48:31 abparekh noship $ */
3 --
4 procedure write_cobcep_odcache
5   (p_effective_date in     date
6   ,p_pgm_id         in     number default hr_api.g_number
7   ,p_pl_id          in     number default hr_api.g_number
8   ,p_oipl_id        in     number default hr_api.g_number
9   ,p_plip_id        in     number default hr_api.g_number
10   ,p_ptip_id        in     number default hr_api.g_number
11   -- Grade/Step
12   ,p_vrbl_rt_prfl_id           in number  default hr_api.g_number
13   -- Grade/Step
14   --
15   ,p_hv               out nocopy  pls_integer
16   )
17 is
18   --
19   l_proc varchar2(72) := 'write_cobcep_odcache';
20   --
21   l_copcep_odlookup_rec ben_cache.g_cache_lookup;
22   --
23   l_hv              pls_integer;
24   l_not_hash_found  boolean;
25   l_torrwnum        pls_integer;
26   l_starttorele_num pls_integer;
27   --
28   cursor c_pgminstance
29     (c_pgm_id         number
30     ,c_effective_date date
31     )
32   is
33     select  /*+ bencepch.write_cobcep_odcache.c_pgminstance */
34             tab1.pgm_id,
35             tab1.ptip_id,
36             tab1.plip_id,
37             tab1.pl_id,
38             tab1.oipl_id,
39             -- Grade/Step
40             to_number(null) vrbl_rt_prfl_id,
41             -- Grade/Step
42             tab1.prtn_elig_id,
43             tab1.trk_scr_for_inelg_flag,
44             tab2.compute_score_flag,
45             tab2.mndtry_flag,
46             tab3.eligy_prfl_id,
47             tab3.asmt_to_use_cd,
48             tab3.elig_enrld_plip_flag,
49             tab3.elig_cbr_quald_bnf_flag,
50             tab3.elig_enrld_ptip_flag,
51             tab3.elig_dpnt_cvrd_plip_flag,
52             tab3.elig_dpnt_cvrd_ptip_flag,
53             tab3.elig_dpnt_cvrd_pgm_flag,
54             tab3.elig_job_flag,
55             tab3.elig_hrly_slrd_flag,
56             tab3.elig_pstl_cd_flag,
57             tab3.elig_lbr_mmbr_flag,
58             tab3.elig_lgl_enty_flag,
59             tab3.elig_benfts_grp_flag,
60             tab3.elig_wk_loc_flag,
61             tab3.elig_brgng_unit_flag,
62             tab3.elig_age_flag,
63             tab3.elig_los_flag,
64             tab3.elig_per_typ_flag,
65             tab3.elig_fl_tm_pt_tm_flag,
66             tab3.elig_ee_stat_flag,
67             tab3.elig_grd_flag,
68             tab3.elig_pct_fl_tm_flag,
69             tab3.elig_asnt_set_flag,
70             tab3.elig_hrs_wkd_flag,
71             tab3.elig_comp_lvl_flag,
72             tab3.elig_org_unit_flag,
73             tab3.elig_loa_rsn_flag,
74             tab3.elig_pyrl_flag,
75             tab3.elig_schedd_hrs_flag,
76             tab3.elig_py_bss_flag,
77             tab3.eligy_prfl_rl_flag,
78             tab3.elig_cmbn_age_los_flag,
79             tab3.cntng_prtn_elig_prfl_flag,
80             tab3.elig_prtt_pl_flag,
81             tab3.elig_ppl_grp_flag,
82             tab3.elig_svc_area_flag,
83             tab3.elig_ptip_prte_flag,
84             tab3.elig_no_othr_cvg_flag,
85             tab3.elig_enrld_pl_flag,
86             tab3.elig_enrld_oipl_flag,
87             tab3.elig_enrld_pgm_flag,
88             tab3.elig_dpnt_cvrd_pl_flag,
89             tab3.elig_lvg_rsn_flag,
90             tab3.elig_optd_mdcr_flag,
91             tab3.elig_tbco_use_flag,
92             tab3.elig_dpnt_othr_ptip_flag,
93             tab3.ELIG_GNDR_FLAG,
94             tab3.ELIG_MRTL_STS_FLAG,
95             tab3.ELIG_DSBLTY_CTG_FLAG,
96             tab3.ELIG_DSBLTY_RSN_FLAG,
97             tab3.ELIG_DSBLTY_DGR_FLAG,
98             tab3.ELIG_SUPPL_ROLE_FLAG,
99             tab3.ELIG_QUAL_TITL_FLAG,
100             tab3.ELIG_PSTN_FLAG,
101             tab3.ELIG_PRBTN_PERD_FLAG,
102             tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
103             tab3.BNFT_CAGR_PRTN_CD,
104             tab3.ELIG_DSBLD_FLAG,
105             tab3.ELIG_TTL_CVG_VOL_FLAG,
106             tab3.ELIG_TTL_PRTT_FLAG,
107             tab3.ELIG_COMPTNCY_FLAG,
108             tab3.ELIG_HLTH_CVG_FLAG,
109             tab3.ELIG_ANTHR_PL_FLAG,
110             tab3.elig_qua_in_gr_flag,
111             tab3.elig_perf_rtng_flag,
112             tab3.elig_crit_values_flag
113     from  ben_prtn_elig_f tab1,
114           ben_prtn_elig_prfl_f tab2,
115           ben_eligy_prfl_f tab3
116     where tab1.pgm_id = c_pgm_id
117     and tab1.prtn_elig_id = tab2.prtn_elig_id
118     and c_effective_date
119       between tab1.effective_start_date
120         and tab1.effective_end_date
121     and tab2.eligy_prfl_id = tab3.eligy_prfl_id
122     and tab3.stat_cd = 'A'                         -- bug 2431753 -- consider only active profiles
123     and c_effective_date
124       between tab2.effective_start_date
125         and tab2.effective_end_date
126     and c_effective_date
127       between tab3.effective_start_date
128     and tab3.effective_end_date
129     order by tab1.pgm_id,
130              tab1.ptip_id,
131              tab1.plip_id,
132              tab1.pl_id,
133              tab1.oipl_id,
134              decode(tab2.mndtry_flag,'Y',1,2);
135   --
136   l_instance c_pgminstance%rowtype;
137   --
138   cursor c_ptipinstance
139     (c_ptip_id        number
140     ,c_effective_date date
141     )
142   is
143     select  /*+ bencepch.write_cobcep_odcache.c_ptipinstance */
144             tab1.pgm_id,
145             tab1.ptip_id,
146             tab1.plip_id,
147             tab1.pl_id,
148             tab1.oipl_id,
149             -- Grade/Step
150             null vrbl_rt_prfl_id,
151             -- Grade/Step
152             tab1.prtn_elig_id,
153             tab1.trk_scr_for_inelg_flag,
154             tab2.compute_score_flag,
155             tab2.mndtry_flag,
156             tab3.eligy_prfl_id,
157             tab3.asmt_to_use_cd,
158             tab3.elig_enrld_plip_flag,
159             tab3.elig_cbr_quald_bnf_flag,
160             tab3.elig_enrld_ptip_flag,
161             tab3.elig_dpnt_cvrd_plip_flag,
162             tab3.elig_dpnt_cvrd_ptip_flag,
163             tab3.elig_dpnt_cvrd_pgm_flag,
164             tab3.elig_job_flag,
165             tab3.elig_hrly_slrd_flag,
166             tab3.elig_pstl_cd_flag,
167             tab3.elig_lbr_mmbr_flag,
168             tab3.elig_lgl_enty_flag,
169             tab3.elig_benfts_grp_flag,
170             tab3.elig_wk_loc_flag,
171             tab3.elig_brgng_unit_flag,
172             tab3.elig_age_flag,
173             tab3.elig_los_flag,
174             tab3.elig_per_typ_flag,
175             tab3.elig_fl_tm_pt_tm_flag,
176             tab3.elig_ee_stat_flag,
177             tab3.elig_grd_flag,
178             tab3.elig_pct_fl_tm_flag,
179             tab3.elig_asnt_set_flag,
180             tab3.elig_hrs_wkd_flag,
181             tab3.elig_comp_lvl_flag,
182             tab3.elig_org_unit_flag,
183             tab3.elig_loa_rsn_flag,
184             tab3.elig_pyrl_flag,
185             tab3.elig_schedd_hrs_flag,
186             tab3.elig_py_bss_flag,
187             tab3.eligy_prfl_rl_flag,
188             tab3.elig_cmbn_age_los_flag,
189             tab3.cntng_prtn_elig_prfl_flag,
190             tab3.elig_prtt_pl_flag,
191             tab3.elig_ppl_grp_flag,
192             tab3.elig_svc_area_flag,
193             tab3.elig_ptip_prte_flag,
194             tab3.elig_no_othr_cvg_flag,
195             tab3.elig_enrld_pl_flag,
196             tab3.elig_enrld_oipl_flag,
197             tab3.elig_enrld_pgm_flag,
198             tab3.elig_dpnt_cvrd_pl_flag,
199             tab3.elig_lvg_rsn_flag,
200             tab3.elig_optd_mdcr_flag,
201             tab3.elig_tbco_use_flag,
202             tab3.elig_dpnt_othr_ptip_flag,
203             tab3.ELIG_GNDR_FLAG,
204             tab3.ELIG_MRTL_STS_FLAG,
205             tab3.ELIG_DSBLTY_CTG_FLAG,
206             tab3.ELIG_DSBLTY_RSN_FLAG,
207             tab3.ELIG_DSBLTY_DGR_FLAG,
208             tab3.ELIG_SUPPL_ROLE_FLAG,
209             tab3.ELIG_QUAL_TITL_FLAG,
210             tab3.ELIG_PSTN_FLAG,
211             tab3.ELIG_PRBTN_PERD_FLAG,
212             tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
213             tab3.BNFT_CAGR_PRTN_CD,
214             tab3.ELIG_DSBLD_FLAG,
215             tab3.ELIG_TTL_CVG_VOL_FLAG,
216             tab3.ELIG_TTL_PRTT_FLAG,
217             tab3.ELIG_COMPTNCY_FLAG,
218             tab3.ELIG_HLTH_CVG_FLAG,
219             tab3.ELIG_ANTHR_PL_FLAG,
220             tab3.elig_qua_in_gr_flag,
221             tab3.elig_perf_rtng_flag,
222             tab3.elig_crit_values_flag
223     from  ben_prtn_elig_f tab1,
224           ben_prtn_elig_prfl_f tab2,
225           ben_eligy_prfl_f tab3
226     where tab1.ptip_id = c_ptip_id
227     and tab1.prtn_elig_id = tab2.prtn_elig_id
228     and c_effective_date
229       between tab1.effective_start_date
230         and tab1.effective_end_date
231     and tab2.eligy_prfl_id = tab3.eligy_prfl_id
232     and tab3.stat_cd = 'A'                         -- bug 2431753 -- consider only active profiles
233     and c_effective_date
234       between tab2.effective_start_date
235         and tab2.effective_end_date
236     and c_effective_date
237       between tab3.effective_start_date
238     and tab3.effective_end_date
239     order by tab1.pgm_id,
240              tab1.ptip_id,
241              tab1.plip_id,
242              tab1.pl_id,
243              tab1.oipl_id,
244              decode(tab2.mndtry_flag,'Y',1,2);
245   --
246   cursor c_plipinstance
247     (c_plip_id        number
248     ,c_effective_date date
249     )
250   is
251     select  /*+ bencepch.write_cobcep_odcache.c_plipinstance */
252             tab1.pgm_id,
253             tab1.ptip_id,
254             tab1.plip_id,
255             tab1.pl_id,
256             tab1.oipl_id,
257             -- Grade/Step
258             null vrbl_rt_prfl_id,
259             -- Grade/Step
260             tab1.prtn_elig_id,
261             tab1.trk_scr_for_inelg_flag,
262             tab2.compute_score_flag,
263             tab2.mndtry_flag,
264             tab3.eligy_prfl_id,
265             tab3.asmt_to_use_cd,
266             tab3.elig_enrld_plip_flag,
267             tab3.elig_cbr_quald_bnf_flag,
268             tab3.elig_enrld_ptip_flag,
269             tab3.elig_dpnt_cvrd_plip_flag,
270             tab3.elig_dpnt_cvrd_ptip_flag,
271             tab3.elig_dpnt_cvrd_pgm_flag,
272             tab3.elig_job_flag,
273             tab3.elig_hrly_slrd_flag,
274             tab3.elig_pstl_cd_flag,
275             tab3.elig_lbr_mmbr_flag,
276             tab3.elig_lgl_enty_flag,
277             tab3.elig_benfts_grp_flag,
278             tab3.elig_wk_loc_flag,
279             tab3.elig_brgng_unit_flag,
280             tab3.elig_age_flag,
281             tab3.elig_los_flag,
282             tab3.elig_per_typ_flag,
283             tab3.elig_fl_tm_pt_tm_flag,
284             tab3.elig_ee_stat_flag,
285             tab3.elig_grd_flag,
286             tab3.elig_pct_fl_tm_flag,
287             tab3.elig_asnt_set_flag,
288             tab3.elig_hrs_wkd_flag,
289             tab3.elig_comp_lvl_flag,
290             tab3.elig_org_unit_flag,
291             tab3.elig_loa_rsn_flag,
292             tab3.elig_pyrl_flag,
293             tab3.elig_schedd_hrs_flag,
294             tab3.elig_py_bss_flag,
295             tab3.eligy_prfl_rl_flag,
296             tab3.elig_cmbn_age_los_flag,
297             tab3.cntng_prtn_elig_prfl_flag,
298             tab3.elig_prtt_pl_flag,
299             tab3.elig_ppl_grp_flag,
300             tab3.elig_svc_area_flag,
301             tab3.elig_ptip_prte_flag,
302             tab3.elig_no_othr_cvg_flag,
303             tab3.elig_enrld_pl_flag,
304             tab3.elig_enrld_oipl_flag,
305             tab3.elig_enrld_pgm_flag,
306             tab3.elig_dpnt_cvrd_pl_flag,
307             tab3.elig_lvg_rsn_flag,
308             tab3.elig_optd_mdcr_flag,
309             tab3.elig_tbco_use_flag,
310             tab3.elig_dpnt_othr_ptip_flag,
311             tab3.ELIG_GNDR_FLAG,
312             tab3.ELIG_MRTL_STS_FLAG,
313             tab3.ELIG_DSBLTY_CTG_FLAG,
314             tab3.ELIG_DSBLTY_RSN_FLAG,
315             tab3.ELIG_DSBLTY_DGR_FLAG,
316             tab3.ELIG_SUPPL_ROLE_FLAG,
317             tab3.ELIG_QUAL_TITL_FLAG,
318             tab3.ELIG_PSTN_FLAG,
319             tab3.ELIG_PRBTN_PERD_FLAG,
320             tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
321             tab3.BNFT_CAGR_PRTN_CD,
322             tab3.ELIG_DSBLD_FLAG,
323             tab3.ELIG_TTL_CVG_VOL_FLAG,
324             tab3.ELIG_TTL_PRTT_FLAG,
325             tab3.ELIG_COMPTNCY_FLAG,
326             tab3.ELIG_HLTH_CVG_FLAG,
327             tab3.ELIG_ANTHR_PL_FLAG,
328             tab3.elig_qua_in_gr_flag,
329             tab3.elig_perf_rtng_flag,
330             tab3.elig_crit_values_flag
331     from  ben_prtn_elig_f tab1,
332           ben_prtn_elig_prfl_f tab2,
333           ben_eligy_prfl_f tab3
334     where tab1.plip_id = c_plip_id
335     and tab1.prtn_elig_id = tab2.prtn_elig_id
336     and c_effective_date
337       between tab1.effective_start_date
338         and tab1.effective_end_date
339     and tab2.eligy_prfl_id = tab3.eligy_prfl_id
340     and tab3.stat_cd = 'A'                         -- bug 2431753 -- consider only active profiles
341     and c_effective_date
342       between tab2.effective_start_date
343         and tab2.effective_end_date
344     and c_effective_date
345       between tab3.effective_start_date
346     and tab3.effective_end_date
347     order by tab1.pgm_id,
348              tab1.ptip_id,
349              tab1.plip_id,
350              tab1.pl_id,
351              tab1.oipl_id,
352              decode(tab2.mndtry_flag,'Y',1,2);
353   --
354   cursor c_plinstance
355     (c_pl_id          number
356     ,c_effective_date date
357     )
358   is
359     select  /*+ bencepch.write_cobcep_odcache.c_plinstance */
360             tab1.pgm_id,
361             tab1.ptip_id,
362             tab1.plip_id,
363             tab1.pl_id,
364             tab1.oipl_id,
365             -- Grade/Step
366             null vrbl_rt_prfl_id,
367             -- Grade/Step
368             tab1.prtn_elig_id,
369             tab1.trk_scr_for_inelg_flag,
370             tab2.compute_score_flag,
371             tab2.mndtry_flag,
372             tab3.eligy_prfl_id,
373             tab3.asmt_to_use_cd,
374             tab3.elig_enrld_plip_flag,
375             tab3.elig_cbr_quald_bnf_flag,
376             tab3.elig_enrld_ptip_flag,
377             tab3.elig_dpnt_cvrd_plip_flag,
378             tab3.elig_dpnt_cvrd_ptip_flag,
379             tab3.elig_dpnt_cvrd_pgm_flag,
380             tab3.elig_job_flag,
381             tab3.elig_hrly_slrd_flag,
382             tab3.elig_pstl_cd_flag,
383             tab3.elig_lbr_mmbr_flag,
384             tab3.elig_lgl_enty_flag,
385             tab3.elig_benfts_grp_flag,
386             tab3.elig_wk_loc_flag,
387             tab3.elig_brgng_unit_flag,
388             tab3.elig_age_flag,
389             tab3.elig_los_flag,
390             tab3.elig_per_typ_flag,
391             tab3.elig_fl_tm_pt_tm_flag,
392             tab3.elig_ee_stat_flag,
393             tab3.elig_grd_flag,
394             tab3.elig_pct_fl_tm_flag,
395             tab3.elig_asnt_set_flag,
396             tab3.elig_hrs_wkd_flag,
397             tab3.elig_comp_lvl_flag,
398             tab3.elig_org_unit_flag,
399             tab3.elig_loa_rsn_flag,
400             tab3.elig_pyrl_flag,
401             tab3.elig_schedd_hrs_flag,
402             tab3.elig_py_bss_flag,
403             tab3.eligy_prfl_rl_flag,
404             tab3.elig_cmbn_age_los_flag,
405             tab3.cntng_prtn_elig_prfl_flag,
406             tab3.elig_prtt_pl_flag,
407             tab3.elig_ppl_grp_flag,
408             tab3.elig_svc_area_flag,
409             tab3.elig_ptip_prte_flag,
410             tab3.elig_no_othr_cvg_flag,
411             tab3.elig_enrld_pl_flag,
412             tab3.elig_enrld_oipl_flag,
413             tab3.elig_enrld_pgm_flag,
414             tab3.elig_dpnt_cvrd_pl_flag,
415             tab3.elig_lvg_rsn_flag,
416             tab3.elig_optd_mdcr_flag,
417             tab3.elig_tbco_use_flag,
418             tab3.elig_dpnt_othr_ptip_flag,
419             tab3.ELIG_GNDR_FLAG,
420             tab3.ELIG_MRTL_STS_FLAG,
421             tab3.ELIG_DSBLTY_CTG_FLAG,
422             tab3.ELIG_DSBLTY_RSN_FLAG,
423             tab3.ELIG_DSBLTY_DGR_FLAG,
424             tab3.ELIG_SUPPL_ROLE_FLAG,
425             tab3.ELIG_QUAL_TITL_FLAG,
426             tab3.ELIG_PSTN_FLAG,
427             tab3.ELIG_PRBTN_PERD_FLAG,
428             tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
429             tab3.BNFT_CAGR_PRTN_CD,
430             tab3.ELIG_DSBLD_FLAG,
431             tab3.ELIG_TTL_CVG_VOL_FLAG,
432             tab3.ELIG_TTL_PRTT_FLAG,
433             tab3.ELIG_COMPTNCY_FLAG,
434             tab3.ELIG_HLTH_CVG_FLAG,
435             tab3.ELIG_ANTHR_PL_FLAG,
436             tab3.elig_qua_in_gr_flag,
437             tab3.elig_perf_rtng_flag,
438             tab3.elig_crit_values_flag
439     from  ben_prtn_elig_f tab1,
440           ben_prtn_elig_prfl_f tab2,
441           ben_eligy_prfl_f tab3
442     where tab1.pl_id = c_pl_id
443     and tab1.prtn_elig_id = tab2.prtn_elig_id
444     and c_effective_date
445       between tab1.effective_start_date
446         and tab1.effective_end_date
447     and tab2.eligy_prfl_id = tab3.eligy_prfl_id
448     and tab3.stat_cd = 'A'                         -- bug 2431753 -- consider only active profiles
449     and c_effective_date
450       between tab2.effective_start_date
451         and tab2.effective_end_date
452     and c_effective_date
453       between tab3.effective_start_date
454     and tab3.effective_end_date
455     order by tab1.pgm_id,
456              tab1.ptip_id,
457              tab1.plip_id,
458              tab1.pl_id,
459              tab1.oipl_id,
460              decode(tab2.mndtry_flag,'Y',1,2);
461   --
462   cursor c_oiplinstance
463     (c_oipl_id        number
464     ,c_effective_date date
465     )
466   is
467     select  /*+ bencepch.write_cobcep_odcache.c_oiplinstance */
468             tab1.pgm_id,
469             tab1.ptip_id,
470             tab1.plip_id,
471             tab1.pl_id,
472             tab1.oipl_id,
473             -- Grade/Step
474             null vrbl_rt_prfl_id,
475             -- Grade/Step
476             tab1.prtn_elig_id,
477             tab1.trk_scr_for_inelg_flag,
478             tab2.compute_score_flag,
479             tab2.mndtry_flag,
480             tab3.eligy_prfl_id,
481             tab3.asmt_to_use_cd,
482             tab3.elig_enrld_plip_flag,
483             tab3.elig_cbr_quald_bnf_flag,
484             tab3.elig_enrld_ptip_flag,
485             tab3.elig_dpnt_cvrd_plip_flag,
486             tab3.elig_dpnt_cvrd_ptip_flag,
487             tab3.elig_dpnt_cvrd_pgm_flag,
488             tab3.elig_job_flag,
489             tab3.elig_hrly_slrd_flag,
490             tab3.elig_pstl_cd_flag,
491             tab3.elig_lbr_mmbr_flag,
492             tab3.elig_lgl_enty_flag,
493             tab3.elig_benfts_grp_flag,
494             tab3.elig_wk_loc_flag,
495             tab3.elig_brgng_unit_flag,
496             tab3.elig_age_flag,
497             tab3.elig_los_flag,
498             tab3.elig_per_typ_flag,
499             tab3.elig_fl_tm_pt_tm_flag,
500             tab3.elig_ee_stat_flag,
501             tab3.elig_grd_flag,
502             tab3.elig_pct_fl_tm_flag,
503             tab3.elig_asnt_set_flag,
504             tab3.elig_hrs_wkd_flag,
505             tab3.elig_comp_lvl_flag,
506             tab3.elig_org_unit_flag,
507             tab3.elig_loa_rsn_flag,
508             tab3.elig_pyrl_flag,
509             tab3.elig_schedd_hrs_flag,
510             tab3.elig_py_bss_flag,
511             tab3.eligy_prfl_rl_flag,
512             tab3.elig_cmbn_age_los_flag,
513             tab3.cntng_prtn_elig_prfl_flag,
514             tab3.elig_prtt_pl_flag,
515             tab3.elig_ppl_grp_flag,
516             tab3.elig_svc_area_flag,
517             tab3.elig_ptip_prte_flag,
518             tab3.elig_no_othr_cvg_flag,
519             tab3.elig_enrld_pl_flag,
520             tab3.elig_enrld_oipl_flag,
521             tab3.elig_enrld_pgm_flag,
522             tab3.elig_dpnt_cvrd_pl_flag,
523             tab3.elig_lvg_rsn_flag,
524             tab3.elig_optd_mdcr_flag,
525             tab3.elig_tbco_use_flag,
526             tab3.elig_dpnt_othr_ptip_flag,
527             tab3.ELIG_GNDR_FLAG,
528             tab3.ELIG_MRTL_STS_FLAG,
529             tab3.ELIG_DSBLTY_CTG_FLAG,
530             tab3.ELIG_DSBLTY_RSN_FLAG,
531             tab3.ELIG_DSBLTY_DGR_FLAG,
532             tab3.ELIG_SUPPL_ROLE_FLAG,
533             tab3.ELIG_QUAL_TITL_FLAG,
534             tab3.ELIG_PSTN_FLAG,
535             tab3.ELIG_PRBTN_PERD_FLAG,
536             tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
537             tab3.BNFT_CAGR_PRTN_CD,
538             tab3.ELIG_DSBLD_FLAG,
539             tab3.ELIG_TTL_CVG_VOL_FLAG,
540             tab3.ELIG_TTL_PRTT_FLAG,
541             tab3.ELIG_COMPTNCY_FLAG,
542             tab3.ELIG_HLTH_CVG_FLAG,
543             tab3.ELIG_ANTHR_PL_FLAG,
544             tab3.elig_qua_in_gr_flag,
545             tab3.elig_perf_rtng_flag,
546             tab3.elig_crit_values_flag
547     from  ben_prtn_elig_f tab1,
548           ben_prtn_elig_prfl_f tab2,
549           ben_eligy_prfl_f tab3
550     where tab1.oipl_id = c_oipl_id
551     and tab1.prtn_elig_id = tab2.prtn_elig_id
552     and c_effective_date
553       between tab1.effective_start_date
554         and tab1.effective_end_date
555     and tab2.eligy_prfl_id = tab3.eligy_prfl_id
556     and tab3.stat_cd = 'A'                         -- bug 2431753 -- consider only active profiles
557     and c_effective_date
558       between tab2.effective_start_date
559         and tab2.effective_end_date
560     and c_effective_date
561       between tab3.effective_start_date
562     and tab3.effective_end_date
563     order by tab1.pgm_id,
564              tab1.ptip_id,
565              tab1.plip_id,
566              tab1.pl_id,
567              tab1.oipl_id,
568              decode(tab2.mndtry_flag,'Y',1,2);
569   --
570   -- Grade/Step
571   cursor c_vpfinstance
572     (c_vrbl_rt_prfl_id         number
573     ,c_effective_date          date
574     )
575   is
576     select  /*+ bencepch.write_cobcep_odcache.c_vpfinstance */
577             null pgm_id,
578             null ptip_id,
579             null plip_id,
580             null pl_id,
581             null oipl_id,
582             tab1.vrbl_rt_prfl_id, -- 9999 Needs to be added as null to other cursors
583             null prtn_elig_id, -- Modified 9999 check how it is used?
584             'N' trk_scr_for_inelg_flag,
585             'N' compute_score_flag,
586             tab2.mndtry_flag, -- comes from ben_vrbl_rt_eligy_prfl_f
587             tab3.eligy_prfl_id,
588             tab3.asmt_to_use_cd,
589             tab3.elig_enrld_plip_flag,
590             tab3.elig_cbr_quald_bnf_flag,
591             tab3.elig_enrld_ptip_flag,
592             tab3.elig_dpnt_cvrd_plip_flag,
593             tab3.elig_dpnt_cvrd_ptip_flag,
594             tab3.elig_dpnt_cvrd_pgm_flag,
595             tab3.elig_job_flag,
596             tab3.elig_hrly_slrd_flag,
597             tab3.elig_pstl_cd_flag,
598             tab3.elig_lbr_mmbr_flag,
599             tab3.elig_lgl_enty_flag,
600             tab3.elig_benfts_grp_flag,
601             tab3.elig_wk_loc_flag,
602             tab3.elig_brgng_unit_flag,
603             tab3.elig_age_flag,
604             tab3.elig_los_flag,
605             tab3.elig_per_typ_flag,
606             tab3.elig_fl_tm_pt_tm_flag,
607             tab3.elig_ee_stat_flag,
608             tab3.elig_grd_flag,
609             tab3.elig_pct_fl_tm_flag,
610             tab3.elig_asnt_set_flag,
611             tab3.elig_hrs_wkd_flag,
612             tab3.elig_comp_lvl_flag,
613             tab3.elig_org_unit_flag,
614             tab3.elig_loa_rsn_flag,
615             tab3.elig_pyrl_flag,
616             tab3.elig_schedd_hrs_flag,
617             tab3.elig_py_bss_flag,
618             tab3.eligy_prfl_rl_flag,
619             tab3.elig_cmbn_age_los_flag,
620             tab3.cntng_prtn_elig_prfl_flag,
621             tab3.elig_prtt_pl_flag,
622             tab3.elig_ppl_grp_flag,
623             tab3.elig_svc_area_flag,
624             tab3.elig_ptip_prte_flag,
625             tab3.elig_no_othr_cvg_flag,
626             tab3.elig_enrld_pl_flag,
627             tab3.elig_enrld_oipl_flag,
628             tab3.elig_enrld_pgm_flag,
629             tab3.elig_dpnt_cvrd_pl_flag,
630             tab3.elig_lvg_rsn_flag,
631             tab3.elig_optd_mdcr_flag,
632             tab3.elig_tbco_use_flag,
633             tab3.elig_dpnt_othr_ptip_flag,
634             tab3.ELIG_GNDR_FLAG,
635             tab3.ELIG_MRTL_STS_FLAG,
636             tab3.ELIG_DSBLTY_CTG_FLAG,
637             tab3.ELIG_DSBLTY_RSN_FLAG,
638             tab3.ELIG_DSBLTY_DGR_FLAG,
639             tab3.ELIG_SUPPL_ROLE_FLAG,
640             tab3.ELIG_QUAL_TITL_FLAG,
641             tab3.ELIG_PSTN_FLAG,
642             tab3.ELIG_PRBTN_PERD_FLAG,
643             tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
644             tab3.BNFT_CAGR_PRTN_CD,
645             tab3.ELIG_DSBLD_FLAG,
646             tab3.ELIG_TTL_CVG_VOL_FLAG,
647             tab3.ELIG_TTL_PRTT_FLAG,
648             tab3.ELIG_COMPTNCY_FLAG,
649             tab3.ELIG_HLTH_CVG_FLAG,
650             tab3.ELIG_ANTHR_PL_FLAG,
651             tab3.elig_qua_in_gr_flag,
652             tab3.elig_perf_rtng_flag,
653             tab3.elig_crit_values_flag
654     from  ben_vrbl_rt_prfl_f tab1,
655           ben_vrbl_rt_elig_prfl_f tab2,
656           ben_eligy_prfl_f tab3
657     where tab1.vrbl_rt_prfl_id = c_vrbl_rt_prfl_id
658     and tab1.vrbl_rt_prfl_id = tab2.vrbl_rt_prfl_id
659     and c_effective_date
660       between tab1.effective_start_date
661         and tab1.effective_end_date
662     and tab2.eligy_prfl_id = tab3.eligy_prfl_id
663     and tab3.stat_cd = 'A'
664     and c_effective_date
665       between tab2.effective_start_date
666         and tab2.effective_end_date
667     and c_effective_date
668       between tab3.effective_start_date
669     and tab3.effective_end_date
670     order by 1, -- tab1.pgm_id, -- 9999 Add similar kind of order by clause to other cursors
671              2, -- tab1.ptip_id,
672              3, -- tab1.plip_id,
673              4, -- tab1.pl_id,
674              5, -- tab1.oipl_id,
675              6, -- tab1.vrbl_rt_prfl_id,
676              decode(tab2.mndtry_flag,'Y',1,2);
677   --
678   -- Grade/Step
679 begin
680   --
681   hr_utility.set_location(' Entering  '||l_proc,10);
682   --
683   -- Get the instance details
684   --
685   l_hv := mod(nvl(p_pgm_id,1)+nvl(p_ptip_id,2)+nvl(p_plip_id,3)
686           +nvl(p_pl_id,4)+nvl(p_oipl_id,5)
687           +nvl(p_vrbl_rt_prfl_id,6) -- Grade/Step
688           ,ben_cep_cache.g_hash_key);
689   --
690   -- Get a unique hash value
691   --
692   if ben_cep_cache.g_copcep_odlookup.exists(l_hv) then
693     --
694     if nvl(ben_cep_cache.g_copcep_odlookup(l_hv).id,-1)        = nvl(p_pgm_id,-1)
695       and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk_id,-1)  = nvl(p_ptip_id,-1)
696       and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
697       and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
698       and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
699       and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk4_id,-1) = nvl(p_vrbl_rt_prfl_id,-1)  -- Grade/Step
700     then
701       --
702       null;
703       --
704     else
705       --
706       l_not_hash_found := false;
707       --
708       -- Loop until un-allocated has value is derived
709       --
710       while not l_not_hash_found loop
711         --
712         l_hv := l_hv+ben_cep_cache.g_hash_jump;
713 /*
714         l_hv := ben_hash_utility.get_next_hash_index(p_hash_index => l_hv);
715 */
716         --
717         -- Check if the hash index exists, and compare the values
718         --
719         if ben_cep_cache.g_copcep_odlookup.exists(l_hv) then
720           --
721           if nvl(ben_cep_cache.g_copcep_odlookup(l_hv).id,-1)        = nvl(p_pgm_id,-1)
722             and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk_id,-1)  = nvl(p_ptip_id,-1)
723             and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
724             and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
725             and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
726             and nvl(ben_cep_cache.g_copcep_odlookup(l_hv).fk4_id,-1) = nvl(p_vrbl_rt_prfl_id,-1)  -- Grade/Step
727           then
728             --
729             l_not_hash_found := true;
730             exit;
731             --
732           else
733             --
734             l_not_hash_found := false;
735             --
736           end if;
737           --
738         else
739           --
740           exit;
741           --
742         end if;
743         --
744       end loop;
745       --
746     end if;
747     --
748   end if;
749   --
750   ben_cep_cache.g_copcep_odlookup(l_hv).id     := p_pgm_id;
751   ben_cep_cache.g_copcep_odlookup(l_hv).fk_id  := p_ptip_id;
752   ben_cep_cache.g_copcep_odlookup(l_hv).fk1_id := p_plip_id;
753   ben_cep_cache.g_copcep_odlookup(l_hv).fk2_id := p_pl_id;
754   ben_cep_cache.g_copcep_odlookup(l_hv).fk3_id := p_oipl_id;
755   ben_cep_cache.g_copcep_odlookup(l_hv).fk4_id := p_vrbl_rt_prfl_id;
756   --
757   hr_utility.set_location(' Dn Look  '||l_proc,10);
758   --
759   l_starttorele_num := nvl(ben_cep_cache.g_copcep_nxelenum,1);
760   l_torrwnum        := l_starttorele_num;
761   --
762   hr_utility.set_location(' Bef inst loop  '||l_proc,10);
763   --
764   if p_pgm_id is not null then
765     --
766     open c_pgminstance
767       (c_pgm_id         => p_pgm_id
768       ,c_effective_date => p_effective_date
769       );
770     --
771   elsif p_ptip_id is not null then
772     --
773     open c_ptipinstance
774       (c_ptip_id        => p_ptip_id
775       ,c_effective_date => p_effective_date
776       );
777     --
778   elsif p_plip_id is not null then
779     --
780     open c_plipinstance
781       (c_plip_id        => p_plip_id
782       ,c_effective_date => p_effective_date
783       );
784     --
785   elsif p_pl_id is not null then
786     --
787     open c_plinstance
788       (c_pl_id          => p_pl_id
789       ,c_effective_date => p_effective_date
790       );
791     --
792   elsif p_oipl_id is not null then
793     --
794     open c_oiplinstance
795       (c_oipl_id        => p_oipl_id
796       ,c_effective_date => p_effective_date
797       );
798     --
799   -- Grade/Step
800   elsif p_vrbl_rt_prfl_id is not null then
801     --
802     open c_vpfinstance
803       (c_vrbl_rt_prfl_id        => p_vrbl_rt_prfl_id
804       ,c_effective_date => p_effective_date
805       );
806     --
807   end if;
808   --
809   loop
810     --
811     if p_pgm_id is not null then
812       --
813       fetch c_pgminstance into l_instance;
814       exit when c_pgminstance%NOTFOUND;
815       --
816     elsif p_ptip_id is not null then
817       --
818       fetch c_ptipinstance into l_instance;
819       exit when c_ptipinstance%NOTFOUND;
820       --
821     elsif p_plip_id is not null then
822       --
823       fetch c_plipinstance into l_instance;
824       exit when c_plipinstance%NOTFOUND;
825       --
826     elsif p_pl_id is not null then
827       --
828       fetch c_plinstance into l_instance;
829       exit when c_plinstance%NOTFOUND;
830       --
831     elsif p_oipl_id is not null then
832       --
833       fetch c_oiplinstance into l_instance;
834       exit when c_oiplinstance%NOTFOUND;
835       --
836     -- Grade/Step
837     elsif p_vrbl_rt_prfl_id is not null then
838       --
839       fetch c_vpfinstance into l_instance;
840       exit when c_vpfinstance%NOTFOUND;
841       --
842     end if;
843     --
844     hr_utility.set_location(' Assign inst  '||l_proc,10);
845     --
846     ben_cep_cache.g_copcep_odinst.extend(1);
847     ben_cep_cache.g_copcep_odinst(l_torrwnum).pgm_id                   := l_instance.pgm_id;
848     ben_cep_cache.g_copcep_odinst(l_torrwnum).ptip_id                  := l_instance.ptip_id;
849     ben_cep_cache.g_copcep_odinst(l_torrwnum).plip_id                  := l_instance.plip_id;
850     ben_cep_cache.g_copcep_odinst(l_torrwnum).pl_id                    := l_instance.pl_id;
851     ben_cep_cache.g_copcep_odinst(l_torrwnum).oipl_id                  := l_instance.oipl_id;
852     -- Grade/Step
853     ben_cep_cache.g_copcep_odinst(l_torrwnum).vrbl_rt_prfl_id      := l_instance.vrbl_rt_prfl_id;
854     ben_cep_cache.g_copcep_odinst(l_torrwnum).prtn_elig_id             := l_instance.prtn_elig_id;
855     ben_cep_cache.g_copcep_odinst(l_torrwnum).trk_scr_for_inelg_flag   := l_instance.trk_scr_for_inelg_flag;
856     ben_cep_cache.g_copcep_odinst(l_torrwnum).compute_score_flag       := l_instance.compute_score_flag;
857     ben_cep_cache.g_copcep_odinst(l_torrwnum).mndtry_flag              := l_instance.mndtry_flag;
858     ben_cep_cache.g_copcep_odinst(l_torrwnum).eligy_prfl_id            := l_instance.eligy_prfl_id;
859     ben_cep_cache.g_copcep_odinst(l_torrwnum).asmt_to_use_cd           := l_instance.asmt_to_use_cd;
860     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_enrld_plip_flag     := l_instance.elig_enrld_plip_flag;
861     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_cbr_quald_bnf_flag  := l_instance.elig_cbr_quald_bnf_flag;
862     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_enrld_ptip_flag     := l_instance.elig_enrld_ptip_flag;
863     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_plip_flag := l_instance.elig_dpnt_cvrd_plip_flag;
864     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_ptip_flag := l_instance.elig_dpnt_cvrd_ptip_flag;
865     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_pgm_flag  := l_instance.elig_dpnt_cvrd_pgm_flag;
866     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_job_flag            := l_instance.elig_job_flag;
867     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_hrly_slrd_flag      := l_instance.elig_hrly_slrd_flag;
868     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_pstl_cd_flag        := l_instance.elig_pstl_cd_flag;
869     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_lbr_mmbr_flag       := l_instance.elig_lbr_mmbr_flag;
870     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_lgl_enty_flag       := l_instance.elig_lgl_enty_flag;
871     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_benfts_grp_flag     := l_instance.elig_benfts_grp_flag;
872     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_wk_loc_flag         := l_instance.elig_wk_loc_flag;
873     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_brgng_unit_flag     := l_instance.elig_brgng_unit_flag;
874     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_age_flag            := l_instance.elig_age_flag;
875     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_los_flag            := l_instance.elig_los_flag;
876     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_per_typ_flag        := l_instance.elig_per_typ_flag;
877     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_fl_tm_pt_tm_flag    := l_instance.elig_fl_tm_pt_tm_flag;
878     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_ee_stat_flag        := l_instance.elig_ee_stat_flag;
879     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_grd_flag            := l_instance.elig_grd_flag;
880     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_pct_fl_tm_flag      := l_instance.elig_pct_fl_tm_flag;
881     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_asnt_set_flag       := l_instance.elig_asnt_set_flag;
882     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_hrs_wkd_flag        := l_instance.elig_hrs_wkd_flag;
883     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_comp_lvl_flag       := l_instance.elig_comp_lvl_flag;
884     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_org_unit_flag       := l_instance.elig_org_unit_flag;
885     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_loa_rsn_flag        := l_instance.elig_loa_rsn_flag;
886     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_pyrl_flag           := l_instance.elig_pyrl_flag;
887     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_schedd_hrs_flag     := l_instance.elig_schedd_hrs_flag;
888     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_py_bss_flag         := l_instance.elig_py_bss_flag;
889     ben_cep_cache.g_copcep_odinst(l_torrwnum).eligy_prfl_rl_flag       := l_instance.eligy_prfl_rl_flag;
890     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_cmbn_age_los_flag   := l_instance.elig_cmbn_age_los_flag;
891     ben_cep_cache.g_copcep_odinst(l_torrwnum).cntng_prtn_elig_prfl_flag := l_instance.cntng_prtn_elig_prfl_flag;
892     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_prtt_pl_flag         := l_instance.elig_prtt_pl_flag;
893     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_ppl_grp_flag         := l_instance.elig_ppl_grp_flag;
894     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_svc_area_flag        := l_instance.elig_svc_area_flag;
895     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_ptip_prte_flag       := l_instance.elig_ptip_prte_flag;
896     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_no_othr_cvg_flag     := l_instance.elig_no_othr_cvg_flag;
897     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_enrld_pl_flag        := l_instance.elig_enrld_pl_flag;
898     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_enrld_oipl_flag      := l_instance.elig_enrld_oipl_flag;
899     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_enrld_pgm_flag       := l_instance.elig_enrld_pgm_flag;
900     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_pl_flag    := l_instance.elig_dpnt_cvrd_pl_flag;
901     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_lvg_rsn_flag         := l_instance.elig_lvg_rsn_flag;
902     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_optd_mdcr_flag       := l_instance.elig_optd_mdcr_flag;
903     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_tbco_use_flag        := l_instance.elig_tbco_use_flag;
904     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_dpnt_othr_ptip_flag  := l_instance.elig_dpnt_othr_ptip_flag;
905     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_GNDR_FLAG 		  := l_instance.ELIG_GNDR_FLAG 		;
906     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_MRTL_STS_FLAG 	  := l_instance.ELIG_MRTL_STS_FLAG 	;
907     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_DSBLTY_CTG_FLAG 	  := l_instance.ELIG_DSBLTY_CTG_FLAG 	;
908     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_DSBLTY_RSN_FLAG 	  := l_instance.ELIG_DSBLTY_RSN_FLAG 	;
909     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_DSBLTY_DGR_FLAG 	  := l_instance.ELIG_DSBLTY_DGR_FLAG 	;
910     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_SUPPL_ROLE_FLAG 	  := l_instance.ELIG_SUPPL_ROLE_FLAG 	;
911     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_QUAL_TITL_FLAG 	  := l_instance.ELIG_QUAL_TITL_FLAG 	;
912     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_PSTN_FLAG 		  := l_instance.ELIG_PSTN_FLAG 		;
913     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_PRBTN_PERD_FLAG 	  := l_instance.ELIG_PRBTN_PERD_FLAG 	;
914     ben_cep_cache.g_copcep_odinst(l_torrwnum).ELIG_SP_CLNG_PRG_PT_FLAG  := l_instance.ELIG_SP_CLNG_PRG_PT_FLAG;
915     ben_cep_cache.g_copcep_odinst(l_torrwnum).BNFT_CAGR_PRTN_CD 	  := l_instance.BNFT_CAGR_PRTN_CD 	;
916     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_dsbld_flag 	  := l_instance.elig_dsbld_flag 	;
917     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_ttl_cvg_vol_flag 	  := l_instance.elig_ttl_cvg_vol_flag 	;
918     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_ttl_prtt_flag 	  := l_instance.elig_ttl_prtt_flag 	;
919     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_comptncy_flag 	  := l_instance.elig_comptncy_flag 	;
920     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_hlth_cvg_flag 	  := l_instance.elig_hlth_cvg_flag 	;
921     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_anthr_pl_flag 	  := l_instance.elig_anthr_pl_flag 	;
922     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_qua_in_gr_flag	  := l_instance.elig_qua_in_gr_flag	;
923     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_perf_rtng_flag	  := l_instance.elig_perf_rtng_flag	;
924     ben_cep_cache.g_copcep_odinst(l_torrwnum).elig_crit_values_flag       := l_instance.elig_crit_values_flag	;
925     hr_utility.set_location(' Dn Assign inst  '||l_proc,10);
926     --
927     l_torrwnum := l_torrwnum+1;
928     --
929   end loop;
930   --
931   if p_pgm_id is not null then
932     --
933     close c_pgminstance;
934     --
935   elsif p_ptip_id is not null then
936     --
937     close c_ptipinstance;
938     --
939   elsif p_plip_id is not null then
940     --
941     close c_plipinstance;
942     --
943   elsif p_pl_id is not null then
944     --
945     close c_plinstance;
946     --
947   elsif p_oipl_id is not null then
948     --
949     close c_oiplinstance;
950     --
951   elsif p_vrbl_rt_prfl_id is not null then
952     --
953     close c_vpfinstance;
954     --
955   end if;
956   --
957   -- Check if any rows were found
958   --
959   if l_torrwnum > nvl(ben_cep_cache.g_copcep_nxelenum,1)
960   then
961     --
962     ben_cep_cache.g_copcep_odlookup(l_hv).starttorele_num := l_starttorele_num;
963     ben_cep_cache.g_copcep_odlookup(l_hv).endtorele_num   := l_torrwnum-1;
964     ben_cep_cache.g_copcep_nxelenum := l_torrwnum;
965     --
966     p_hv := l_hv;
967     --
968   else
969     --
970     -- Delete and free PGA with assignment
971     --
972     ben_cep_cache.g_copcep_odlookup.delete(l_hv);
973     ben_cep_cache.g_copcep_odlookup(l_hv) := l_copcep_odlookup_rec;
974     --
975 /*
976     ben_cep_cache.g_copcep_odlookup(l_hv).starttorele_num := null;
977     ben_cep_cache.g_copcep_odlookup(l_hv).endtorele_num   := null;
978 */
979 /*
980     ben_cep_cache.g_copcep_odlookup(l_hv).id              := null;
981     ben_cep_cache.g_copcep_odlookup(l_hv).fk_id           := null;
982     ben_cep_cache.g_copcep_odlookup(l_hv).fk1_id          := null;
983     ben_cep_cache.g_copcep_odlookup(l_hv).fk2_id          := null;
984     ben_cep_cache.g_copcep_odlookup(l_hv).fk3_id          := null;
985     ben_cep_cache.g_copcep_odlookup(l_hv).starttorele_num := null;
986     ben_cep_cache.g_copcep_odlookup(l_hv).endtorele_num   := null;
987 */
988     p_hv := null;
989     --
990   end if;
991   --
992   hr_utility.set_location(' Leaving  '||l_proc,10);
993 end write_cobcep_odcache;
994 --
995 end ben_cep_cache1;