[Home] [Help]
PACKAGE BODY: APPS.BEN_ELP_CACHE
Source
4 -- Declare globals
1 PACKAGE BODY ben_elp_cache as
2 /* $Header: benelpch.pkb 120.4 2011/12/09 08:50:06 usaraswa ship $ */
3 --
5 --
6 g_package varchar2(50) := 'ben_elp_cache.';
7 g_hash_key number := ben_hash_utility.get_hash_key;
8 g_hash_jump number := ben_hash_utility.get_hash_jump;
9 --
10 -- cobcep
11 --
12 g_cobcep_lookup ben_cache.g_cache_lookup_table;
13 g_cobcep_inst ben_elp_cache.g_cobcep_cache;
14 g_cobcep_cached boolean := FALSE;
15 --
16 -- eligibility profile person type by eligibility profile
17 --
18 g_cache_elpept_lookup ben_cache.g_cache_lookup_table;
19 g_cache_elpept_inst ben_elp_cache.g_cache_elpept_instor;
20 --
21 -- eligibility profile people group by eligibility profile
22 --
23 g_cache_elpepg_lookup ben_cache.g_cache_lookup_table;
24 g_cache_elpepg_inst ben_elp_cache.g_cache_elpepg_instor;
25 --
26 -- eligibility profile rule by eligibility profile
27 --
28 g_cache_elperl_lookup ben_cache.g_cache_lookup_table;
29 g_cache_elperl_inst ben_elp_cache.g_cache_elperl_instor;
30 --
31 -- eligibility profile assignment status type by eligibility profile
32 --
33 g_cache_elpees_lookup ben_cache.g_cache_lookup_table;
34 g_cache_elpees_inst ben_elp_cache.g_cache_elpees_instor;
35 --
36 -- eligibility profile length of service by eligibility profile
37 --
38 g_cache_elpels_lookup ben_cache.g_cache_lookup_table;
39 g_cache_elpels_inst ben_elp_cache.g_cache_elpels_instor;
40 --
41 -- eligibility profile age/los combination by eligibility profile
42 --
43 g_cache_elpecp_lookup ben_cache.g_cache_lookup_table;
44 g_cache_elpecp_inst ben_elp_cache.g_cache_elpecp_instor;
45 --
46 -- eligibility profile location by eligibility profile
47 --
48 g_cache_elpewl_lookup ben_cache.g_cache_lookup_table;
49 g_cache_elpewl_inst ben_elp_cache.g_cache_elpewl_instor;
50 --
51 -- eligibility profile assignment set by eligibility profile
52 --
53 g_cache_elpean_lookup ben_cache.g_cache_lookup_table;
54 g_cache_elpean_inst ben_elp_cache.g_cache_elpean_instor;
55 --
56 -- eligibility profile organization by eligibility profile
57 --
58 g_cache_elpeou_lookup ben_cache.g_cache_lookup_table;
59 g_cache_elpeou_inst ben_elp_cache.g_cache_elpeou_instor;
60 --
61 -- eligibility profile pay frequency by eligibility profile
62 --
63 g_cache_elpehs_lookup ben_cache.g_cache_lookup_table;
64 g_cache_elpehs_inst ben_elp_cache.g_cache_elpehs_instor;
65 --
66 -- eligibility profile full/part time by eligibility profile
67 --
68 g_cache_elpefp_lookup ben_cache.g_cache_lookup_table;
69 g_cache_elpefp_inst ben_elp_cache.g_cache_elpefp_instor;
70 --
71 -- eligibility profile scheduled hours by eligibility profile
72 --
73 g_cache_elpesh_lookup ben_cache.g_cache_lookup_table;
74 g_cache_elpesh_inst ben_elp_cache.g_cache_elpesh_instor;
75 --
76 -- eligibility profile compensation level by eligibility profile
77 --
78 g_cache_elpecl_lookup ben_cache.g_cache_lookup_table;
79 g_cache_elpecl_inst ben_elp_cache.g_cache_elpecl_instor;
80 --
81 -- eligibility profile hours worked by eligibility profile
82 --
83 g_cache_elpehw_lookup ben_cache.g_cache_lookup_table;
84 g_cache_elpehw_inst ben_elp_cache.g_cache_elpehw_instor;
85 --
86 -- eligibility profile full time by eligibility profile
87 --
88 g_cache_elpepf_lookup ben_cache.g_cache_lookup_table;
89 g_cache_elpepf_inst ben_elp_cache.g_cache_elpepf_instor;
90 --
91 -- eligibility profile grade by eligibility profile
92 --
93 g_cache_elpegr_lookup ben_cache.g_cache_lookup_table;
94 g_cache_elpegr_inst ben_elp_cache.g_cache_elpegr_instor;
95 --
96 -- eligibility profile sex by eligibility profile
97 --
98 g_cache_elpegn_lookup ben_cache.g_cache_lookup_table;
99 g_cache_elpegn_inst ben_elp_cache.g_cache_elpegn_instor;
100 --
101 -- eligibility profile job by eligibility profile
102 --
103 g_cache_elpejp_lookup ben_cache.g_cache_lookup_table;
104 g_cache_elpejp_inst ben_elp_cache.g_cache_elpejp_instor;
105 --
106 -- eligibility profile pay basis by eligibility profile
107 --
108 g_cache_elpepb_lookup ben_cache.g_cache_lookup_table;
109 g_cache_elpepb_inst ben_elp_cache.g_cache_elpepb_instor;
110 --
111 -- eligibility profile service area by eligibility profile
112 --
113 g_cache_elpesa_lookup ben_cache.g_cache_lookup_table;
114 g_cache_elpesa_inst ben_elp_cache.g_cache_elpesa_instor;
115 --
116 -- eligibility profile payroll by eligibility profile
117 --
118 g_cache_elpepy_lookup ben_cache.g_cache_lookup_table;
119 g_cache_elpepy_inst ben_elp_cache.g_cache_elpepy_instor;
120 --
121 -- eligibility profile bargaining unit by eligibility profile
122 --
123 g_cache_elpebu_lookup ben_cache.g_cache_lookup_table;
124 g_cache_elpebu_inst ben_elp_cache.g_cache_elpebu_instor;
125 --
126 -- eligibility profile labour union membership by eligibility profile
127 --
128 g_cache_elpelu_lookup ben_cache.g_cache_lookup_table;
129 g_cache_elpelu_inst ben_elp_cache.g_cache_elpelu_instor;
130 --
131 -- eligibility profile leave of absence reason by eligibility profile
132 --
133 g_cache_elpelr_lookup ben_cache.g_cache_lookup_table;
134 g_cache_elpelr_inst ben_elp_cache.g_cache_elpelr_instor;
135 --
136 -- eligibility profile age details by eligibility profile
137 --
138 g_cache_elpeap_lookup ben_cache.g_cache_lookup_table;
139 g_cache_elpeap_inst ben_elp_cache.g_cache_elpeap_instor;
140 --
141 -- eligibility profile zip code range by eligibility profile
142 --
143 g_cache_elpepz_lookup ben_cache.g_cache_lookup_table;
144 g_cache_elpepz_inst ben_elp_cache.g_cache_elpepz_instor;
145 --
146 -- eligibility profile benefits group by eligibility profile
147 --
148 g_cache_elpebn_lookup ben_cache.g_cache_lookup_table;
149 g_cache_elpebn_inst ben_elp_cache.g_cache_elpebn_instor;
150 --
151 -- eligibility profile legal entity by eligibility profile
152 --
153 g_cache_elpeln_lookup ben_cache.g_cache_lookup_table;
154 g_cache_elpeln_inst ben_elp_cache.g_cache_elpeln_instor;
155 --
156 -- eligibility profile other plan by eligibility profile
157 --
158 g_cache_elpepp_lookup ben_cache.g_cache_lookup_table;
159 g_cache_elpepp_inst ben_elp_cache.g_cache_elpepp_instor;
160 --
161 -- eligibility profile elig other ptip by eligibility profile
162 --
163 g_cache_elpeoy_lookup ben_cache.g_cache_lookup_table;
164 g_cache_elpeoy_inst ben_elp_cache.g_cache_elpeoy_instor;
165 --
166 -- eligibility profile no other coverage participate by eligibility profile
167 --
168 g_cache_elpetd_lookup ben_cache.g_cache_lookup_table;
169 g_cache_elpetd_inst ben_elp_cache.g_cache_elpetd_instor;
170 --
171 -- eligibility profile no other dpnt coverage participate by elig profile
172 --
173 g_cache_elpeno_lookup ben_cache.g_cache_lookup_table;
174 g_cache_elpeno_inst ben_elp_cache.g_cache_elpeno_instor;
175 --
176 -- eligibility profile enrolled another plan by eligibility profile
177 --
178 g_cache_elpeep_lookup ben_cache.g_cache_lookup_table;
179 g_cache_elpeep_inst ben_elp_cache.g_cache_elpeep_instor;
180 --
181 -- eligibility profile enrolled in another oipl by eligibility profile
182 --
183 g_cache_elpeei_lookup ben_cache.g_cache_lookup_table;
184 g_cache_elpeei_inst ben_elp_cache.g_cache_elpeei_instor;
185 --
186 -- eligibility profile enrolled in another pgm by eligibility profile
187 --
188 g_cache_elpeeg_lookup ben_cache.g_cache_lookup_table;
189 g_cache_elpeeg_inst ben_elp_cache.g_cache_elpeeg_instor;
190 --
191 -- eligibility profile dependent covered other plan by eligibility profile
192 --
193 g_cache_elpedp_lookup ben_cache.g_cache_lookup_table;
194 g_cache_elpedp_inst ben_elp_cache.g_cache_elpedp_instor;
195 --
196 -- eligibility profile leaving reason participate by eligibility profile
197 --
198 g_cache_elpelv_lookup ben_cache.g_cache_lookup_table;
199 g_cache_elpelv_inst ben_elp_cache.g_cache_elpelv_instor;
200 --
201 -- eligibility profile opted for medicare participate by eligibility profile
202 --
203 g_cache_elpeom_lookup ben_cache.g_cache_lookup_table;
204 g_cache_elpeom_inst ben_elp_cache.g_cache_elpeom_instor;
205 --
206 -- eligibility profile enrolled in another plip by eligibility profile
207 --
208 g_cache_elpeai_lookup ben_cache.g_cache_lookup_table;
209 g_cache_elpeai_inst ben_elp_cache.g_cache_elpeai_instor;
210 --
211 -- eligibility profile dependent covered othr plip by eligibility profile
212 --
213 g_cache_elpedi_lookup ben_cache.g_cache_lookup_table;
214 g_cache_elpedi_inst ben_elp_cache.g_cache_elpedi_instor;
215 --
216 -- eligibility profile enrolled another ptip by eligibility profile
217 --
218 g_cache_elpeet_lookup ben_cache.g_cache_lookup_table;
219 g_cache_elpeet_inst ben_elp_cache.g_cache_elpeet_instor;
220 --
221 -- eligibility profile dependent covered in other ptip by eligibility profile
222 --
223 g_cache_elpedt_lookup ben_cache.g_cache_lookup_table;
224 g_cache_elpedt_inst ben_elp_cache.g_cache_elpedt_instor;
225 --
226 -- eligibility profile dependent covered in other program by eligibility profile
227 --
228 g_cache_elpedg_lookup ben_cache.g_cache_lookup_table;
229 g_cache_elpedg_inst ben_elp_cache.g_cache_elpedg_instor;
230 --
231 -- eligibility profile cobra qualified beneficiary by eligibility profile
232 --
233 g_cache_elpecq_lookup ben_cache.g_cache_lookup_table;
234 g_cache_elpecq_inst ben_elp_cache.g_cache_elpecq_instor;
235 --
236 g_copcep_odlookup ben_cache.g_cache_lookup_table;
237 g_copcep_nxelenum number;
238 g_copcep_odinst ben_elp_cache.g_cobcep_odcache := ben_elp_cache.g_cobcep_odcache();
239 g_copcep_odcached pls_integer := 0;
240 --
241 procedure write_cobcep_cache
242 (p_business_group_id in number
243 ,p_effective_date in date
244 )
245 is
246 --
247 l_proc varchar2(72) := g_package||'write_cobcep_cache';
248 --
249 l_torrwnum pls_integer;
250 l_prev_hv pls_integer;
251 l_hv pls_integer;
252 l_not_hash_found boolean;
253
254 cursor c_lookup
255 (c_business_group_id NUMBER
256 ,c_effective_date DATE
257 )
258 is
259 SELECT MAS1.PGM_ID,
260 MAS1.PTIP_ID,
261 MAS1.PLIP_ID,
262 MAS1.PL_ID,
263 MAS1.OIPL_ID
264 FROM BEN_PRTN_ELIG_F MAS1
265 WHERE MAS1.BUSINESS_GROUP_ID = c_business_group_id
266 AND c_effective_date
267 BETWEEN MAS1.EFFECTIVE_START_DATE AND MAS1.EFFECTIVE_END_DATE
268 and exists(select null
269 from ben_prtn_elig_prfl_f mas2
270 where mas1.prtn_elig_id = mas2.prtn_elig_id
271 AND c_effective_date
272 BETWEEN MAS2.EFFECTIVE_START_DATE AND MAS2.EFFECTIVE_END_DATE
273 )
274 ORDER BY MAS1.PGM_ID,
275 MAS1.PTIP_ID,
276 MAS1.PLIP_ID,
277 MAS1.PL_ID,
278 MAS1.OIPL_ID;
279 --
280 cursor c_instance
281 (c_business_group_id NUMBER
282 ,c_effective_date DATE
283 )
284 is
285 select tab1.pgm_id,
286 tab1.ptip_id,
287 tab1.plip_id,
288 tab1.pl_id,
289 tab1.oipl_id,
290 tab1.prtn_elig_id,
291 tab2.mndtry_flag,
292 tab3.eligy_prfl_id,
293 tab3.asmt_to_use_cd,
294 tab3.elig_enrld_plip_flag,
295 tab3.elig_cbr_quald_bnf_flag,
296 tab3.elig_enrld_ptip_flag,
297 tab3.elig_dpnt_cvrd_plip_flag,
298 tab3.elig_dpnt_cvrd_ptip_flag,
299 tab3.elig_dpnt_cvrd_pgm_flag,
300 tab3.elig_job_flag,
301 tab3.elig_hrly_slrd_flag,
302 tab3.elig_pstl_cd_flag,
303 tab3.elig_lbr_mmbr_flag,
304 tab3.elig_lgl_enty_flag,
305 tab3.elig_benfts_grp_flag,
306 tab3.elig_wk_loc_flag,
307 tab3.elig_brgng_unit_flag,
308 tab3.elig_age_flag,
309 tab3.elig_los_flag,
310 tab3.elig_per_typ_flag,
311 tab3.elig_fl_tm_pt_tm_flag,
312 tab3.elig_ee_stat_flag,
313 tab3.elig_grd_flag,
314 tab3.elig_pct_fl_tm_flag,
315 tab3.elig_asnt_set_flag,
316 tab3.elig_hrs_wkd_flag,
317 tab3.elig_comp_lvl_flag,
318 tab3.elig_org_unit_flag,
319 tab3.elig_loa_rsn_flag,
320 tab3.elig_pyrl_flag,
321 tab3.elig_schedd_hrs_flag,
322 tab3.elig_py_bss_flag,
323 tab3.eligy_prfl_rl_flag,
324 tab3.elig_cmbn_age_los_flag,
325 tab3.cntng_prtn_elig_prfl_flag,
326 tab3.elig_prtt_pl_flag,
327 tab3.elig_ppl_grp_flag,
328 tab3.elig_svc_area_flag,
329 tab3.elig_ptip_prte_flag,
330 tab3.elig_no_othr_cvg_flag,
331 tab3.elig_enrld_pl_flag,
332 tab3.elig_enrld_oipl_flag,
333 tab3.elig_enrld_pgm_flag,
334 tab3.elig_dpnt_cvrd_pl_flag,
335 tab3.elig_lvg_rsn_flag,
336 tab3.elig_optd_mdcr_flag,
337 tab3.elig_tbco_use_flag,
338 tab3.elig_dpnt_othr_ptip_flag,
339 tab3.ELIG_GNDR_FLAG,
340 tab3.ELIG_MRTL_STS_FLAG,
341 tab3.ELIG_DSBLTY_CTG_FLAG,
342 tab3.ELIG_DSBLTY_RSN_FLAG,
343 tab3.ELIG_DSBLTY_DGR_FLAG,
347 tab3.ELIG_PRBTN_PERD_FLAG,
344 tab3.ELIG_SUPPL_ROLE_FLAG,
345 tab3.ELIG_QUAL_TITL_FLAG,
346 tab3.ELIG_PSTN_FLAG,
348 tab3.ELIG_SP_CLNG_PRG_PT_FLAG,
349 tab3.BNFT_CAGR_PRTN_CD,
350 tab3.ELIG_DSBLD_FLAG,
351 tab3.ELIG_TTL_CVG_VOL_FLAG,
352 tab3.ELIG_TTL_PRTT_FLAG,
353 tab3.ELIG_COMPTNCY_FLAG,
354 tab3.ELIG_HLTH_CVG_FLAG,
355 tab3.ELIG_ANTHR_PL_FLAG
356 from ben_prtn_elig_f tab1,
357 ben_prtn_elig_prfl_f tab2,
358 ben_eligy_prfl_f tab3
359 where tab1.business_group_id = c_business_group_id
360 and tab1.prtn_elig_id = tab2.prtn_elig_id
361 and c_effective_date
362 between tab1.effective_start_date
363 and tab1.effective_end_date
364 and tab2.eligy_prfl_id = tab3.eligy_prfl_id
365 and c_effective_date
366 between tab2.effective_start_date
367 and tab2.effective_end_date
368 and c_effective_date
369 between tab3.effective_start_date
370 and tab3.effective_end_date
371 order by tab1.pgm_id,
372 tab1.ptip_id,
373 tab1.plip_id,
374 tab1.pl_id,
375 tab1.oipl_id,
376 decode(tab2.mndtry_flag,'Y',1,2);
377 --
378 begin
379 --
380 -- hr_utility.set_location(' Entering '||l_proc,10);
381 --
382 for row in c_lookup
383 (c_business_group_id => p_business_group_id
384 ,c_effective_date => p_effective_date
385 )
386 loop
387 --
388 l_hv := mod(nvl(row.pgm_id,1)+nvl(row.ptip_id,2)+nvl(row.plip_id,3)
389 +nvl(row.pl_id,4)+nvl(row.oipl_id,5),ben_hash_utility.get_hash_key);
390 --
391 while ben_elp_cache.g_cobcep_lookup.exists(l_hv)
392 loop
393 --
394 l_hv := l_hv+g_hash_jump;
395 --
396 end loop;
397 --
398 ben_elp_cache.g_cobcep_lookup(l_hv).id := row.pgm_id;
399 ben_elp_cache.g_cobcep_lookup(l_hv).fk_id := row.ptip_id;
400 ben_elp_cache.g_cobcep_lookup(l_hv).fk1_id := row.plip_id;
401 ben_elp_cache.g_cobcep_lookup(l_hv).fk2_id := row.pl_id;
402 ben_elp_cache.g_cobcep_lookup(l_hv).fk3_id := row.oipl_id;
403 --
404 end loop;
405 --
406 -- hr_utility.set_location(' Dn Look '||l_proc,10);
407 --
408 l_torrwnum := 0;
409 l_prev_hv := -1;
410 --
411 if ben_elp_cache.g_cobcep_lookup.count > 0 then
412 --
413 for objinst in c_instance
414 (c_business_group_id => p_business_group_id
415 ,c_effective_date => p_effective_date
416 )
417 loop
418 --
419 -- hr_utility.set_location(' St inst loop '||l_proc,10);
420 --
421 l_hv := mod(nvl(objinst.pgm_id,1)+nvl(objinst.ptip_id,2)+nvl(objinst.plip_id,3)
422 +nvl(objinst.pl_id,4)+nvl(objinst.oipl_id,5),ben_hash_utility.get_hash_key);
423 --
424 if nvl(ben_elp_cache.g_cobcep_lookup(l_hv).id,-1) = nvl(objinst.pgm_id,-1)
425 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk_id,-1) = nvl(objinst.ptip_id,-1)
426 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk1_id,-1) = nvl(objinst.plip_id,-1)
427 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk2_id,-1) = nvl(objinst.pl_id,-1)
428 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk3_id,-1) = nvl(objinst.oipl_id,-1)
429 then
430 --
431 null;
432 --
433 else
434 --
435 l_hv := l_hv+g_hash_jump;
436 --
437 loop
438 --
439 if nvl(ben_elp_cache.g_cobcep_lookup(l_hv).id,-1) = nvl(objinst.pgm_id,-1)
440 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk_id,-1) = nvl(objinst.ptip_id,-1)
441 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk1_id,-1) = nvl(objinst.plip_id,-1)
442 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk2_id,-1) = nvl(objinst.pl_id,-1)
443 and nvl(ben_elp_cache.g_cobcep_lookup(l_hv).fk3_id,-1) = nvl(objinst.oipl_id,-1)
444 then
445 --
446 exit;
447 --
448 else
449 --
450 l_hv := l_hv+g_hash_jump;
451 --
452 end if;
453 --
454 end loop;
455 --
456 end if;
457 --
458 if l_prev_hv = -1 then
459 ben_elp_cache.g_cobcep_lookup(l_hv).starttorele_num := l_torrwnum;
460 elsif l_hv <> l_prev_hv then
461 ben_elp_cache.g_cobcep_lookup(l_prev_hv).endtorele_num := l_torrwnum-1;
462 ben_elp_cache.g_cobcep_lookup(l_hv).starttorele_num := l_torrwnum;
463 end if;
464 --
465 -- hr_utility.set_location(' Assign inst '||l_proc,10);
466 --
467 g_cobcep_inst(l_torrwnum).pgm_id := objinst.pgm_id;
468 g_cobcep_inst(l_torrwnum).ptip_id := objinst.ptip_id;
469 g_cobcep_inst(l_torrwnum).plip_id := objinst.plip_id;
470 g_cobcep_inst(l_torrwnum).pl_id := objinst.pl_id;
471 g_cobcep_inst(l_torrwnum).oipl_id := objinst.oipl_id;
472 g_cobcep_inst(l_torrwnum).prtn_elig_id := objinst.prtn_elig_id;
473 g_cobcep_inst(l_torrwnum).mndtry_flag := objinst.mndtry_flag;
474 g_cobcep_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
475 g_cobcep_inst(l_torrwnum).asmt_to_use_cd := objinst.asmt_to_use_cd;
476 g_cobcep_inst(l_torrwnum).elig_enrld_plip_flag := objinst.elig_enrld_plip_flag;
477 g_cobcep_inst(l_torrwnum).elig_cbr_quald_bnf_flag := objinst.elig_cbr_quald_bnf_flag;
478 g_cobcep_inst(l_torrwnum).elig_enrld_ptip_flag := objinst.elig_enrld_ptip_flag;
479 g_cobcep_inst(l_torrwnum).elig_dpnt_cvrd_plip_flag := objinst.elig_dpnt_cvrd_plip_flag;
480 g_cobcep_inst(l_torrwnum).elig_dpnt_cvrd_ptip_flag := objinst.elig_dpnt_cvrd_ptip_flag;
481 g_cobcep_inst(l_torrwnum).elig_dpnt_cvrd_pgm_flag := objinst.elig_dpnt_cvrd_pgm_flag;
482 g_cobcep_inst(l_torrwnum).elig_job_flag := objinst.elig_job_flag;
483 g_cobcep_inst(l_torrwnum).elig_hrly_slrd_flag := objinst.elig_hrly_slrd_flag;
484 g_cobcep_inst(l_torrwnum).elig_pstl_cd_flag := objinst.elig_pstl_cd_flag;
485 g_cobcep_inst(l_torrwnum).elig_lbr_mmbr_flag := objinst.elig_lbr_mmbr_flag;
486 g_cobcep_inst(l_torrwnum).elig_lgl_enty_flag := objinst.elig_lgl_enty_flag;
487 g_cobcep_inst(l_torrwnum).elig_benfts_grp_flag := objinst.elig_benfts_grp_flag;
488 g_cobcep_inst(l_torrwnum).elig_wk_loc_flag := objinst.elig_wk_loc_flag;
489 g_cobcep_inst(l_torrwnum).elig_brgng_unit_flag := objinst.elig_brgng_unit_flag;
490 g_cobcep_inst(l_torrwnum).elig_age_flag := objinst.elig_age_flag;
491 g_cobcep_inst(l_torrwnum).elig_los_flag := objinst.elig_los_flag;
492 g_cobcep_inst(l_torrwnum).elig_per_typ_flag := objinst.elig_per_typ_flag;
493 g_cobcep_inst(l_torrwnum).elig_fl_tm_pt_tm_flag := objinst.elig_fl_tm_pt_tm_flag;
494 g_cobcep_inst(l_torrwnum).elig_ee_stat_flag := objinst.elig_ee_stat_flag;
495 g_cobcep_inst(l_torrwnum).elig_grd_flag := objinst.elig_grd_flag;
496 g_cobcep_inst(l_torrwnum).elig_pct_fl_tm_flag := objinst.elig_pct_fl_tm_flag;
497 g_cobcep_inst(l_torrwnum).elig_asnt_set_flag := objinst.elig_asnt_set_flag;
498 g_cobcep_inst(l_torrwnum).elig_hrs_wkd_flag := objinst.elig_hrs_wkd_flag;
499 g_cobcep_inst(l_torrwnum).elig_comp_lvl_flag := objinst.elig_comp_lvl_flag;
500 g_cobcep_inst(l_torrwnum).elig_org_unit_flag := objinst.elig_org_unit_flag;
501 g_cobcep_inst(l_torrwnum).elig_loa_rsn_flag := objinst.elig_loa_rsn_flag;
502 g_cobcep_inst(l_torrwnum).elig_pyrl_flag := objinst.elig_pyrl_flag;
503 g_cobcep_inst(l_torrwnum).elig_schedd_hrs_flag := objinst.elig_schedd_hrs_flag;
504 g_cobcep_inst(l_torrwnum).elig_py_bss_flag := objinst.elig_py_bss_flag;
505 g_cobcep_inst(l_torrwnum).eligy_prfl_rl_flag := objinst.eligy_prfl_rl_flag;
506 g_cobcep_inst(l_torrwnum).elig_cmbn_age_los_flag := objinst.elig_cmbn_age_los_flag;
507 g_cobcep_inst(l_torrwnum).cntng_prtn_elig_prfl_flag := objinst.cntng_prtn_elig_prfl_flag;
508 g_cobcep_inst(l_torrwnum).elig_prtt_pl_flag := objinst.elig_prtt_pl_flag;
509 g_cobcep_inst(l_torrwnum).elig_ppl_grp_flag := objinst.elig_ppl_grp_flag;
510 g_cobcep_inst(l_torrwnum).elig_svc_area_flag := objinst.elig_svc_area_flag;
511 g_cobcep_inst(l_torrwnum).elig_ptip_prte_flag := objinst.elig_ptip_prte_flag;
512 g_cobcep_inst(l_torrwnum).elig_no_othr_cvg_flag := objinst.elig_no_othr_cvg_flag;
513 g_cobcep_inst(l_torrwnum).elig_enrld_pl_flag := objinst.elig_enrld_pl_flag;
514 g_cobcep_inst(l_torrwnum).elig_enrld_oipl_flag := objinst.elig_enrld_oipl_flag;
515 g_cobcep_inst(l_torrwnum).elig_enrld_pgm_flag := objinst.elig_enrld_pgm_flag;
516 g_cobcep_inst(l_torrwnum).elig_dpnt_cvrd_pl_flag := objinst.elig_dpnt_cvrd_pl_flag;
517 g_cobcep_inst(l_torrwnum).elig_lvg_rsn_flag := objinst.elig_lvg_rsn_flag;
518 g_cobcep_inst(l_torrwnum).elig_optd_mdcr_flag := objinst.elig_optd_mdcr_flag;
519 g_cobcep_inst(l_torrwnum).elig_tbco_use_flag := objinst.elig_tbco_use_flag;
520 g_cobcep_inst(l_torrwnum).elig_dpnt_othr_ptip_flag := objinst.elig_dpnt_othr_ptip_flag;
521 g_cobcep_inst(l_torrwnum).ELIG_GNDR_FLAG := objinst.ELIG_GNDR_FLAG;
522 g_cobcep_inst(l_torrwnum).ELIG_MRTL_STS_FLAG := objinst.ELIG_MRTL_STS_FLAG;
523 g_cobcep_inst(l_torrwnum).ELIG_DSBLTY_CTG_FLAG := objinst.ELIG_DSBLTY_CTG_FLAG;
524 g_cobcep_inst(l_torrwnum).ELIG_DSBLTY_RSN_FLAG := objinst.ELIG_DSBLTY_RSN_FLAG;
525 g_cobcep_inst(l_torrwnum).ELIG_DSBLTY_DGR_FLAG := objinst.ELIG_DSBLTY_DGR_FLAG;
526 g_cobcep_inst(l_torrwnum).ELIG_SUPPL_ROLE_FLAG := objinst.ELIG_SUPPL_ROLE_FLAG;
527 g_cobcep_inst(l_torrwnum).ELIG_QUAL_TITL_FLAG := objinst.ELIG_QUAL_TITL_FLAG;
528 g_cobcep_inst(l_torrwnum).ELIG_PSTN_FLAG := objinst.ELIG_PSTN_FLAG;
529 g_cobcep_inst(l_torrwnum).ELIG_PRBTN_PERD_FLAG := objinst.ELIG_PRBTN_PERD_FLAG;
530 g_cobcep_inst(l_torrwnum).ELIG_SP_CLNG_PRG_PT_FLAG := objinst.ELIG_SP_CLNG_PRG_PT_FLAG;
531 g_cobcep_inst(l_torrwnum).BNFT_CAGR_PRTN_CD := objinst.BNFT_CAGR_PRTN_CD;
532 g_cobcep_inst(l_torrwnum).ELIG_DSBLD_FLAG := objinst.ELIG_DSBLD_FLAG ;
533 g_cobcep_inst(l_torrwnum).ELIG_TTL_CVG_VOL_FLAG := objinst.ELIG_TTL_CVG_VOL_FLAG ;
534 g_cobcep_inst(l_torrwnum).ELIG_TTL_PRTT_FLAG := objinst.ELIG_TTL_PRTT_FLAG ;
535 g_cobcep_inst(l_torrwnum).ELIG_COMPTNCY_FLAG := objinst.ELIG_COMPTNCY_FLAG ;
536 g_cobcep_inst(l_torrwnum).ELIG_HLTH_CVG_FLAG := objinst.ELIG_HLTH_CVG_FLAG ;
537 g_cobcep_inst(l_torrwnum).ELIG_ANTHR_PL_FLAG := objinst.ELIG_ANTHR_PL_FLAG ;
538
539 --
540 -- hr_utility.set_location(' Dn Assign inst '||l_proc,10);
541 --
542 l_torrwnum := l_torrwnum+1;
543 l_prev_hv := l_hv;
544 --
545 end loop;
546 --
547 ben_elp_cache.g_cobcep_lookup(l_prev_hv).endtorele_num := l_torrwnum-1;
548 --
552 end write_cobcep_cache;
549 end if;
550 --
551 -- hr_utility.set_location(' Leaving '||l_proc,10);
553 --
554 procedure cobcep_getdets
555 (p_business_group_id in number
556 ,p_effective_date in date
557 ,p_pgm_id in number default hr_api.g_number
558 ,p_pl_id in number default hr_api.g_number
559 ,p_oipl_id in number default hr_api.g_number
560 ,p_plip_id in number default hr_api.g_number
561 ,p_ptip_id in number default hr_api.g_number
562 --
563 ,p_inst_set out nocopy ben_elp_cache.g_cobcep_cache
564 ,p_inst_count out nocopy number
565 )
566 is
567 --
568 l_torrwnum pls_integer;
569 l_insttorrw_num pls_integer;
570 l_hv pls_integer;
571 l_not_hash_found boolean;
572 --
573 begin
574 --
575 if not g_cobcep_cached
576 then
577 --
578 -- Build the cache
579 --
580 write_cobcep_cache
581 (p_business_group_id => p_business_group_id
582 ,p_effective_date => p_effective_date
583 );
584 --
585 g_cobcep_cached := TRUE;
586 --
587 end if;
588 --
589 -- Get the instance details
590 --
591 l_hv := mod(nvl(p_pgm_id,1)+nvl(p_ptip_id,2)+nvl(p_plip_id,3)
592 +nvl(p_pl_id,4)+nvl(p_oipl_id,5),ben_hash_utility.get_hash_key);
593 --
594 -- Check if hashed value is already allocated
595 --
596 if ben_elp_cache.g_cobcep_lookup.exists(l_hv) then
597 --
598 if nvl(g_cobcep_lookup(l_hv).id,-1) = nvl(p_pgm_id,-1)
599 and nvl(g_cobcep_lookup(l_hv).fk_id,-1) = nvl(p_ptip_id,-1)
600 and nvl(g_cobcep_lookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
601 and nvl(g_cobcep_lookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
602 and nvl(g_cobcep_lookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
603 then
604 -- Matched row
605 null;
606 else
607 --
608 l_not_hash_found := false;
609 --
610 -- Loop until un-allocated has value is derived
611 --
612 while not l_not_hash_found loop
613 --
614 l_hv := ben_hash_utility.get_next_hash_index(p_hash_index => l_hv);
615 --
616 -- Check if the hash index exists, and compare the values
617 --
621 and nvl(g_cobcep_lookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
618 if nvl(g_cobcep_lookup(l_hv).id,-1) = nvl(p_pgm_id,-1)
619 and nvl(g_cobcep_lookup(l_hv).fk_id,-1) = nvl(p_ptip_id,-1)
620 and nvl(g_cobcep_lookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
622 and nvl(g_cobcep_lookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
623 then
624 --
625 l_not_hash_found := true;
626 exit;
627 --
628 else
629 --
630 l_not_hash_found := false;
631 --
632 end if;
633 --
634 end loop;
635 --
636 end if;
637 --
638 l_torrwnum := 0;
639 --
640 for l_insttorrw_num in g_cobcep_lookup(l_hv).starttorele_num ..
641 g_cobcep_lookup(l_hv).endtorele_num loop
642 --
643 p_inst_set(l_torrwnum) := g_cobcep_inst(l_insttorrw_num);
644 l_torrwnum := l_torrwnum+1;
645 --
646 end loop;
647 --
648 p_inst_count := l_torrwnum;
649 --
650 end if;
651 --
652 exception
653 --
654 when no_data_found then
655 --
656 null;
657 --
658 end cobcep_getdets;
659 --
660 procedure write_cobcep_odcache
661 (p_effective_date in date
662 ,p_pgm_id in number default hr_api.g_number
663 ,p_pl_id in number default hr_api.g_number
664 ,p_oipl_id in number default hr_api.g_number
665 ,p_plip_id in number default hr_api.g_number
666 ,p_ptip_id in number default hr_api.g_number
667 --
668 ,p_hv out nocopy pls_integer
669 )
670 is
671 --
672 l_proc varchar2(72) := g_package||'write_cobcep_odcache';
673 --
674 l_hv pls_integer;
675 l_not_hash_found boolean;
676 l_torrwnum pls_integer;
677 l_starttorele_num pls_integer;
678 --
679 cursor c_pgminstance
680 (c_pgm_id number
681 ,c_effective_date date
682 )
683 is
684 select tab1.pgm_id,
685 tab1.ptip_id,
686 tab1.plip_id,
687 tab1.pl_id,
688 tab1.oipl_id,
689 tab1.prtn_elig_id,
690 tab2.mndtry_flag,
691 tab3.eligy_prfl_id,
692 tab3.asmt_to_use_cd,
693 tab3.elig_enrld_plip_flag,
694 tab3.elig_cbr_quald_bnf_flag,
695 tab3.elig_enrld_ptip_flag,
696 tab3.elig_dpnt_cvrd_plip_flag,
697 tab3.elig_dpnt_cvrd_ptip_flag,
698 tab3.elig_dpnt_cvrd_pgm_flag,
699 tab3.elig_job_flag,
700 tab3.elig_hrly_slrd_flag,
701 tab3.elig_pstl_cd_flag,
702 tab3.elig_lbr_mmbr_flag,
703 tab3.elig_lgl_enty_flag,
704 tab3.elig_benfts_grp_flag,
705 tab3.elig_wk_loc_flag,
706 tab3.elig_brgng_unit_flag,
707 tab3.elig_age_flag,
708 tab3.elig_los_flag,
709 tab3.elig_per_typ_flag,
710 tab3.elig_fl_tm_pt_tm_flag,
711 tab3.elig_ee_stat_flag,
712 tab3.elig_grd_flag,
713 tab3.elig_pct_fl_tm_flag,
714 tab3.elig_asnt_set_flag,
715 tab3.elig_hrs_wkd_flag,
716 tab3.elig_comp_lvl_flag,
720 tab3.elig_schedd_hrs_flag,
717 tab3.elig_org_unit_flag,
718 tab3.elig_loa_rsn_flag,
719 tab3.elig_pyrl_flag,
721 tab3.elig_py_bss_flag,
722 tab3.eligy_prfl_rl_flag,
723 tab3.elig_cmbn_age_los_flag,
724 tab3.cntng_prtn_elig_prfl_flag,
725 tab3.elig_prtt_pl_flag,
726 tab3.elig_ppl_grp_flag,
727 tab3.elig_svc_area_flag,
728 tab3.elig_ptip_prte_flag,
729 tab3.elig_no_othr_cvg_flag,
730 tab3.elig_enrld_pl_flag,
731 tab3.elig_enrld_oipl_flag,
732 tab3.elig_enrld_pgm_flag,
733 tab3.elig_dpnt_cvrd_pl_flag,
734 tab3.elig_lvg_rsn_flag,
735 tab3.elig_optd_mdcr_flag,
736 tab3.elig_tbco_use_flag,
737 tab3.elig_dpnt_othr_ptip_flag,
738 tab3.ELIG_DSBLD_FLAG,
739 tab3.ELIG_TTL_CVG_VOL_FLAG,
740 tab3.ELIG_TTL_PRTT_FLAG,
741 tab3.ELIG_COMPTNCY_FLAG,
742 tab3.ELIG_HLTH_CVG_FLAG,
743 tab3.ELIG_ANTHR_PL_FLAG
744 from ben_prtn_elig_f tab1,
745 ben_prtn_elig_prfl_f tab2,
746 ben_eligy_prfl_f tab3
747 where tab1.pgm_id = c_pgm_id
748 and tab1.prtn_elig_id = tab2.prtn_elig_id
749 and c_effective_date
750 between tab1.effective_start_date and tab1.effective_end_date
751 and tab2.eligy_prfl_id = tab3.eligy_prfl_id
752 and c_effective_date
753 between tab2.effective_start_date and tab2.effective_end_date
754 and c_effective_date
755 between tab3.effective_start_date and tab3.effective_end_date
756 order by tab1.pgm_id,
757 tab1.ptip_id,
758 tab1.plip_id,
759 tab1.pl_id,
760 tab1.oipl_id,
761 decode(tab2.mndtry_flag,'Y',1,2);
762 --
763 l_instance c_pgminstance%rowtype;
764 --
765 cursor c_ptipinstance
766 (c_ptip_id number
767 ,c_effective_date date
768 )
769 is
770 select tab1.pgm_id,
771 tab1.ptip_id,
772 tab1.plip_id,
773 tab1.pl_id,
774 tab1.oipl_id,
775 tab1.prtn_elig_id,
776 tab2.mndtry_flag,
777 tab3.eligy_prfl_id,
778 tab3.asmt_to_use_cd,
779 tab3.elig_enrld_plip_flag,
780 tab3.elig_cbr_quald_bnf_flag,
781 tab3.elig_enrld_ptip_flag,
782 tab3.elig_dpnt_cvrd_plip_flag,
783 tab3.elig_dpnt_cvrd_ptip_flag,
784 tab3.elig_dpnt_cvrd_pgm_flag,
785 tab3.elig_job_flag,
786 tab3.elig_hrly_slrd_flag,
787 tab3.elig_pstl_cd_flag,
788 tab3.elig_lbr_mmbr_flag,
789 tab3.elig_lgl_enty_flag,
790 tab3.elig_benfts_grp_flag,
791 tab3.elig_wk_loc_flag,
792 tab3.elig_brgng_unit_flag,
793 tab3.elig_age_flag,
794 tab3.elig_los_flag,
795 tab3.elig_per_typ_flag,
796 tab3.elig_fl_tm_pt_tm_flag,
797 tab3.elig_ee_stat_flag,
798 tab3.elig_grd_flag,
799 tab3.elig_pct_fl_tm_flag,
800 tab3.elig_asnt_set_flag,
801 tab3.elig_hrs_wkd_flag,
802 tab3.elig_comp_lvl_flag,
803 tab3.elig_org_unit_flag,
804 tab3.elig_loa_rsn_flag,
805 tab3.elig_pyrl_flag,
806 tab3.elig_schedd_hrs_flag,
807 tab3.elig_py_bss_flag,
808 tab3.eligy_prfl_rl_flag,
809 tab3.elig_cmbn_age_los_flag,
810 tab3.cntng_prtn_elig_prfl_flag,
811 tab3.elig_prtt_pl_flag,
812 tab3.elig_ppl_grp_flag,
813 tab3.elig_svc_area_flag,
814 tab3.elig_ptip_prte_flag,
815 tab3.elig_no_othr_cvg_flag,
816 tab3.elig_enrld_pl_flag,
817 tab3.elig_enrld_oipl_flag,
818 tab3.elig_enrld_pgm_flag,
819 tab3.elig_dpnt_cvrd_pl_flag,
820 tab3.elig_lvg_rsn_flag,
821 tab3.elig_optd_mdcr_flag,
822 tab3.elig_tbco_use_flag,
823 tab3.elig_dpnt_othr_ptip_flag,
824 tab3.ELIG_DSBLD_FLAG,
825 tab3.ELIG_TTL_CVG_VOL_FLAG,
826 tab3.ELIG_TTL_PRTT_FLAG,
827 tab3.ELIG_COMPTNCY_FLAG,
828 tab3.ELIG_HLTH_CVG_FLAG,
829 tab3.ELIG_ANTHR_PL_FLAG
830 from ben_prtn_elig_f tab1,
831 ben_prtn_elig_prfl_f tab2,
832 ben_eligy_prfl_f tab3
833 where tab1.ptip_id = c_ptip_id
834 and tab1.prtn_elig_id = tab2.prtn_elig_id
835 and c_effective_date
836 between tab1.effective_start_date and tab1.effective_end_date
837 and tab2.eligy_prfl_id = tab3.eligy_prfl_id
838 and c_effective_date
839 between tab2.effective_start_date and tab2.effective_end_date
840 and c_effective_date
841 between tab3.effective_start_date and tab3.effective_end_date
842 order by tab1.pgm_id,
843 tab1.ptip_id,
844 tab1.plip_id,
845 tab1.pl_id,
846 tab1.oipl_id,
847 decode(tab2.mndtry_flag,'Y',1,2);
848 --
849 cursor c_plipinstance
850 (c_plip_id number
851 ,c_effective_date date
852 )
853 is
854 select tab1.pgm_id,
855 tab1.ptip_id,
856 tab1.plip_id,
857 tab1.pl_id,
858 tab1.oipl_id,
859 tab1.prtn_elig_id,
860 tab2.mndtry_flag,
861 tab3.eligy_prfl_id,
862 tab3.asmt_to_use_cd,
866 tab3.elig_dpnt_cvrd_plip_flag,
863 tab3.elig_enrld_plip_flag,
864 tab3.elig_cbr_quald_bnf_flag,
865 tab3.elig_enrld_ptip_flag,
867 tab3.elig_dpnt_cvrd_ptip_flag,
868 tab3.elig_dpnt_cvrd_pgm_flag,
869 tab3.elig_job_flag,
870 tab3.elig_hrly_slrd_flag,
871 tab3.elig_pstl_cd_flag,
872 tab3.elig_lbr_mmbr_flag,
873 tab3.elig_lgl_enty_flag,
874 tab3.elig_benfts_grp_flag,
875 tab3.elig_wk_loc_flag,
876 tab3.elig_brgng_unit_flag,
877 tab3.elig_age_flag,
878 tab3.elig_los_flag,
879 tab3.elig_per_typ_flag,
880 tab3.elig_fl_tm_pt_tm_flag,
881 tab3.elig_ee_stat_flag,
882 tab3.elig_grd_flag,
883 tab3.elig_pct_fl_tm_flag,
884 tab3.elig_asnt_set_flag,
885 tab3.elig_hrs_wkd_flag,
886 tab3.elig_comp_lvl_flag,
887 tab3.elig_org_unit_flag,
888 tab3.elig_loa_rsn_flag,
889 tab3.elig_pyrl_flag,
890 tab3.elig_schedd_hrs_flag,
891 tab3.elig_py_bss_flag,
892 tab3.eligy_prfl_rl_flag,
893 tab3.elig_cmbn_age_los_flag,
894 tab3.cntng_prtn_elig_prfl_flag,
895 tab3.elig_prtt_pl_flag,
896 tab3.elig_ppl_grp_flag,
897 tab3.elig_svc_area_flag,
898 tab3.elig_ptip_prte_flag,
899 tab3.elig_no_othr_cvg_flag,
900 tab3.elig_enrld_pl_flag,
901 tab3.elig_enrld_oipl_flag,
902 tab3.elig_enrld_pgm_flag,
903 tab3.elig_dpnt_cvrd_pl_flag,
904 tab3.elig_lvg_rsn_flag,
905 tab3.elig_optd_mdcr_flag,
906 tab3.elig_tbco_use_flag,
907 tab3.elig_dpnt_othr_ptip_flag,
908 tab3.ELIG_DSBLD_FLAG,
909 tab3.ELIG_TTL_CVG_VOL_FLAG,
910 tab3.ELIG_TTL_PRTT_FLAG,
911 tab3.ELIG_COMPTNCY_FLAG,
912 tab3.ELIG_HLTH_CVG_FLAG,
913 tab3.ELIG_ANTHR_PL_FLAG
914 from ben_prtn_elig_f tab1,
915 ben_prtn_elig_prfl_f tab2,
916 ben_eligy_prfl_f tab3
917 where tab1.plip_id = c_plip_id
918 and tab1.prtn_elig_id = tab2.prtn_elig_id
919 and c_effective_date
920 between tab1.effective_start_date and tab1.effective_end_date
921 and tab2.eligy_prfl_id = tab3.eligy_prfl_id
922 and c_effective_date
923 between tab2.effective_start_date and tab2.effective_end_date
924 and c_effective_date
925 between tab3.effective_start_date and tab3.effective_end_date
926 order by tab1.pgm_id,
927 tab1.ptip_id,
928 tab1.plip_id,
929 tab1.pl_id,
930 tab1.oipl_id,
931 decode(tab2.mndtry_flag,'Y',1,2);
932 --
933 cursor c_plinstance
934 (c_pl_id number
935 ,c_effective_date date
936 )
937 is
938 select tab1.pgm_id,
939 tab1.ptip_id,
940 tab1.plip_id,
941 tab1.pl_id,
942 tab1.oipl_id,
943 tab1.prtn_elig_id,
944 tab2.mndtry_flag,
945 tab3.eligy_prfl_id,
946 tab3.asmt_to_use_cd,
947 tab3.elig_enrld_plip_flag,
948 tab3.elig_cbr_quald_bnf_flag,
949 tab3.elig_enrld_ptip_flag,
950 tab3.elig_dpnt_cvrd_plip_flag,
951 tab3.elig_dpnt_cvrd_ptip_flag,
952 tab3.elig_dpnt_cvrd_pgm_flag,
953 tab3.elig_job_flag,
954 tab3.elig_hrly_slrd_flag,
955 tab3.elig_pstl_cd_flag,
956 tab3.elig_lbr_mmbr_flag,
957 tab3.elig_lgl_enty_flag,
958 tab3.elig_benfts_grp_flag,
959 tab3.elig_wk_loc_flag,
960 tab3.elig_brgng_unit_flag,
961 tab3.elig_age_flag,
962 tab3.elig_los_flag,
963 tab3.elig_per_typ_flag,
964 tab3.elig_fl_tm_pt_tm_flag,
965 tab3.elig_ee_stat_flag,
966 tab3.elig_grd_flag,
967 tab3.elig_pct_fl_tm_flag,
968 tab3.elig_asnt_set_flag,
969 tab3.elig_hrs_wkd_flag,
970 tab3.elig_comp_lvl_flag,
971 tab3.elig_org_unit_flag,
972 tab3.elig_loa_rsn_flag,
973 tab3.elig_pyrl_flag,
974 tab3.elig_schedd_hrs_flag,
975 tab3.elig_py_bss_flag,
976 tab3.eligy_prfl_rl_flag,
977 tab3.elig_cmbn_age_los_flag,
978 tab3.cntng_prtn_elig_prfl_flag,
979 tab3.elig_prtt_pl_flag,
980 tab3.elig_ppl_grp_flag,
981 tab3.elig_svc_area_flag,
982 tab3.elig_ptip_prte_flag,
983 tab3.elig_no_othr_cvg_flag,
984 tab3.elig_enrld_pl_flag,
985 tab3.elig_enrld_oipl_flag,
986 tab3.elig_enrld_pgm_flag,
987 tab3.elig_dpnt_cvrd_pl_flag,
988 tab3.elig_lvg_rsn_flag,
989 tab3.elig_optd_mdcr_flag,
990 tab3.elig_tbco_use_flag,
991 tab3.elig_dpnt_othr_ptip_flag,
992 tab3.ELIG_DSBLD_FLAG,
993 tab3.ELIG_TTL_CVG_VOL_FLAG,
994 tab3.ELIG_TTL_PRTT_FLAG,
995 tab3.ELIG_COMPTNCY_FLAG,
996 tab3.ELIG_HLTH_CVG_FLAG,
997 tab3.ELIG_ANTHR_PL_FLAG
998 from ben_prtn_elig_f tab1,
999 ben_prtn_elig_prfl_f tab2,
1000 ben_eligy_prfl_f tab3
1001 where tab1.pl_id = c_pl_id
1002 and tab1.prtn_elig_id = tab2.prtn_elig_id
1003 and c_effective_date
1004 between tab1.effective_start_date and tab1.effective_end_date
1008 and c_effective_date
1005 and tab2.eligy_prfl_id = tab3.eligy_prfl_id
1006 and c_effective_date
1007 between tab2.effective_start_date and tab2.effective_end_date
1009 between tab3.effective_start_date and tab3.effective_end_date
1010 order by tab1.pgm_id,
1011 tab1.ptip_id,
1012 tab1.plip_id,
1013 tab1.pl_id,
1014 tab1.oipl_id,
1015 decode(tab2.mndtry_flag,'Y',1,2);
1016 --
1017 cursor c_oiplinstance
1018 (c_oipl_id number
1019 ,c_effective_date date
1020 )
1021 is
1022 select tab1.pgm_id,
1023 tab1.ptip_id,
1024 tab1.plip_id,
1025 tab1.pl_id,
1026 tab1.oipl_id,
1027 tab1.prtn_elig_id,
1028 tab2.mndtry_flag,
1029 tab3.eligy_prfl_id,
1030 tab3.asmt_to_use_cd,
1031 tab3.elig_enrld_plip_flag,
1032 tab3.elig_cbr_quald_bnf_flag,
1033 tab3.elig_enrld_ptip_flag,
1034 tab3.elig_dpnt_cvrd_plip_flag,
1035 tab3.elig_dpnt_cvrd_ptip_flag,
1036 tab3.elig_dpnt_cvrd_pgm_flag,
1037 tab3.elig_job_flag,
1038 tab3.elig_hrly_slrd_flag,
1039 tab3.elig_pstl_cd_flag,
1040 tab3.elig_lbr_mmbr_flag,
1041 tab3.elig_lgl_enty_flag,
1042 tab3.elig_benfts_grp_flag,
1043 tab3.elig_wk_loc_flag,
1044 tab3.elig_brgng_unit_flag,
1045 tab3.elig_age_flag,
1046 tab3.elig_los_flag,
1047 tab3.elig_per_typ_flag,
1048 tab3.elig_fl_tm_pt_tm_flag,
1049 tab3.elig_ee_stat_flag,
1050 tab3.elig_grd_flag,
1051 tab3.elig_pct_fl_tm_flag,
1052 tab3.elig_asnt_set_flag,
1053 tab3.elig_hrs_wkd_flag,
1054 tab3.elig_comp_lvl_flag,
1055 tab3.elig_org_unit_flag,
1056 tab3.elig_loa_rsn_flag,
1057 tab3.elig_pyrl_flag,
1058 tab3.elig_schedd_hrs_flag,
1059 tab3.elig_py_bss_flag,
1060 tab3.eligy_prfl_rl_flag,
1061 tab3.elig_cmbn_age_los_flag,
1062 tab3.cntng_prtn_elig_prfl_flag,
1063 tab3.elig_prtt_pl_flag,
1064 tab3.elig_ppl_grp_flag,
1065 tab3.elig_svc_area_flag,
1066 tab3.elig_ptip_prte_flag,
1067 tab3.elig_no_othr_cvg_flag,
1068 tab3.elig_enrld_pl_flag,
1069 tab3.elig_enrld_oipl_flag,
1070 tab3.elig_enrld_pgm_flag,
1071 tab3.elig_dpnt_cvrd_pl_flag,
1072 tab3.elig_lvg_rsn_flag,
1073 tab3.elig_optd_mdcr_flag,
1074 tab3.elig_tbco_use_flag,
1075 tab3.elig_dpnt_othr_ptip_flag,
1076 tab3.ELIG_DSBLD_FLAG,
1077 tab3.ELIG_TTL_CVG_VOL_FLAG,
1078 tab3.ELIG_TTL_PRTT_FLAG,
1079 tab3.ELIG_COMPTNCY_FLAG,
1080 tab3.ELIG_HLTH_CVG_FLAG,
1081 tab3.ELIG_ANTHR_PL_FLAG
1082 from ben_prtn_elig_f tab1,
1083 ben_prtn_elig_prfl_f tab2,
1084 ben_eligy_prfl_f tab3
1085 where tab1.oipl_id = c_oipl_id
1086 and tab1.prtn_elig_id = tab2.prtn_elig_id
1087 and c_effective_date
1088 between tab1.effective_start_date and tab1.effective_end_date
1089 and tab2.eligy_prfl_id = tab3.eligy_prfl_id
1090 and c_effective_date
1091 between tab2.effective_start_date and tab2.effective_end_date
1092 and c_effective_date
1093 between tab3.effective_start_date and tab3.effective_end_date
1094 order by tab1.pgm_id,
1095 tab1.ptip_id,
1096 tab1.plip_id,
1097 tab1.pl_id,
1098 tab1.oipl_id,
1099 decode(tab2.mndtry_flag,'Y',1,2);
1100 --
1101 begin
1102 --
1103 hr_utility.set_location(' Entering '||l_proc,10);
1104 --
1105 -- Get the instance details
1106 --
1107 l_hv := mod(nvl(p_pgm_id,1)+nvl(p_ptip_id,2)+nvl(p_plip_id,3)
1108 +nvl(p_pl_id,4)+nvl(p_oipl_id,5),ben_hash_utility.get_hash_key);
1109 --
1110 -- Get a unique hash value
1111 --
1112 if g_copcep_odlookup.exists(l_hv) then
1113 --
1114 if nvl(g_copcep_odlookup(l_hv).id,-1) = nvl(p_pgm_id,-1)
1115 and nvl(g_copcep_odlookup(l_hv).fk_id,-1) = nvl(p_ptip_id,-1)
1116 and nvl(g_copcep_odlookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
1117 and nvl(g_copcep_odlookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
1118 and nvl(g_copcep_odlookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
1119 then
1120 --
1121 null;
1122 --
1123 else
1124 --
1125 l_not_hash_found := false;
1126 --
1127 -- Loop until un-allocated has value is derived
1128 --
1129 while not l_not_hash_found loop
1130 --
1131 l_hv := ben_hash_utility.get_next_hash_index(p_hash_index => l_hv);
1132 --
1133 -- Check if the hash index exists, and compare the values
1134 --
1135 if nvl(g_copcep_odlookup(l_hv).id,-1) = nvl(p_pgm_id,-1)
1136 and nvl(g_copcep_odlookup(l_hv).fk_id,-1) = nvl(p_ptip_id,-1)
1137 and nvl(g_copcep_odlookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
1138 and nvl(g_copcep_odlookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
1139 and nvl(g_copcep_odlookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
1140 then
1141 --
1142 l_not_hash_found := true;
1143 exit;
1144 --
1145 else
1146 --
1150 --
1147 l_not_hash_found := false;
1148 --
1149 end if;
1151 end loop;
1152 --
1153 end if;
1154 --
1155 end if;
1156 --
1157 g_copcep_odlookup(l_hv).id := p_pgm_id;
1158 g_copcep_odlookup(l_hv).fk_id := p_ptip_id;
1159 g_copcep_odlookup(l_hv).fk1_id := p_plip_id;
1160 g_copcep_odlookup(l_hv).fk2_id := p_pl_id;
1161 g_copcep_odlookup(l_hv).fk3_id := p_oipl_id;
1162 --
1163 hr_utility.set_location(' Dn Look '||l_proc,10);
1164 --
1165 l_starttorele_num := nvl(g_copcep_nxelenum,1);
1166 l_torrwnum := l_starttorele_num;
1167 --
1168 hr_utility.set_location(' Bef inst loop '||l_proc,10);
1169 --
1170 if p_pgm_id is not null then
1171 --
1172 open c_pgminstance
1173 (c_pgm_id => p_pgm_id
1174 ,c_effective_date => p_effective_date
1175 );
1176 --
1177 elsif p_ptip_id is not null then
1178 --
1179 open c_ptipinstance
1180 (c_ptip_id => p_ptip_id
1181 ,c_effective_date => p_effective_date
1182 );
1183 --
1184 elsif p_plip_id is not null then
1185 --
1186 open c_plipinstance
1187 (c_plip_id => p_plip_id
1188 ,c_effective_date => p_effective_date
1189 );
1190 --
1191 elsif p_pl_id is not null then
1192 --
1193 open c_plinstance
1194 (c_pl_id => p_pl_id
1195 ,c_effective_date => p_effective_date
1196 );
1197 --
1198 elsif p_oipl_id is not null then
1199 --
1200 open c_oiplinstance
1201 (c_oipl_id => p_oipl_id
1202 ,c_effective_date => p_effective_date
1203 );
1204 --
1205 end if;
1206 --
1207 loop
1208 --
1209 if p_pgm_id is not null then
1210 --
1211 fetch c_pgminstance into l_instance;
1212 exit when c_pgminstance%NOTFOUND;
1213 --
1214 elsif p_ptip_id is not null then
1215 --
1216 fetch c_ptipinstance into l_instance;
1217 exit when c_ptipinstance%NOTFOUND;
1218 --
1219 elsif p_plip_id is not null then
1220 --
1221 fetch c_plipinstance into l_instance;
1222 exit when c_plipinstance%NOTFOUND;
1223 --
1224 elsif p_pl_id is not null then
1225 --
1226 fetch c_plinstance into l_instance;
1227 exit when c_plinstance%NOTFOUND;
1228 --
1229 elsif p_oipl_id is not null then
1230 --
1231 fetch c_oiplinstance into l_instance;
1232 exit when c_oiplinstance%NOTFOUND;
1233 --
1234 end if;
1235 --
1236 hr_utility.set_location(' Assign inst '||l_proc,10);
1237 --
1238 g_copcep_odinst.extend(1);
1239 g_copcep_odinst(l_torrwnum).pgm_id := l_instance.pgm_id;
1240 g_copcep_odinst(l_torrwnum).ptip_id := l_instance.ptip_id;
1241 g_copcep_odinst(l_torrwnum).plip_id := l_instance.plip_id;
1242 g_copcep_odinst(l_torrwnum).pl_id := l_instance.pl_id;
1243 g_copcep_odinst(l_torrwnum).oipl_id := l_instance.oipl_id;
1244 g_copcep_odinst(l_torrwnum).prtn_elig_id := l_instance.prtn_elig_id;
1245 g_copcep_odinst(l_torrwnum).mndtry_flag := l_instance.mndtry_flag;
1246 g_copcep_odinst(l_torrwnum).eligy_prfl_id := l_instance.eligy_prfl_id;
1247 g_copcep_odinst(l_torrwnum).asmt_to_use_cd := l_instance.asmt_to_use_cd;
1248 g_copcep_odinst(l_torrwnum).elig_enrld_plip_flag := l_instance.elig_enrld_plip_flag;
1249 g_copcep_odinst(l_torrwnum).elig_cbr_quald_bnf_flag := l_instance.elig_cbr_quald_bnf_flag;
1250 g_copcep_odinst(l_torrwnum).elig_enrld_ptip_flag := l_instance.elig_enrld_ptip_flag;
1251 g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_plip_flag := l_instance.elig_dpnt_cvrd_plip_flag;
1252 g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_ptip_flag := l_instance.elig_dpnt_cvrd_ptip_flag;
1253 g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_pgm_flag := l_instance.elig_dpnt_cvrd_pgm_flag;
1254 g_copcep_odinst(l_torrwnum).elig_job_flag := l_instance.elig_job_flag;
1255 g_copcep_odinst(l_torrwnum).elig_hrly_slrd_flag := l_instance.elig_hrly_slrd_flag;
1256 g_copcep_odinst(l_torrwnum).elig_pstl_cd_flag := l_instance.elig_pstl_cd_flag;
1257 g_copcep_odinst(l_torrwnum).elig_lbr_mmbr_flag := l_instance.elig_lbr_mmbr_flag;
1258 g_copcep_odinst(l_torrwnum).elig_lgl_enty_flag := l_instance.elig_lgl_enty_flag;
1259 g_copcep_odinst(l_torrwnum).elig_benfts_grp_flag := l_instance.elig_benfts_grp_flag;
1260 g_copcep_odinst(l_torrwnum).elig_wk_loc_flag := l_instance.elig_wk_loc_flag;
1261 g_copcep_odinst(l_torrwnum).elig_brgng_unit_flag := l_instance.elig_brgng_unit_flag;
1262 g_copcep_odinst(l_torrwnum).elig_age_flag := l_instance.elig_age_flag;
1263 g_copcep_odinst(l_torrwnum).elig_los_flag := l_instance.elig_los_flag;
1264 g_copcep_odinst(l_torrwnum).elig_per_typ_flag := l_instance.elig_per_typ_flag;
1265 g_copcep_odinst(l_torrwnum).elig_fl_tm_pt_tm_flag := l_instance.elig_fl_tm_pt_tm_flag;
1266 g_copcep_odinst(l_torrwnum).elig_ee_stat_flag := l_instance.elig_ee_stat_flag;
1267 g_copcep_odinst(l_torrwnum).elig_grd_flag := l_instance.elig_grd_flag;
1268 g_copcep_odinst(l_torrwnum).elig_pct_fl_tm_flag := l_instance.elig_pct_fl_tm_flag;
1269 g_copcep_odinst(l_torrwnum).elig_asnt_set_flag := l_instance.elig_asnt_set_flag;
1270 g_copcep_odinst(l_torrwnum).elig_hrs_wkd_flag := l_instance.elig_hrs_wkd_flag;
1271 g_copcep_odinst(l_torrwnum).elig_comp_lvl_flag := l_instance.elig_comp_lvl_flag;
1275 g_copcep_odinst(l_torrwnum).elig_schedd_hrs_flag := l_instance.elig_schedd_hrs_flag;
1272 g_copcep_odinst(l_torrwnum).elig_org_unit_flag := l_instance.elig_org_unit_flag;
1273 g_copcep_odinst(l_torrwnum).elig_loa_rsn_flag := l_instance.elig_loa_rsn_flag;
1274 g_copcep_odinst(l_torrwnum).elig_pyrl_flag := l_instance.elig_pyrl_flag;
1276 g_copcep_odinst(l_torrwnum).elig_py_bss_flag := l_instance.elig_py_bss_flag;
1277 g_copcep_odinst(l_torrwnum).eligy_prfl_rl_flag := l_instance.eligy_prfl_rl_flag;
1278 g_copcep_odinst(l_torrwnum).elig_cmbn_age_los_flag := l_instance.elig_cmbn_age_los_flag;
1279 g_copcep_odinst(l_torrwnum).cntng_prtn_elig_prfl_flag := l_instance.cntng_prtn_elig_prfl_flag;
1280 g_copcep_odinst(l_torrwnum).elig_prtt_pl_flag := l_instance.elig_prtt_pl_flag;
1281 g_copcep_odinst(l_torrwnum).elig_ppl_grp_flag := l_instance.elig_ppl_grp_flag;
1282 g_copcep_odinst(l_torrwnum).elig_svc_area_flag := l_instance.elig_svc_area_flag;
1283 g_copcep_odinst(l_torrwnum).elig_ptip_prte_flag := l_instance.elig_ptip_prte_flag;
1284 g_copcep_odinst(l_torrwnum).elig_no_othr_cvg_flag := l_instance.elig_no_othr_cvg_flag;
1285 g_copcep_odinst(l_torrwnum).elig_enrld_pl_flag := l_instance.elig_enrld_pl_flag;
1286 g_copcep_odinst(l_torrwnum).elig_enrld_oipl_flag := l_instance.elig_enrld_oipl_flag;
1287 g_copcep_odinst(l_torrwnum).elig_enrld_pgm_flag := l_instance.elig_enrld_pgm_flag;
1288 g_copcep_odinst(l_torrwnum).elig_dpnt_cvrd_pl_flag := l_instance.elig_dpnt_cvrd_pl_flag;
1289 g_copcep_odinst(l_torrwnum).elig_lvg_rsn_flag := l_instance.elig_lvg_rsn_flag;
1290 g_copcep_odinst(l_torrwnum).elig_optd_mdcr_flag := l_instance.elig_optd_mdcr_flag;
1291 g_copcep_odinst(l_torrwnum).elig_tbco_use_flag := l_instance.elig_tbco_use_flag;
1292 g_copcep_odinst(l_torrwnum).elig_dpnt_othr_ptip_flag := l_instance.elig_dpnt_othr_ptip_flag;
1293 g_copcep_odinst(l_torrwnum).ELIG_DSBLD_FLAG := l_instance.ELIG_DSBLD_FLAG ;
1294 g_copcep_odinst(l_torrwnum).ELIG_TTL_CVG_VOL_FLAG := l_instance.ELIG_TTL_CVG_VOL_FLAG ;
1295 g_copcep_odinst(l_torrwnum).ELIG_TTL_PRTT_FLAG := l_instance.ELIG_TTL_PRTT_FLAG ;
1296 g_copcep_odinst(l_torrwnum).ELIG_COMPTNCY_FLAG := l_instance.ELIG_COMPTNCY_FLAG ;
1297 g_copcep_odinst(l_torrwnum).ELIG_HLTH_CVG_FLAG := l_instance.ELIG_HLTH_CVG_FLAG ;
1298 g_copcep_odinst(l_torrwnum).ELIG_ANTHR_PL_FLAG := l_instance.ELIG_ANTHR_PL_FLAG ;
1299 hr_utility.set_location(' Dn Assign inst '||l_proc,10);
1300 --
1301 l_torrwnum := l_torrwnum+1;
1302 --
1303 end loop;
1304 --
1305 if p_pgm_id is not null then
1306 --
1307 close c_pgminstance;
1308 --
1309 elsif p_ptip_id is not null then
1310 --
1311 close c_ptipinstance;
1312 --
1313 elsif p_plip_id is not null then
1314 --
1315 close c_plipinstance;
1316 --
1317 elsif p_pl_id is not null then
1318 --
1319 close c_plinstance;
1320 --
1321 elsif p_oipl_id is not null then
1322 --
1323 close c_oiplinstance;
1324 --
1325 end if;
1326 --
1327 -- Check if any rows were found
1328 --
1329 if l_torrwnum > nvl(g_copcep_nxelenum,1)
1330 then
1331 --
1332 g_copcep_odlookup(l_hv).starttorele_num := l_starttorele_num;
1333 g_copcep_odlookup(l_hv).endtorele_num := l_torrwnum-1;
1334 g_copcep_nxelenum := l_torrwnum;
1335 --
1336 p_hv := l_hv;
1337 --
1338 else
1339 --
1340 p_hv := null;
1341 --
1342 end if;
1343 --
1344 begin
1345 --
1346 dbms_session.free_unused_user_memory;
1347 --
1348 end;
1349 hr_utility.set_location(' Leaving '||l_proc,10);
1350 end write_cobcep_odcache;
1351 --
1352 procedure cobcep_odgetdets
1353 (p_effective_date in date
1354 ,p_pgm_id in number default hr_api.g_number
1355 ,p_pl_id in number default hr_api.g_number
1356 ,p_oipl_id in number default hr_api.g_number
1357 ,p_plip_id in number default hr_api.g_number
1358 ,p_ptip_id in number default hr_api.g_number
1359 --
1360 ,p_inst_set in out nocopy ben_elp_cache.g_cobcep_odcache
1361 )
1362 is
1363 --
1364 l_proc varchar2(72) := g_package||'cobcep_odgetdets';
1365 --
1366 l_inst_set ben_elp_cache.g_cobcep_odcache := ben_elp_cache.g_cobcep_odcache();
1367 --
1368 l_hv pls_integer;
1369 l_not_hash_found boolean;
1370 l_insttorrw_num pls_integer;
1371 l_torrwnum pls_integer;
1372 --
1373 begin
1374 --
1375 if g_copcep_odcached = 0
1376 then
1377 --
1378 -- Build the cache
1379 --
1380 clear_down_cache;
1381 --
1382 g_copcep_odcached := 1;
1383 --
1384 end if;
1385 hr_utility.set_location(' Derive hv '||l_proc,10);
1386 --
1387 -- Get the instance details
1388 --
1389 l_hv := mod(nvl(p_pgm_id,1)+nvl(p_ptip_id,2)+nvl(p_plip_id,3)
1390 +nvl(p_pl_id,4)+nvl(p_oipl_id,5),ben_hash_utility.get_hash_key);
1391 --
1392 -- Check if hashed value is already allocated
1393 --
1394 if g_copcep_odlookup.exists(l_hv) then
1395 --
1396 if nvl(g_copcep_odlookup(l_hv).id,-1) = nvl(p_pgm_id,-1)
1397 and nvl(g_copcep_odlookup(l_hv).fk_id,-1) = nvl(p_ptip_id,-1)
1398 and nvl(g_copcep_odlookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
1399 and nvl(g_copcep_odlookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
1400 and nvl(g_copcep_odlookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
1401 then
1402 --
1403 null;
1404 --
1405 else
1406 --
1407 l_not_hash_found := false;
1408 --
1409 -- Loop until un-allocated has value is derived
1413 l_hv := ben_hash_utility.get_next_hash_index(p_hash_index => l_hv);
1410 --
1411 while not l_not_hash_found loop
1412 --
1414 --
1415 -- Check if the hash index exists, and compare the values
1416 --
1417 if nvl(g_copcep_odlookup(l_hv).id,-1) = nvl(p_pgm_id,-1)
1418 and nvl(g_copcep_odlookup(l_hv).fk_id,-1) = nvl(p_ptip_id,-1)
1419 and nvl(g_copcep_odlookup(l_hv).fk1_id,-1) = nvl(p_plip_id,-1)
1420 and nvl(g_copcep_odlookup(l_hv).fk2_id,-1) = nvl(p_pl_id,-1)
1421 and nvl(g_copcep_odlookup(l_hv).fk3_id,-1) = nvl(p_oipl_id,-1)
1422 then
1423 --
1424 l_not_hash_found := true;
1425 exit;
1426 --
1427 else
1428 --
1429 l_not_hash_found := false;
1430 --
1431 end if;
1432 --
1433 end loop;
1434 --
1435 end if;
1436 --
1437 else
1438 --
1439 write_cobcep_odcache
1440 (p_effective_date => p_effective_date
1441 ,p_pgm_id => p_pgm_id
1442 ,p_pl_id => p_pl_id
1443 ,p_oipl_id => p_oipl_id
1444 ,p_plip_id => p_plip_id
1445 ,p_ptip_id => p_ptip_id
1446 --
1447 ,p_hv => l_hv
1448 );
1449 --
1450 end if;
1451 hr_utility.set_location(' Got hv '||l_proc,10);
1452 --
1453 if l_hv is not null then
1454 --
1455 l_torrwnum := 1;
1456 --
1457 hr_utility.set_location(' Get loop '||l_proc,10);
1458 for l_insttorrw_num in g_copcep_odlookup(l_hv).starttorele_num ..
1459 g_copcep_odlookup(l_hv).endtorele_num
1460 loop
1461 --
1462 l_inst_set.extend(1);
1463 l_inst_set(l_torrwnum) := g_copcep_odinst(l_insttorrw_num);
1464 l_torrwnum := l_torrwnum+1;
1465 --
1466 end loop;
1467 --
1468 hr_utility.set_location(' Dn Get loop '||l_proc,10);
1469 p_inst_set := l_inst_set;
1470 --
1471 end if;
1472 hr_utility.set_location(' Leaving '||l_proc,10);
1473 exception
1474 --
1475 when no_data_found then
1476 --
1477 null;
1478 --
1479 end cobcep_odgetdets;
1480 --
1481 procedure elpelc_getdets
1482 (p_business_group_id in number
1483 ,p_effective_date in date
1484 ,p_eligy_prfl_id in number default hr_api.g_number
1485 ,p_cache_code in varchar2 default hr_api.g_varchar2
1486 --
1487 ,p_inst_set out nocopy ben_elp_cache.g_elpelc_cache
1488 ,p_inst_count out nocopy number
1489 )
1490 is
1491 --
1492 l_proc varchar2(72) := 'elpelc_getdets';
1493 --
1494 l_instcolnm_set ben_cache.InstColNmType;
1495 l_tabdet_set ben_cache.TabDetType;
1496 --
1497 l_torrwnum pls_integer;
1498 l_insttorrw_num pls_integer;
1499 l_index pls_integer;
1500 l_instcolnm_num pls_integer;
1501 l_not_hash_found boolean;
1502 l_mastertab_name varchar2(100);
1503 l_masterpkcol_name varchar2(100);
1504 l_lkup_name varchar2(100);
1505 l_inst_name varchar2(100);
1506 l_table1_name varchar2(100);
1507 l_tab1jncol_name varchar2(100);
1508 l_table2_name varchar2(100);
1509 l_tab2jncol_name varchar2(100);
1510 l_table3_name varchar2(100);
1511 --
1512 begin
1513 --
1514 -- Check if the lookup cache is populated
1515 --
1516 if (p_cache_code = 'ELPEPT' and ben_elp_cache.g_elpept_lookup.count = 0)
1517 or (p_cache_code = 'ELPEES' and ben_elp_cache.g_elpees_lookup.count = 0)
1518 or (p_cache_code = 'ELPESA' and ben_elp_cache.g_elpesa_lookup.count = 0)
1519 or (p_cache_code = 'ELPEHS' and ben_elp_cache.g_elpehs_lookup.count = 0)
1520 or (p_cache_code = 'ELPELS' and ben_elp_cache.g_elpels_lookup.count = 0)
1521 or (p_cache_code = 'ELPECP' and ben_elp_cache.g_elpecp_lookup.count = 0)
1522 then
1523 --
1524 -- Column and cache details
1525 --
1526 if p_cache_code = 'ELPEPT' then
1527 --
1528 l_mastertab_name := 'ben_eligy_prfl_f';
1529 l_masterpkcol_name := 'eligy_prfl_id';
1530 l_lkup_name := 'ben_elp_cache.g_elpept_lookup';
1531 l_inst_name := 'ben_elp_cache.g_elpept_inst';
1532 l_tabdet_set(0).tab_name := 'ben_elig_per_typ_prte_f';
1533 --
1534 elsif p_cache_code = 'ELPEES' then
1535 --
1536 l_mastertab_name := 'ben_eligy_prfl_f';
1537 l_masterpkcol_name := 'eligy_prfl_id';
1538 l_lkup_name := 'ben_elp_cache.g_elpees_lookup';
1539 l_inst_name := 'ben_elp_cache.g_elpees_inst';
1540 l_tabdet_set(0).tab_name := 'ben_elig_ee_stat_prte_f';
1541 --
1542 elsif p_cache_code = 'ELPESA' then
1543 --
1544 l_mastertab_name := 'ben_eligy_prfl_f';
1545 l_masterpkcol_name := 'eligy_prfl_id';
1546 l_lkup_name := 'ben_elp_cache.g_elpesa_lookup';
1547 l_inst_name := 'ben_elp_cache.g_elpesa_inst';
1548 l_tabdet_set(0).tab_name := 'ben_elig_svc_area_prte_f';
1549 l_tabdet_set(0).tab_jncolnm := 'svc_area_id';
1550 l_tabdet_set(1).tab_name := 'ben_svc_area_pstl_zip_rng_f';
1551 l_tabdet_set(1).tab_jncolnm := 'pstl_zip_rng_id';
1552 l_tabdet_set(2).tab_name := 'ben_pstl_zip_rng_f';
1553 --
1554 elsif p_cache_code = 'ELPEHS' then
1555 --
1556 l_mastertab_name := 'ben_eligy_prfl_f';
1557 l_masterpkcol_name := 'eligy_prfl_id';
1558 l_lkup_name := 'ben_elp_cache.g_elpehs_lookup';
1559 l_inst_name := 'ben_elp_cache.g_elpehs_inst';
1560 l_tabdet_set(0).tab_name := 'ben_elig_hrly_slrd_prte_f';
1561 --
1562 elsif p_cache_code = 'ELPELS' then
1563 --
1564 l_mastertab_name := 'ben_eligy_prfl_f';
1568 l_tabdet_set(0).tab_name := 'ben_elig_los_prte_f';
1565 l_masterpkcol_name := 'eligy_prfl_id';
1566 l_lkup_name := 'ben_elp_cache.g_elpels_lookup';
1567 l_inst_name := 'ben_elp_cache.g_elpels_inst';
1569 l_tabdet_set(0).tab_jncolnm := 'los_fctr_id';
1570 l_tabdet_set(1).tab_name := 'ben_los_fctr';
1571 l_tabdet_set(1).tab_datetype := 'nondt';
1572 --
1573 elsif p_cache_code = 'ELPECP' then
1574 --
1575 l_mastertab_name := 'ben_eligy_prfl_f';
1576 l_masterpkcol_name := 'eligy_prfl_id';
1577 l_lkup_name := 'ben_elp_cache.g_elpecp_lookup';
1578 l_inst_name := 'ben_elp_cache.g_elpecp_inst';
1579 l_tabdet_set(0).tab_name := 'ben_elig_cmbn_age_los_prte_f';
1580 l_tabdet_set(0).tab_jncolnm := 'cmbn_age_los_fctr_id';
1581 l_tabdet_set(1).tab_name := 'ben_cmbn_age_los_fctr';
1582 l_tabdet_set(1).tab_datetype := 'nondt';
1583 --
1584 end if;
1585 --
1586 l_instcolnm_num := 0;
1587 --
1588 l_instcolnm_set(l_instcolnm_num).col_name := l_masterpkcol_name;
1589 l_instcolnm_set(l_instcolnm_num).caccol_name := 'eligy_prfl_id';
1590 l_instcolnm_set(l_instcolnm_num).col_alias := 'table1';
1591 l_instcolnm_set(l_instcolnm_num).col_type := 'MASTER';
1592 l_instcolnm_num := l_instcolnm_num+1;
1593 --
1594 l_instcolnm_set(l_instcolnm_num).col_name := 'excld_flag';
1595 l_instcolnm_set(l_instcolnm_num).caccol_name := 'excld_flag';
1596 l_instcolnm_set(l_instcolnm_num).col_alias := 'table1';
1597 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1598 l_instcolnm_num := l_instcolnm_num+1;
1599 --
1600 if p_cache_code = 'ELPEPT' then
1601 -- Not supporting per_typ_cd,instead use person_type_id
1602 --l_instcolnm_set(l_instcolnm_num).col_name := 'per_typ_cd';
1603 l_instcolnm_set(l_instcolnm_num).col_name := 'person_type_id';
1604 l_instcolnm_set(l_instcolnm_num).caccol_name := 'code';
1605 l_instcolnm_set(l_instcolnm_num).col_alias := 'table1';
1606 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1607 l_instcolnm_num := l_instcolnm_num+1;
1608 --
1609 elsif p_cache_code = 'ELPEES' then
1610 l_instcolnm_set(l_instcolnm_num).col_name := 'assignment_status_type_id';
1611 l_instcolnm_set(l_instcolnm_num).caccol_name := 'id';
1612 l_instcolnm_set(l_instcolnm_num).col_alias := 'table1';
1613 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1614 l_instcolnm_num := l_instcolnm_num+1;
1615 --
1616 elsif p_cache_code = 'ELPESA' then
1617 l_instcolnm_set(l_instcolnm_num).col_name := 'from_value';
1618 l_instcolnm_set(l_instcolnm_num).caccol_name := 'from_value';
1619 l_instcolnm_set(l_instcolnm_num).col_alias := 'table3';
1620 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1621 l_instcolnm_num := l_instcolnm_num+1;
1622 --
1623 l_instcolnm_set(l_instcolnm_num).col_name := 'to_value';
1624 l_instcolnm_set(l_instcolnm_num).caccol_name := 'to_value';
1625 l_instcolnm_set(l_instcolnm_num).col_alias := 'table3';
1626 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1627 l_instcolnm_num := l_instcolnm_num+1;
1628 --
1629 elsif p_cache_code = 'ELPELS' then
1630 l_instcolnm_set(l_instcolnm_num).col_name := 'mx_los_num';
1631 l_instcolnm_set(l_instcolnm_num).caccol_name := 'mx_num';
1632 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1633 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1634 l_instcolnm_num := l_instcolnm_num+1;
1635 --
1636 l_instcolnm_set(l_instcolnm_num).col_name := 'mn_los_num';
1637 l_instcolnm_set(l_instcolnm_num).caccol_name := 'mn_num';
1638 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1639 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1640 l_instcolnm_num := l_instcolnm_num+1;
1641 --
1642 l_instcolnm_set(l_instcolnm_num).col_name := 'no_mx_los_num_apls_flag';
1643 l_instcolnm_set(l_instcolnm_num).caccol_name := 'no_mx_num_apls_flag';
1644 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1645 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1646 l_instcolnm_num := l_instcolnm_num+1;
1647 --
1648 l_instcolnm_set(l_instcolnm_num).col_name := 'no_mn_los_num_apls_flag';
1649 l_instcolnm_set(l_instcolnm_num).caccol_name := 'no_mn_num_apls_flag';
1650 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1651 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1652 l_instcolnm_num := l_instcolnm_num+1;
1653 --
1654 elsif p_cache_code = 'ELPECP' then
1655 l_instcolnm_set(l_instcolnm_num).col_name := 'los_fctr_id';
1656 l_instcolnm_set(l_instcolnm_num).caccol_name := 'id';
1657 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1658 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1659 l_instcolnm_num := l_instcolnm_num+1;
1660 --
1661 l_instcolnm_set(l_instcolnm_num).col_name := 'age_fctr_id';
1662 l_instcolnm_set(l_instcolnm_num).caccol_name := 'id1';
1663 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1664 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1665 l_instcolnm_num := l_instcolnm_num+1;
1666 --
1667 l_instcolnm_set(l_instcolnm_num).col_name := 'cmbnd_min_val';
1668 l_instcolnm_set(l_instcolnm_num).caccol_name := 'cmbnd_min_val';
1669 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1670 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1671 l_instcolnm_num := l_instcolnm_num+1;
1672 --
1673 l_instcolnm_set(l_instcolnm_num).col_name := 'cmbnd_max_val';
1674 l_instcolnm_set(l_instcolnm_num).caccol_name := 'cmbnd_max_val';
1675 l_instcolnm_set(l_instcolnm_num).col_alias := 'table2';
1676 l_instcolnm_set(l_instcolnm_num).col_type := 'SELECT';
1677 l_instcolnm_num := l_instcolnm_num+1;
1678 --
1679 end if;
1680 ben_cache.Write_BGP_Cache
1681 (p_mastertab_name => l_mastertab_name
1682 ,p_masterpkcol_name => l_masterpkcol_name
1683 ,p_tabdet_set => l_tabdet_set
1684 ,p_table1_name => l_table1_name
1685 ,p_tab1jncol_name => l_tab1jncol_name
1686 ,p_table2_name => l_table2_name
1690 ,p_effective_date => p_effective_date
1687 ,p_tab2jncol_name => l_tab2jncol_name
1688 ,p_table3_name => l_table3_name
1689 ,p_business_group_id => p_business_group_id
1691 ,p_lkup_name => l_lkup_name
1692 ,p_inst_name => l_inst_name
1693 ,p_instcolnm_set => l_instcolnm_set
1694 );
1695 --
1696 end if;
1697 --
1698 -- Get the instance details
1699 --
1700 l_torrwnum := 0;
1701 --
1702 if upper(p_cache_code) = 'ELPEPT' then
1703 --
1704 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
1705 --
1706 -- Check if hashed value is already allocated
1707 --
1708 if g_elpept_lookup.exists(l_index) then
1709 --
1710 -- If it does exist make sure its the right one
1711 --
1712 if g_elpept_lookup(l_index).id <> p_eligy_prfl_id then
1713 --
1714 l_not_hash_found := false;
1715 --
1716 -- Loop until un-allocated has value is derived
1717 --
1718 while not l_not_hash_found loop
1719 --
1720 l_index := ben_hash_utility.get_next_hash_index
1721 (p_hash_index => l_index);
1722 --
1723 -- Check if the hash index exists, if not we can use it
1724 --
1725 if not g_elpept_lookup.exists(l_index) then
1726 --
1727 -- Lets store the hash value in the index
1728 --
1729 l_not_hash_found := true;
1730 exit;
1731 --
1732 else
1733 --
1734 l_not_hash_found := false;
1735 --
1736 end if;
1737 --
1738 end loop;
1739 --
1740 end if;
1741 --
1742 end if;
1743 --
1744 for l_insttorrw_num in g_elpept_lookup(l_index).starttorele_num ..
1745 g_elpept_lookup(l_index).endtorele_num
1746 loop
1747 --
1748 --
1749 p_inst_set(l_torrwnum) := g_elpept_inst(l_insttorrw_num);
1750 l_torrwnum := l_torrwnum+1;
1751 --
1752 end loop;
1753 --
1754 elsif upper(p_cache_code) = 'ELPEES' then
1755 --
1756 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
1757 --
1758 -- Check if hashed value is already allocated
1759 --
1760 if g_elpees_lookup.exists(l_index) then
1761 --
1762 -- If it does exist make sure its the right one
1763 --
1764 if g_elpees_lookup(l_index).id <> p_eligy_prfl_id then
1765 --
1766 l_not_hash_found := false;
1767 --
1768 -- Loop until un-allocated has value is derived
1769 --
1770 while not l_not_hash_found loop
1771 --
1772 l_index := ben_hash_utility.get_next_hash_index
1773 (p_hash_index => l_index);
1774 --
1775 -- Check if the hash index exists, if not we can use it
1776 --
1777 if not g_elpees_lookup.exists(l_index) then
1778 --
1779 -- Lets store the hash value in the index
1780 --
1781 l_not_hash_found := true;
1782 exit;
1783 --
1784 else
1785 --
1786 l_not_hash_found := false;
1787 --
1788 end if;
1789 --
1790 end loop;
1791 --
1792 end if;
1793 --
1794 end if;
1795 --
1796 for l_insttorrw_num in g_elpees_lookup(l_index).starttorele_num ..
1797 g_elpees_lookup(l_index).endtorele_num
1798 loop
1799 --
1800 --
1801 p_inst_set(l_torrwnum) := g_elpees_inst(l_insttorrw_num);
1802 l_torrwnum := l_torrwnum+1;
1803 --
1804 end loop;
1805 --
1806 elsif upper(p_cache_code) = 'ELPESA' then
1807 --
1808 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
1809 --
1810 -- Check if hashed value is already allocated
1811 --
1812 if g_elpesa_lookup.exists(l_index) then
1813 --
1814 -- If it does exist make sure its the right one
1815 --
1816 if g_elpesa_lookup(l_index).id <> p_eligy_prfl_id then
1817 --
1818 l_not_hash_found := false;
1819 --
1820 -- Loop until un-allocated has value is derived
1821 --
1822 while not l_not_hash_found loop
1823 --
1824 l_index := ben_hash_utility.get_next_hash_index
1825 (p_hash_index => l_index);
1826 --
1827 -- Check if the hash index exists, if not we can use it
1828 --
1829 if not g_elpesa_lookup.exists(l_index) then
1830 --
1831 -- Lets store the hash value in the index
1832 --
1833 l_not_hash_found := true;
1834 exit;
1835 --
1836 else
1837 --
1838 l_not_hash_found := false;
1839 --
1840 end if;
1841 --
1842 end loop;
1843 --
1844 end if;
1845 --
1846 end if;
1847 --
1848 for l_insttorrw_num in g_elpesa_lookup(l_index).starttorele_num ..
1849 g_elpesa_lookup(l_index).endtorele_num
1850 loop
1851 --
1852 --
1853 p_inst_set(l_torrwnum) := g_elpesa_inst(l_insttorrw_num);
1854 l_torrwnum := l_torrwnum+1;
1855 --
1856 end loop;
1857 --
1858 elsif upper(p_cache_code) = 'ELPEHS' then
1859 --
1860 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
1861 --
1862 -- Check if hashed value is already allocated
1863 --
1864 if g_elpehs_lookup.exists(l_index) then
1865 --
1866 -- If it does exist make sure its the right one
1867 --
1868 if g_elpehs_lookup(l_index).id <> p_eligy_prfl_id then
1869 --
1870 l_not_hash_found := false;
1871 --
1872 -- Loop until un-allocated has value is derived
1873 --
1874 while not l_not_hash_found loop
1875 --
1876 l_index := ben_hash_utility.get_next_hash_index
1877 (p_hash_index => l_index);
1878 --
1879 -- Check if the hash index exists, if not we can use it
1880 --
1881 if not g_elpehs_lookup.exists(l_index) then
1882 --
1883 -- Lets store the hash value in the index
1884 --
1885 l_not_hash_found := true;
1886 exit;
1887 --
1888 else
1889 --
1890 l_not_hash_found := false;
1891 --
1892 end if;
1893 --
1894 end loop;
1895 --
1896 end if;
1897 --
1901 g_elpehs_lookup(l_index).endtorele_num
1898 end if;
1899 --
1900 for l_insttorrw_num in g_elpehs_lookup(l_index).starttorele_num ..
1902 loop
1903 --
1904 --
1905 p_inst_set(l_torrwnum) := g_elpehs_inst(l_insttorrw_num);
1906 l_torrwnum := l_torrwnum+1;
1907 --
1908 end loop;
1909 --
1910 elsif upper(p_cache_code) = 'ELPELS' then
1911 --
1912 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
1913 --
1914 -- Check if hashed value is already allocated
1915 --
1916 if g_elpels_lookup.exists(l_index) then
1917 --
1918 -- If it does exist make sure its the right one
1919 --
1920 if g_elpels_lookup(l_index).id <> p_eligy_prfl_id then
1921 --
1922 l_not_hash_found := false;
1923 --
1924 -- Loop until un-allocated has value is derived
1925 --
1926 while not l_not_hash_found loop
1927 --
1928 l_index := ben_hash_utility.get_next_hash_index
1929 (p_hash_index => l_index);
1930 --
1931 -- Check if the hash index exists, if not we can use it
1932 --
1933 if not g_elpels_lookup.exists(l_index) then
1934 --
1935 -- Lets store the hash value in the index
1936 --
1937 l_not_hash_found := true;
1938 exit;
1939 --
1940 else
1941 --
1942 l_not_hash_found := false;
1943 --
1944 end if;
1945 --
1946 end loop;
1947 --
1948 end if;
1949 --
1950 end if;
1951 --
1952 for l_insttorrw_num in g_elpels_lookup(l_index).starttorele_num ..
1953 g_elpels_lookup(l_index).endtorele_num
1954 loop
1955 --
1956 --
1957 p_inst_set(l_torrwnum) := g_elpels_inst(l_insttorrw_num);
1958 l_torrwnum := l_torrwnum+1;
1959 --
1960 end loop;
1961 --
1962 elsif upper(p_cache_code) = 'ELPECP' then
1963 --
1964 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
1965 --
1966 -- Check if hashed value is already allocated
1967 --
1968 if g_elpecp_lookup.exists(l_index) then
1969 --
1970 -- If it does exist make sure its the right one
1971 --
1972 if g_elpecp_lookup(l_index).id <> p_eligy_prfl_id then
1973 --
1974 l_not_hash_found := false;
1975 --
1976 -- Loop until un-allocated has value is derived
1977 --
1978 while not l_not_hash_found loop
1979 --
1980 l_index := ben_hash_utility.get_next_hash_index
1981 (p_hash_index => l_index);
1982 --
1983 -- Check if the hash index exists, if not we can use it
1984 --
1985 if not g_elpecp_lookup.exists(l_index) then
1986 --
1987 -- Lets store the hash value in the index
1988 --
1989 l_not_hash_found := true;
1990 exit;
1991 --
1992 else
1993 --
1994 l_not_hash_found := false;
1995 --
1996 end if;
1997 --
1998 end loop;
1999 --
2000 end if;
2001 --
2002 end if;
2003 --
2004 for l_insttorrw_num in g_elpecp_lookup(l_index).starttorele_num ..
2005 g_elpecp_lookup(l_index).endtorele_num
2006 loop
2007 --
2008 --
2009 p_inst_set(l_torrwnum) := g_elpecp_inst(l_insttorrw_num);
2010 l_torrwnum := l_torrwnum+1;
2011 --
2012 end loop;
2013 --
2014 end if;
2015 --
2016 p_inst_count := l_torrwnum;
2017 --
2018 exception
2019 when no_data_found then
2020 --
2021 p_inst_count := 0;
2022 --
2023 end elpelc_getdets;
2024 --
2025 procedure elpepg_writecache
2026 (p_effective_date in date,
2027 p_refresh_cache in boolean default FALSE) is
2028 --
2029 l_proc varchar2(72) := 'elpepg_writecache';
2030 l_torrwnum pls_integer;
2031 l_prev_id number;
2032 l_id number;
2033 --
2034 cursor c_elpepg_look is
2035 select elp.eligy_prfl_id,
2036 elp.business_group_id
2037 from ben_eligy_prfl_f elp
2038 where p_effective_date
2039 between elp.effective_start_date
2040 and elp.effective_end_date
2041 and exists(select null
2042 from ben_elig_ppl_grp_prte_f epg
2043 where p_effective_date
2044 between epg.effective_start_date
2045 and epg.effective_end_date
2046 and epg.eligy_prfl_id = elp.eligy_prfl_id)
2047 order by elp.eligy_prfl_id;
2048 --
2049 cursor c_elpepg_inst is
2050 select epg.eligy_prfl_id,
2051 epg.elig_ppl_grp_prte_id pk_id,
2052 'EPG' short_code,
2053 epg.people_group_id,
2054 epg.excld_flag,
2055 epg.criteria_score,
2056 epg.criteria_weight,
2057 ppg.segment1 ,
2058 ppg.segment2 ,
2059 ppg.segment3 ,
2060 ppg.segment4 ,
2061 ppg.segment5 ,
2062 ppg.segment6 ,
2063 ppg.segment7 ,
2064 ppg.segment8 ,
2065 ppg.segment9 ,
2066 ppg.segment10,
2067 ppg.segment11,
2068 ppg.segment12,
2069 ppg.segment13,
2070 ppg.segment14,
2071 ppg.segment15,
2072 ppg.segment16,
2073 ppg.segment17,
2074 ppg.segment18,
2075 ppg.segment19,
2076 ppg.segment20,
2077 ppg.segment21,
2078 ppg.segment22,
2079 ppg.segment23,
2080 ppg.segment24,
2081 ppg.segment25,
2082 ppg.segment26,
2083 ppg.segment27,
2084 ppg.segment28,
2085 ppg.segment29,
2086 ppg.segment30
2087 from ben_elig_ppl_grp_prte_f epg
2091 and epg.effective_end_date
2088 ,pay_people_groups ppg
2089 where p_effective_date
2090 between epg.effective_start_date
2092 and epg.people_group_id = ppg.people_group_id
2093 order by epg.eligy_prfl_id,
2094 decode(epg.excld_flag,'Y',1,2),
2095 epg.ordr_num;
2096 --
2097 l_not_hash_found boolean;
2098 --
2099 begin
2100 --
2101 for objlook in c_elpepg_look loop
2102 --
2103 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
2104 --
2105 -- Check if hashed value is already allocated
2106 --
2107 if g_cache_elpepg_lookup.exists(l_id) then
2108 --
2109 l_not_hash_found := false;
2110 --
2111 -- Loop until un-allocated has value is derived
2112 --
2113 while not l_not_hash_found loop
2114 --
2115 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2116 --
2117 -- Check if the hash index exists, if not we can use it
2118 --
2119 if not g_cache_elpepg_lookup.exists(l_id) then
2120 --
2121 -- Lets store the hash value in the index
2122 --
2123 l_not_hash_found := true;
2124 exit;
2125 --
2126 else
2127 --
2128 l_not_hash_found := false;
2129 --
2130 end if;
2131 --
2132 end loop;
2133 --
2134 end if;
2135 --
2136 g_cache_elpepg_lookup(l_id).id := objlook.eligy_prfl_id;
2137 g_cache_elpepg_lookup(l_id).fk_id := objlook.business_group_id;
2138 --
2139 end loop;
2140 --
2141 l_torrwnum := 0;
2142 l_prev_id := -1;
2143 --
2144 for objinst in c_elpepg_inst loop
2145 --
2146 -- Populate the cache lookup details
2147 --
2148 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
2149 --
2150 -- Check if hashed value is already allocated
2151 --
2152 if g_cache_elpepg_lookup(l_id).id = objinst.eligy_prfl_id then
2153 --
2154 null;
2155 --
2156 else
2157 --
2158 loop
2159 --
2160 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2161 --
2162 if g_cache_elpepg_lookup(l_id).id = objinst.eligy_prfl_id then
2163 --
2164 exit;
2165 --
2166 end if;
2167 --
2168 end loop;
2169 --
2170 end if;
2171 --
2172 -- Check for first row
2173 --
2174 if l_prev_id = -1 then
2175 --
2176 g_cache_elpepg_lookup(l_id).starttorele_num := l_torrwnum;
2177 --
2178 elsif l_id <> l_prev_id then
2179 --
2180 g_cache_elpepg_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2181 g_cache_elpepg_lookup(l_id).starttorele_num := l_torrwnum;
2182 --
2183 end if;
2184 --
2185 -- Populate the cache instance details
2186 --
2187 g_cache_elpepg_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
2188 g_cache_elpepg_inst(l_torrwnum).pk_id := objinst.pk_id;
2189 g_cache_elpepg_inst(l_torrwnum).short_code := objinst.short_code;
2190 g_cache_elpepg_inst(l_torrwnum).criteria_score := objinst.criteria_score;
2191 g_cache_elpepg_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
2192 g_cache_elpepg_inst(l_torrwnum).people_group_id := objinst.people_group_id;
2193 g_cache_elpepg_inst(l_torrwnum).excld_flag := objinst.excld_flag;
2194 g_cache_elpepg_inst(l_torrwnum).segment1 := objinst.segment1 ;
2195 g_cache_elpepg_inst(l_torrwnum).segment2 := objinst.segment2 ;
2196 g_cache_elpepg_inst(l_torrwnum).segment3 := objinst.segment3 ;
2197 g_cache_elpepg_inst(l_torrwnum).segment4 := objinst.segment4 ;
2198 g_cache_elpepg_inst(l_torrwnum).segment5 := objinst.segment5 ;
2199 g_cache_elpepg_inst(l_torrwnum).segment6 := objinst.segment6 ;
2200 g_cache_elpepg_inst(l_torrwnum).segment7 := objinst.segment7 ;
2201 g_cache_elpepg_inst(l_torrwnum).segment8 := objinst.segment8 ;
2202 g_cache_elpepg_inst(l_torrwnum).segment9 := objinst.segment9 ;
2203 g_cache_elpepg_inst(l_torrwnum).segment10 := objinst.segment10;
2204 g_cache_elpepg_inst(l_torrwnum).segment11 := objinst.segment11;
2205 g_cache_elpepg_inst(l_torrwnum).segment12 := objinst.segment12;
2206 g_cache_elpepg_inst(l_torrwnum).segment13 := objinst.segment13;
2207 g_cache_elpepg_inst(l_torrwnum).segment14 := objinst.segment14;
2208 g_cache_elpepg_inst(l_torrwnum).segment15 := objinst.segment15;
2209 g_cache_elpepg_inst(l_torrwnum).segment16 := objinst.segment16;
2210 g_cache_elpepg_inst(l_torrwnum).segment17 := objinst.segment17;
2211 g_cache_elpepg_inst(l_torrwnum).segment18 := objinst.segment18;
2212 g_cache_elpepg_inst(l_torrwnum).segment19 := objinst.segment19;
2213 g_cache_elpepg_inst(l_torrwnum).segment20 := objinst.segment20;
2214 g_cache_elpepg_inst(l_torrwnum).segment21 := objinst.segment21;
2215 g_cache_elpepg_inst(l_torrwnum).segment22 := objinst.segment22;
2216 g_cache_elpepg_inst(l_torrwnum).segment23 := objinst.segment23;
2217 g_cache_elpepg_inst(l_torrwnum).segment24 := objinst.segment24;
2218 g_cache_elpepg_inst(l_torrwnum).segment25 := objinst.segment25;
2219 g_cache_elpepg_inst(l_torrwnum).segment26 := objinst.segment26;
2220 g_cache_elpepg_inst(l_torrwnum).segment27 := objinst.segment27;
2221 g_cache_elpepg_inst(l_torrwnum).segment28 := objinst.segment28;
2222 g_cache_elpepg_inst(l_torrwnum).segment29 := objinst.segment29;
2226 l_prev_id := l_id;
2223 g_cache_elpepg_inst(l_torrwnum).segment30 := objinst.segment30;
2224 --
2225 l_torrwnum := l_torrwnum+1;
2227 --
2228 end loop;
2229 --
2230 g_cache_elpepg_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2231 --
2232 end elpepg_writecache;
2233 --
2234 procedure elpepg_getcacdets
2235 (p_effective_date in date,
2236 p_business_group_id in number,
2237 p_eligy_prfl_id in number,
2238 p_refresh_cache in boolean default FALSE,
2239 p_inst_set out nocopy ben_elp_cache.g_cache_elpepg_instor,
2240 p_inst_count out nocopy number) is
2241 --
2242 l_proc varchar2(72) := 'elpepg_getcacdets';
2243 l_torrwnum pls_integer;
2244 l_insttorrw_num pls_integer;
2245 l_index pls_integer;
2246 --
2247 l_not_hash_found boolean;
2248 --
2249 begin
2250 --
2251 -- Flush the cache
2252 --
2253 if p_refresh_cache then
2254 --
2255 g_cache_elpepg_lookup.delete;
2256 g_cache_elpepg_inst.delete;
2257 --
2258 end if;
2259 --
2260 -- Populate the global cache
2261 --
2262 if g_cache_elpepg_lookup.count = 0 then
2263 --
2264 -- Build the cache
2265 --
2266 ben_elp_cache.elpepg_writecache
2267 (p_effective_date => p_effective_date,
2268 p_refresh_cache => p_refresh_cache);
2269 --
2270 end if;
2271 --
2272 -- Get the instance details
2273 --
2274 l_torrwnum := 0;
2275 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
2276 --
2277 -- Check if hashed value is already allocated
2278 --
2279 if g_cache_elpepg_lookup.exists(l_index) then
2280 --
2281 -- If it does exist make sure its the right one
2282 --
2283 if g_cache_elpepg_lookup(l_index).id <> p_eligy_prfl_id then
2284 --
2285 l_not_hash_found := false;
2286 --
2287 -- Loop until un-allocated has value is derived
2288 --
2289 while not l_not_hash_found loop
2290 --
2291 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
2292 --
2293 -- Check if the hash index exists, if not we can use it
2294 --
2295 -- Bug 13253435 when moved to next hash index checking whether that
2296 -- hash index 'id' is having value of p_eligy_prfl_id or not.
2297 -- If values are equal then existing from the loop
2298 if g_cache_elpepg_lookup(l_index).id = p_eligy_prfl_id then
2299 l_not_hash_found := true;
2300 exit;
2301 end if;
2302 -- Bug 13253435
2303
2304 if not g_cache_elpepg_lookup.exists(l_index) then
2305 --
2306 -- Lets store the hash value in the index
2307 --
2308 l_not_hash_found := true;
2309 exit;
2310 --
2311 else
2312 --
2313 l_not_hash_found := false;
2314 --
2315 end if;
2316 --
2317 end loop;
2318 --
2319 end if;
2320 --
2321 end if;
2322 --
2323 for l_insttorrw_num in g_cache_elpepg_lookup(l_index).starttorele_num ..
2324 g_cache_elpepg_lookup(l_index).endtorele_num loop
2325 --
2326 p_inst_set(l_torrwnum) := g_cache_elpepg_inst(l_insttorrw_num);
2327 l_torrwnum := l_torrwnum+1;
2328 --
2329 end loop;
2330 --
2331 p_inst_count := l_torrwnum;
2332 --
2333 exception
2334 --
2335 when no_data_found then
2336 --
2337 p_inst_count := 0;
2338 --
2339 end elpepg_getcacdets;
2340 --
2341 procedure elpept_writecache
2342 (p_effective_date in date,
2343 p_refresh_cache in boolean default FALSE) is
2344 --
2345 l_proc varchar2(72) := 'elpept_writecache';
2346 l_torrwnum pls_integer;
2347 l_prev_id number;
2348 l_id number;
2349 --
2350 cursor c_elpept_look is
2351 select elp.eligy_prfl_id,
2352 elp.business_group_id
2353 from ben_eligy_prfl_f elp
2354 where p_effective_date
2355 between elp.effective_start_date
2356 and elp.effective_end_date
2357 and exists(select null
2358 from ben_elig_per_typ_prte_f ept
2359 where p_effective_date
2360 between ept.effective_start_date
2361 and ept.effective_end_date
2362 and ept.eligy_prfl_id = elp.eligy_prfl_id)
2363 order by elp.eligy_prfl_id;
2364 --
2365 -- Not supporting per_typ_cd,instead use person_type_id
2366 --
2367 cursor c_elpept_inst is
2368 select ept.eligy_prfl_id,
2369 ept.elig_per_typ_prte_id pk_id,
2370 'EPT' short_code,
2371 --ept.per_typ_cd,
2372 ept.person_type_id,
2373 ept.excld_flag,
2374 ept.criteria_score,
2375 ept.criteria_weight
2376 from ben_elig_per_typ_prte_f ept
2377 where p_effective_date
2378 between ept.effective_start_date
2379 and ept.effective_end_date
2380 order by ept.eligy_prfl_id,
2381 decode(ept.excld_flag,'Y',1,2),
2382 ept.ordr_num;
2383 --
2384 l_not_hash_found boolean;
2385 --
2386 begin
2387 --
2388 for objlook in c_elpept_look loop
2389 --
2390 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
2391 --
2392 -- Check if hashed value is already allocated
2393 --
2394 if g_cache_elpept_lookup.exists(l_id) then
2395 --
2399 --
2396 l_not_hash_found := false;
2397 --
2398 -- Loop until un-allocated has value is derived
2400 while not l_not_hash_found loop
2401 --
2402 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2403 --
2404 -- Check if the hash index exists, if not we can use it
2405 --
2406 if not g_cache_elpept_lookup.exists(l_id) then
2407 --
2408 -- Lets store the hash value in the index
2409 --
2410 l_not_hash_found := true;
2411 exit;
2412 --
2413 else
2414 --
2415 l_not_hash_found := false;
2416 --
2417 end if;
2418 --
2419 end loop;
2420 --
2421 end if;
2422 --
2423 g_cache_elpept_lookup(l_id).id := objlook.eligy_prfl_id;
2424 g_cache_elpept_lookup(l_id).fk_id := objlook.business_group_id;
2425 --
2426 end loop;
2427 --
2428 l_torrwnum := 0;
2429 l_prev_id := -1;
2430 --
2431 for objinst in c_elpept_inst loop
2432 --
2433 -- Populate the cache lookup details
2434 --
2435 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
2436 --
2437 -- Check if hashed value is already allocated
2438 --
2439 if g_cache_elpept_lookup(l_id).id = objinst.eligy_prfl_id then
2440 --
2441 null;
2442 --
2443 else
2444 --
2445 loop
2446 --
2447 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2448 --
2449 if g_cache_elpept_lookup(l_id).id = objinst.eligy_prfl_id then
2450 --
2451 exit;
2452 --
2453 end if;
2454 --
2455 end loop;
2456 --
2457 end if;
2458 --
2459 -- Check for first row
2460 --
2461 if l_prev_id = -1 then
2462 --
2463 g_cache_elpept_lookup(l_id).starttorele_num := l_torrwnum;
2464 --
2465 elsif l_id <> l_prev_id then
2466 --
2467 g_cache_elpept_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2468 g_cache_elpept_lookup(l_id).starttorele_num := l_torrwnum;
2469 --
2470 end if;
2471 --
2472 -- Populate the cache instance details
2473 --
2474 g_cache_elpept_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
2475 g_cache_elpept_inst(l_torrwnum).pk_id := objinst.pk_id;
2476 g_cache_elpept_inst(l_torrwnum).short_code := objinst.short_code;
2477 g_cache_elpept_inst(l_torrwnum).criteria_score := objinst.criteria_score;
2478 g_cache_elpept_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
2479 --
2480 -- Not supporting per_typ_cd,instead use person_type_id
2481 -- g_cache_elpept_inst(l_torrwnum).per_typ_cd := objinst.per_typ_cd;
2482 --
2483 g_cache_elpept_inst(l_torrwnum).person_type_id := objinst.person_type_id;
2484 g_cache_elpept_inst(l_torrwnum).excld_flag := objinst.excld_flag;
2485 --
2486 l_torrwnum := l_torrwnum+1;
2487 l_prev_id := l_id;
2488 --
2489 end loop;
2490 --
2491 g_cache_elpept_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2492 --
2493 end elpept_writecache;
2494 --
2495 procedure elpept_getcacdets
2496 (p_effective_date in date,
2497 p_business_group_id in number,
2498 p_eligy_prfl_id in number,
2499 p_refresh_cache in boolean default FALSE,
2500 p_inst_set out nocopy ben_elp_cache.g_cache_elpept_instor,
2501 p_inst_count out nocopy number) is
2502 --
2503 l_proc varchar2(72) := 'elpept_getcacdets';
2504 l_torrwnum pls_integer;
2505 l_insttorrw_num pls_integer;
2506 l_index pls_integer;
2507 --
2508 l_not_hash_found boolean;
2509 --
2510 begin
2511 --
2512 -- Flush the cache
2513 --
2514 if p_refresh_cache then
2515 --
2516 g_cache_elpept_lookup.delete;
2517 g_cache_elpept_inst.delete;
2518 --
2519 end if;
2520 --
2521 -- Populate the global cache
2522 --
2523 if g_cache_elpept_lookup.count = 0 then
2524 --
2525 -- Build the cache
2526 --
2527 ben_elp_cache.elpept_writecache
2528 (p_effective_date => p_effective_date,
2529 p_refresh_cache => p_refresh_cache);
2530 --
2531 end if;
2532 --
2533 -- Get the instance details
2534 --
2535 l_torrwnum := 0;
2536 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
2537 --
2538 -- Check if hashed value is already allocated
2539 --
2540 if g_cache_elpept_lookup.exists(l_index) then
2541 --
2542 -- If it does exist make sure its the right one
2543 --
2544 if g_cache_elpept_lookup(l_index).id <> p_eligy_prfl_id then
2545 --
2546 l_not_hash_found := false;
2547 --
2548 -- Loop until un-allocated has value is derived
2549 --
2550 while not l_not_hash_found loop
2551 --
2552 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
2553 --
2554 -- Check if the hash index exists, if not we can use it
2555 --
2556 -- Bug 13253435 when moved to next hash index checking whether that
2557 -- hash index 'id' is having value of p_eligy_prfl_id or not.
2558 -- If values are equal then existing from the loop
2559 if g_cache_elpept_lookup(l_index).id = p_eligy_prfl_id then
2560 l_not_hash_found := true;
2561 exit;
2562 end if;
2563 -- Bug 13253435
2564 if not g_cache_elpept_lookup.exists(l_index) then
2568 l_not_hash_found := true;
2565 --
2566 -- Lets store the hash value in the index
2567 --
2569 exit;
2570 --
2571 else
2572 --
2573 l_not_hash_found := false;
2574 --
2575 end if;
2576 --
2577 end loop;
2578 --
2579 end if;
2580 --
2581 end if;
2582 --
2583 for l_insttorrw_num in g_cache_elpept_lookup(l_index).starttorele_num ..
2584 g_cache_elpept_lookup(l_index).endtorele_num loop
2585 --
2586 p_inst_set(l_torrwnum) := g_cache_elpept_inst(l_insttorrw_num);
2587 l_torrwnum := l_torrwnum+1;
2588 --
2589 end loop;
2590 --
2591 p_inst_count := l_torrwnum;
2592 --
2593 exception
2594 --
2595 when no_data_found then
2596 --
2597 p_inst_count := 0;
2598 --
2599 end elpept_getcacdets;
2600 --
2601 procedure elpean_writecache
2602 (p_effective_date in date,
2603 p_refresh_cache in boolean default FALSE) is
2604 --
2605 l_proc varchar2(72) := 'elpean_writecache';
2606 l_torrwnum pls_integer;
2607 l_prev_id number;
2608 l_id number;
2609 --
2610 cursor c_elpean_look is
2611 select elp.eligy_prfl_id,
2612 elp.business_group_id
2613 from ben_eligy_prfl_f elp
2614 where p_effective_date
2615 between elp.effective_start_date
2616 and elp.effective_end_date
2617 and exists(select null
2618 from ben_elig_asnt_set_prte_f ean
2619 where p_effective_date
2620 between ean.effective_start_date
2621 and ean.effective_end_date
2622 and ean.eligy_prfl_id = elp.eligy_prfl_id)
2623 order by elp.eligy_prfl_id;
2624 --
2625 cursor c_elpean_inst is
2626 select ean.eligy_prfl_id,
2627 ean.elig_asnt_set_prte_id pk_id,
2628 'EAN' short_code,
2629 ass.formula_id,
2630 ean.excld_flag,
2631 ean.criteria_score,
2632 ean.criteria_weight
2633 from ben_elig_asnt_set_prte_f ean,
2634 hr_assignment_sets ass
2635 where p_effective_date
2636 between ean.effective_start_date
2637 and ean.effective_end_date
2638 and ean.assignment_set_id = ass.assignment_set_id
2639 order by ean.eligy_prfl_id,
2640 decode(ean.excld_flag,'Y',1,2),
2641 ean.ordr_num;
2642 --
2643 l_not_hash_found boolean;
2644 --
2645 begin
2646 --
2647 for objlook in c_elpean_look loop
2648 --
2649 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
2650 --
2651 -- Check if hashed value is already allocated
2652 --
2653 if g_cache_elpean_lookup.exists(l_id) then
2654 --
2655 l_not_hash_found := false;
2656 --
2657 -- Loop until un-allocated has value is derived
2658 --
2659 while not l_not_hash_found loop
2660 --
2661 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2662 --
2663 -- Check if the hash index exists, if not we can use it
2664 --
2665 if not g_cache_elpean_lookup.exists(l_id) then
2666 --
2667 -- Lets store the hash value in the index
2668 --
2669 l_not_hash_found := true;
2670 exit;
2671 --
2672 else
2673 --
2674 l_not_hash_found := false;
2675 --
2676 end if;
2677 --
2678 end loop;
2679 --
2680 end if;
2681 --
2682 g_cache_elpean_lookup(l_id).id := objlook.eligy_prfl_id;
2683 g_cache_elpean_lookup(l_id).fk_id := objlook.business_group_id;
2684 --
2685 end loop;
2686 --
2687 l_torrwnum := 0;
2688 l_prev_id := -1;
2689 --
2690 for objinst in c_elpean_inst loop
2691 --
2692 -- Populate the cache lookup details
2693 --
2694 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
2695 --
2696 -- Check if hashed value is already allocated
2697 --
2698 if g_cache_elpean_lookup(l_id).id = objinst.eligy_prfl_id then
2699 --
2700 null;
2701 --
2702 else
2703 --
2704 loop
2705 --
2706 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2707 --
2708 if g_cache_elpean_lookup(l_id).id = objinst.eligy_prfl_id then
2709 --
2710 exit;
2711 --
2712 end if;
2713 --
2714 end loop;
2715 --
2716 end if;
2717 --
2718 -- Check for first row
2719 --
2720 if l_prev_id = -1 then
2721 --
2722 g_cache_elpean_lookup(l_id).starttorele_num := l_torrwnum;
2723 --
2724 elsif l_id <> l_prev_id then
2725 --
2726 g_cache_elpean_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2727 g_cache_elpean_lookup(l_id).starttorele_num := l_torrwnum;
2728 --
2729 end if;
2730 --
2731 -- Populate the cache instance details
2732 --
2733 g_cache_elpean_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
2734 g_cache_elpean_inst(l_torrwnum).pk_id := objinst.pk_id;
2735 g_cache_elpean_inst(l_torrwnum).short_code := objinst.short_code;
2736 g_cache_elpean_inst(l_torrwnum).criteria_score := objinst.criteria_score;
2737 g_cache_elpean_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
2741 l_torrwnum := l_torrwnum+1;
2738 g_cache_elpean_inst(l_torrwnum).formula_id := objinst.formula_id;
2739 g_cache_elpean_inst(l_torrwnum).excld_flag := objinst.excld_flag;
2740 --
2742 l_prev_id := l_id;
2743 --
2744 end loop;
2745 --
2746 g_cache_elpean_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2747 --
2748 end elpean_writecache;
2749 --
2750 procedure elpean_getcacdets
2751 (p_effective_date in date,
2752 p_business_group_id in number,
2753 p_eligy_prfl_id in number,
2754 p_refresh_cache in boolean default FALSE,
2755 p_inst_set out nocopy ben_elp_cache.g_cache_elpean_instor,
2756 p_inst_count out nocopy number) is
2757 --
2758 l_proc varchar2(72) := 'elpean_getcacdets';
2759 l_torrwnum pls_integer;
2760 l_insttorrw_num pls_integer;
2761 l_index pls_integer;
2762 --
2763 l_not_hash_found boolean;
2764 --
2765 begin
2766 --
2767 -- Flush the cache
2768 --
2769 if p_refresh_cache then
2770 --
2771 g_cache_elpean_lookup.delete;
2772 g_cache_elpean_inst.delete;
2773 --
2774 end if;
2775 --
2776 -- Populate the global cache
2777 --
2778 if g_cache_elpean_lookup.count = 0 then
2779 --
2780 -- Build the cache
2781 --
2782 ben_elp_cache.elpean_writecache
2783 (p_effective_date => p_effective_date,
2784 p_refresh_cache => p_refresh_cache);
2785 --
2786 end if;
2787 --
2788 -- Get the instance details
2789 --
2790 l_torrwnum := 0;
2791 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
2792 --
2793 -- Check if hashed value is already allocated
2794 --
2795 if g_cache_elpean_lookup.exists(l_index) then
2796 --
2797 -- If it does exist make sure its the right one
2798 --
2799 if g_cache_elpean_lookup(l_index).id <> p_eligy_prfl_id then
2800 --
2801 l_not_hash_found := false;
2802 --
2803 -- Loop until un-allocated has value is derived
2804 --
2805 while not l_not_hash_found loop
2806 --
2807 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
2808 --
2809 -- Check if the hash index exists, if not we can use it
2810 --
2811 -- Bug 13253435 when moved to next hash index checking whether that
2812 -- hash index 'id' is having value of p_eligy_prfl_id or not.
2813 -- If values are equal then existing from the loop
2814 if g_cache_elpean_lookup(l_index).id = p_eligy_prfl_id then
2815 l_not_hash_found := true;
2816 exit;
2817 end if;
2818 -- Bug 13253435
2819 if not g_cache_elpean_lookup.exists(l_index) then
2820 --
2821 -- Lets store the hash value in the index
2822 --
2823 l_not_hash_found := true;
2824 exit;
2825 --
2826 else
2827 --
2828 l_not_hash_found := false;
2829 --
2830 end if;
2831 --
2832 end loop;
2833 --
2834 end if;
2835 --
2836 end if;
2837 --
2838 for l_insttorrw_num in g_cache_elpean_lookup(l_index).starttorele_num ..
2839 g_cache_elpean_lookup(l_index).endtorele_num loop
2840 --
2841 p_inst_set(l_torrwnum) := g_cache_elpean_inst(l_insttorrw_num);
2842 l_torrwnum := l_torrwnum+1;
2843 --
2844 end loop;
2845 --
2846 p_inst_count := l_torrwnum;
2847 --
2848 exception
2849 --
2850 when no_data_found then
2851 --
2852 p_inst_count := 0;
2853 --
2854 end elpean_getcacdets;
2855 --
2856 procedure elperl_writecache
2857 (p_effective_date in date,
2858 p_refresh_cache in boolean default FALSE) is
2859 --
2860 l_proc varchar2(72) := 'elperl_writecache';
2861 l_torrwnum pls_integer;
2862 l_prev_id number;
2863 l_id number;
2864 --
2865 cursor c_elperl_look is
2866 select elp.eligy_prfl_id,
2867 elp.business_group_id
2868 from ben_eligy_prfl_f elp
2869 where p_effective_date
2870 between elp.effective_start_date
2871 and elp.effective_end_date
2872 and exists(select null
2873 from ben_eligy_prfl_rl_f erl
2874 where p_effective_date
2875 between erl.effective_start_date
2876 and erl.effective_end_date
2877 and erl.eligy_prfl_id = elp.eligy_prfl_id)
2878 order by elp.eligy_prfl_id;
2879 --
2880 cursor c_elperl_inst is
2881 select erl.eligy_prfl_id,
2882 erl.eligy_prfl_rl_id pk_id,
2883 'ERL' short_code,
2884 erl.formula_id,
2885 erl.criteria_score,
2886 erl.criteria_weight
2887 from ben_eligy_prfl_rl_f erl
2888 where p_effective_date
2889 between erl.effective_start_date
2890 and erl.effective_end_date
2891 order by erl.eligy_prfl_id,
2892 erl.ordr_to_aply_num;
2893 --
2894 l_not_hash_found boolean;
2895 --
2896 begin
2897 --
2898 for objlook in c_elperl_look loop
2899 --
2900 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
2901 --
2902 -- Check if hashed value is already allocated
2903 --
2904 if g_cache_elperl_lookup.exists(l_id) then
2905 --
2906 l_not_hash_found := false;
2907 --
2908 -- Loop until un-allocated has value is derived
2909 --
2913 --
2910 while not l_not_hash_found loop
2911 --
2912 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2914 -- Check if the hash index exists, if not we can use it
2915 --
2916 if not g_cache_elperl_lookup.exists(l_id) then
2917 --
2918 -- Lets store the hash value in the index
2919 --
2920 l_not_hash_found := true;
2921 exit;
2922 --
2923 else
2924 --
2925 l_not_hash_found := false;
2926 --
2927 end if;
2928 --
2929 end loop;
2930 --
2931 end if;
2932 --
2933 g_cache_elperl_lookup(l_id).id := objlook.eligy_prfl_id;
2934 g_cache_elperl_lookup(l_id).fk_id := objlook.business_group_id;
2935 --
2936 end loop;
2937 --
2938 l_torrwnum := 0;
2939 l_prev_id := -1;
2940 --
2941 for objinst in c_elperl_inst loop
2942 --
2943 -- Populate the cache lookup details
2944 --
2945 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
2946 --
2947 -- Check if hashed value is already allocated
2948 --
2949 if g_cache_elperl_lookup(l_id).id = objinst.eligy_prfl_id then
2950 --
2951 null;
2952 --
2953 else
2954 --
2955 loop
2956 --
2957 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
2958 --
2959 if g_cache_elperl_lookup(l_id).id = objinst.eligy_prfl_id then
2960 --
2961 exit;
2962 --
2963 end if;
2964 --
2965 end loop;
2966 --
2967 end if;
2968 --
2969 -- Check for first row
2970 --
2971 if l_prev_id = -1 then
2972 --
2973 g_cache_elperl_lookup(l_id).starttorele_num := l_torrwnum;
2974 --
2975 elsif l_id <> l_prev_id then
2976 --
2977 g_cache_elperl_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2978 g_cache_elperl_lookup(l_id).starttorele_num := l_torrwnum;
2979 --
2980 end if;
2981 --
2982 -- Populate the cache instance details
2983 --
2984 g_cache_elperl_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
2985 g_cache_elperl_inst(l_torrwnum).pk_id := objinst.pk_id;
2986 g_cache_elperl_inst(l_torrwnum).short_code := objinst.short_code;
2987 g_cache_elperl_inst(l_torrwnum).criteria_score := objinst.criteria_score;
2988 g_cache_elperl_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
2989 g_cache_elperl_inst(l_torrwnum).formula_id := objinst.formula_id;
2990 --
2991 l_torrwnum := l_torrwnum+1;
2992 l_prev_id := l_id;
2993 --
2994 end loop;
2995 --
2996 g_cache_elperl_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
2997 --
2998 end elperl_writecache;
2999 --
3000 procedure elperl_getcacdets
3001 (p_effective_date in date,
3002 p_business_group_id in number,
3003 p_eligy_prfl_id in number,
3004 p_refresh_cache in boolean default FALSE,
3005 p_inst_set out nocopy ben_elp_cache.g_cache_elperl_instor,
3006 p_inst_count out nocopy number) is
3007 --
3008 l_proc varchar2(72) := 'elperl_getcacdets';
3009 l_torrwnum pls_integer;
3010 l_insttorrw_num pls_integer;
3011 l_index pls_integer;
3012 --
3013 l_not_hash_found boolean;
3014 --
3015 begin
3016 --
3017 -- Flush the cache
3018 --
3019 if p_refresh_cache then
3020 --
3021 g_cache_elperl_lookup.delete;
3022 g_cache_elperl_inst.delete;
3023 --
3024 end if;
3025 --
3026 -- Populate the global cache
3027 --
3028 if g_cache_elperl_lookup.count = 0 then
3029 --
3030 -- Build the cache
3031 --
3032 ben_elp_cache.elperl_writecache
3033 (p_effective_date => p_effective_date,
3034 p_refresh_cache => p_refresh_cache);
3035 --
3036 end if;
3037 --
3038 -- Get the instance details
3039 --
3040 l_torrwnum := 0;
3041 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
3042 --
3043 -- Check if hashed value is already allocated
3044 --
3045 if g_cache_elperl_lookup.exists(l_index) then
3046 --
3047 -- If it does exist make sure its the right one
3048 --
3049 if g_cache_elperl_lookup(l_index).id <> p_eligy_prfl_id then
3050 --
3051 l_not_hash_found := false;
3052 --
3053 -- Loop until un-allocated has value is derived
3054 --
3055 while not l_not_hash_found loop
3056 --
3057 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
3058 --
3059 -- Check if the hash index exists, if not we can use it
3060 --
3061 -- Bug 13253435 when moved to next hash index checking whether that
3062 -- hash index 'id' is having value of p_eligy_prfl_id or not.
3063 -- If values are equal then existing from the loop
3064 if g_cache_elperl_lookup(l_index).id = p_eligy_prfl_id then
3065 l_not_hash_found := true;
3066 exit;
3067 end if;
3068 -- Bug 13253435
3069
3070 if not g_cache_elperl_lookup.exists(l_index) then
3071 --
3072 -- Lets store the hash value in the index
3073 --
3074 l_not_hash_found := true;
3075 exit;
3076 --
3077 else
3078 --
3082 --
3079 l_not_hash_found := false;
3080 --
3081 end if;
3083 end loop;
3084 --
3085 end if;
3086 --
3087 end if;
3088 --
3089 for l_insttorrw_num in g_cache_elperl_lookup(l_index).starttorele_num ..
3090 g_cache_elperl_lookup(l_index).endtorele_num loop
3091 --
3092 p_inst_set(l_torrwnum) := g_cache_elperl_inst(l_insttorrw_num);
3093 l_torrwnum := l_torrwnum+1;
3094 --
3095 end loop;
3096 --
3097 p_inst_count := l_torrwnum;
3098 --
3099 exception
3100 --
3101 when no_data_found then
3102 --
3103 p_inst_count := 0;
3104 --
3105 end elperl_getcacdets;
3106 --
3107 procedure elpees_writecache
3108 (p_effective_date in date,
3109 p_refresh_cache in boolean default FALSE) is
3110 --
3111 l_proc varchar2(72) := 'elpees_writecache';
3112 l_torrwnum pls_integer;
3113 l_prev_id number;
3114 l_id number;
3115 --
3116 cursor c_elpees_look is
3117 select elp.eligy_prfl_id,
3118 elp.business_group_id
3119 from ben_eligy_prfl_f elp
3120 where p_effective_date
3121 between elp.effective_start_date
3122 and elp.effective_end_date
3123 and exists(select null
3124 from ben_elig_ee_stat_prte_f ees
3125 where p_effective_date
3126 between ees.effective_start_date
3127 and ees.effective_end_date
3128 and ees.eligy_prfl_id = elp.eligy_prfl_id)
3129 order by elp.eligy_prfl_id;
3130 --
3131 cursor c_elpees_inst is
3132 select ees.eligy_prfl_id,
3133 ees.elig_ee_stat_prte_id pk_id,
3134 'EES' short_code,
3135 ees.assignment_status_type_id,
3136 ees.excld_flag,
3137 ees.criteria_score,
3138 ees.criteria_weight
3139 from ben_elig_ee_stat_prte_f ees
3140 where p_effective_date
3141 between ees.effective_start_date
3142 and ees.effective_end_date
3143 order by ees.eligy_prfl_id,
3144 decode(ees.excld_flag,'Y',1,2),
3145 ees.ordr_num;
3146 --
3147 l_not_hash_found boolean;
3148 --
3149 begin
3150 --
3151 for objlook in c_elpees_look loop
3152 --
3153 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
3154 --
3155 -- Check if hashed value is already allocated
3156 --
3157 if g_cache_elpees_lookup.exists(l_id) then
3158 --
3159 l_not_hash_found := false;
3160 --
3161 -- Loop until un-allocated has value is derived
3162 --
3163 while not l_not_hash_found loop
3164 --
3165 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3166 --
3167 -- Check if the hash index exists, if not we can use it
3168 --
3169 if not g_cache_elpees_lookup.exists(l_id) then
3170 --
3171 -- Lets store the hash value in the index
3172 --
3173 l_not_hash_found := true;
3174 exit;
3175 --
3176 else
3177 --
3178 l_not_hash_found := false;
3179 --
3180 end if;
3181 --
3182 end loop;
3183 --
3184 end if;
3185 --
3186 g_cache_elpees_lookup(l_id).id := objlook.eligy_prfl_id;
3187 g_cache_elpees_lookup(l_id).fk_id := objlook.business_group_id;
3188 --
3189 end loop;
3190 --
3191 l_torrwnum := 0;
3192 l_prev_id := -1;
3193 --
3194 for objinst in c_elpees_inst loop
3195 --
3196 -- Populate the cache lookup details
3197 --
3198 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
3199 --
3200 -- Check if hashed value is already allocated
3201 --
3202 if g_cache_elpees_lookup(l_id).id = objinst.eligy_prfl_id then
3203 --
3204 null;
3205 --
3206 else
3207 --
3208 loop
3209 --
3210 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3211 --
3212 if g_cache_elpees_lookup(l_id).id = objinst.eligy_prfl_id then
3213 --
3214 exit;
3215 --
3216 end if;
3217 --
3218 end loop;
3219 --
3220 end if;
3221 --
3222 -- Check for first row
3223 --
3224 if l_prev_id = -1 then
3225 --
3226 g_cache_elpees_lookup(l_id).starttorele_num := l_torrwnum;
3227 --
3228 elsif l_id <> l_prev_id then
3229 --
3230 g_cache_elpees_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
3231 g_cache_elpees_lookup(l_id).starttorele_num := l_torrwnum;
3232 --
3233 end if;
3234 --
3235 -- Populate the cache instance details
3236 --
3237 g_cache_elpees_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
3238 g_cache_elpees_inst(l_torrwnum).pk_id := objinst.pk_id;
3239 g_cache_elpees_inst(l_torrwnum).short_code := objinst.short_code;
3240 g_cache_elpees_inst(l_torrwnum).criteria_score := objinst.criteria_score;
3241 g_cache_elpees_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
3242 g_cache_elpees_inst(l_torrwnum).assignment_status_type_id := objinst.assignment_status_type_id;
3243 g_cache_elpees_inst(l_torrwnum).excld_flag := objinst.excld_flag;
3247 --
3244 --
3245 l_torrwnum := l_torrwnum+1;
3246 l_prev_id := l_id;
3248 end loop;
3249 --
3250 g_cache_elpees_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
3251 --
3252 end elpees_writecache;
3253 --
3254 procedure elpees_getcacdets
3255 (p_effective_date in date,
3256 p_business_group_id in number,
3257 p_eligy_prfl_id in number,
3258 p_refresh_cache in boolean default FALSE,
3259 p_inst_set out nocopy ben_elp_cache.g_cache_elpees_instor,
3260 p_inst_count out nocopy number) is
3261 --
3262 l_proc varchar2(72) := 'elpees_getcacdets';
3263 l_torrwnum pls_integer;
3264 l_insttorrw_num pls_integer;
3265 l_index pls_integer;
3266 --
3267 l_not_hash_found boolean;
3268 --
3269 begin
3270 --
3271 -- Flush the cache
3272 --
3273 if p_refresh_cache then
3274 --
3275 g_cache_elpees_lookup.delete;
3276 g_cache_elpees_inst.delete;
3277 --
3278 end if;
3279 --
3280 -- Populate the global cache
3281 --
3282 if g_cache_elpees_lookup.count = 0 then
3283 --
3284 -- Build the cache
3285 --
3286 ben_elp_cache.elpees_writecache
3287 (p_effective_date => p_effective_date,
3288 p_refresh_cache => p_refresh_cache);
3289 --
3290 end if;
3291 --
3292 -- Get the instance details
3293 --
3294 l_torrwnum := 0;
3295 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
3296 --
3297 -- Check if hashed value is already allocated
3298 --
3299 if g_cache_elpees_lookup.exists(l_index) then
3300 --
3301 -- If it does exist make sure its the right one
3302 --
3303 if g_cache_elpees_lookup(l_index).id <> p_eligy_prfl_id then
3304 --
3305 l_not_hash_found := false;
3306 --
3307 -- Loop until un-allocated has value is derived
3308 --
3309 while not l_not_hash_found loop
3310 --
3311 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
3312 --
3313 -- Check if the hash index exists, if not we can use it
3314 --
3315 -- Bug 13253435 when moved to next hash index checking whether that
3316 -- hash index 'id' is having value of p_eligy_prfl_id or not.
3317 -- If values are equal then existing from the loop
3318 if g_cache_elpees_lookup(l_index).id = p_eligy_prfl_id then
3319 l_not_hash_found := true;
3320 exit;
3321 end if;
3322 -- Bug 13253435
3323
3324 if not g_cache_elpees_lookup.exists(l_index) then
3325 --
3326 -- Lets store the hash value in the index
3327 --
3328 l_not_hash_found := true;
3329 exit;
3330 --
3331 else
3332 --
3333 l_not_hash_found := false;
3334 --
3335 end if;
3336 --
3337 end loop;
3338 --
3339 end if;
3340 --
3341 end if;
3342 --
3343 for l_insttorrw_num in g_cache_elpees_lookup(l_index).starttorele_num ..
3344 g_cache_elpees_lookup(l_index).endtorele_num loop
3345 --
3346 p_inst_set(l_torrwnum) := g_cache_elpees_inst(l_insttorrw_num);
3347 l_torrwnum := l_torrwnum+1;
3348 --
3349 end loop;
3350 --
3351 p_inst_count := l_torrwnum;
3352 --
3353 exception
3354 --
3355 when no_data_found then
3356 --
3357 p_inst_count := 0;
3358 --
3359 end elpees_getcacdets;
3360 --
3361 procedure elpesa_writecache
3362 (p_effective_date in date,
3363 p_refresh_cache in boolean default FALSE) is
3364 --
3365 l_proc varchar2(72) := 'elpesa_writecache';
3366 l_torrwnum pls_integer;
3367 l_prev_id number;
3368 l_id number;
3369 --
3370 cursor c_elpesa_look is
3371 select elp.eligy_prfl_id, elp.business_group_id
3372 from ben_eligy_prfl_f elp
3373 where p_effective_date
3374 between elp.effective_start_date
3375 and elp.effective_end_date
3376 and exists (select null
3377 from ben_elig_svc_area_prte_f esa,
3378 ben_svc_area_pstl_zip_rng_f saz,
3379 ben_pstl_zip_rng_f rzr
3380 where p_effective_date
3381 between esa.effective_start_date
3382 and esa.effective_end_date
3383 and esa.svc_area_id = saz.svc_area_id
3384 and esa.business_group_id = saz.business_group_id
3385 and p_effective_date
3386 between rzr.effective_start_date
3387 and rzr.effective_end_date
3388 and saz.pstl_zip_rng_id = rzr.pstl_zip_rng_id
3389 and esa.business_group_id = rzr.business_group_id
3390 and esa.eligy_prfl_id = elp.eligy_prfl_id)
3391 order by elp.eligy_prfl_id;
3392 --
3393 cursor c_elpesa_inst is
3394 select esa.eligy_prfl_id,
3395 esa.elig_svc_area_prte_id pk_id,
3396 'ESA' short_code,
3397 esa.excld_flag,
3398 esa.criteria_score,
3399 esa.criteria_weight,
3400 rzr.from_value,
3401 rzr.to_value
3402 from ben_elig_svc_area_prte_f esa,
3403 ben_svc_area_pstl_zip_rng_f saz,
3404 ben_pstl_zip_rng_f rzr
3405 where p_effective_date
3409 and esa.business_group_id = saz.business_group_id
3406 between esa.effective_start_date
3407 and esa.effective_end_date
3408 and esa.svc_area_id = saz.svc_area_id
3410 and p_effective_date
3411 between rzr.effective_start_date
3412 and rzr.effective_end_date
3413 and saz.pstl_zip_rng_id = rzr.pstl_zip_rng_id
3414 and saz.business_group_id = rzr.business_group_id
3415 order by esa.eligy_prfl_id,
3416 decode(esa.excld_flag,'Y',1,2),
3417 esa.ordr_num;
3418 --
3419 l_not_hash_found boolean;
3420 --
3421 begin
3422 --
3423 for objlook in c_elpesa_look loop
3424 --
3425 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
3426 --
3427 -- Check if hashed value is already allocated
3428 --
3429 if g_cache_elpesa_lookup.exists(l_id) then
3430 --
3431 l_not_hash_found := false;
3432 --
3433 -- Loop until un-allocated has value is derived
3434 --
3435 while not l_not_hash_found loop
3436 --
3437 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3438 --
3439 -- Check if the hash index exists, if not we can use it
3440 --
3441 if not g_cache_elpesa_lookup.exists(l_id) then
3442 --
3443 -- Lets store the hash value in the index
3444 --
3445 l_not_hash_found := true;
3446 exit;
3447 --
3448 else
3449 --
3450 l_not_hash_found := false;
3451 --
3452 end if;
3453 --
3454 end loop;
3455 --
3456 end if;
3457 --
3458 g_cache_elpesa_lookup(l_id).id := objlook.eligy_prfl_id;
3459 g_cache_elpesa_lookup(l_id).fk_id := objlook.business_group_id;
3460 --
3461 end loop;
3462 --
3463 l_torrwnum := 0;
3464 l_prev_id := -1;
3465 --
3466 for objinst in c_elpesa_inst loop
3467 --
3468 -- Populate the cache lookup details
3469 --
3470 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
3471 --
3472 -- Check if hashed value is already allocated
3473 --
3474 if g_cache_elpesa_lookup(l_id).id = objinst.eligy_prfl_id then
3475 --
3476 null;
3477 --
3478 else
3479 --
3480 loop
3481 --
3482 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3483 --
3484 if g_cache_elpesa_lookup(l_id).id = objinst.eligy_prfl_id then
3485 --
3486 exit;
3487 --
3488 end if;
3489 --
3490 end loop;
3491 --
3492 end if;
3493 --
3494 -- Check for first row
3495 --
3496 if l_prev_id = -1 then
3497 --
3498 g_cache_elpesa_lookup(l_id).starttorele_num := l_torrwnum;
3499 --
3500 elsif l_id <> l_prev_id then
3501 --
3502 g_cache_elpesa_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
3503 g_cache_elpesa_lookup(l_id).starttorele_num := l_torrwnum;
3504 --
3505 end if;
3506 --
3507 -- Populate the cache instance details
3508 --
3509 g_cache_elpesa_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
3510 g_cache_elpesa_inst(l_torrwnum).pk_id := objinst.pk_id;
3511 g_cache_elpesa_inst(l_torrwnum).short_code := objinst.short_code;
3512 g_cache_elpesa_inst(l_torrwnum).criteria_score := objinst.criteria_score;
3513 g_cache_elpesa_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
3514 g_cache_elpesa_inst(l_torrwnum).excld_flag := objinst.excld_flag;
3515 g_cache_elpesa_inst(l_torrwnum).from_value := objinst.from_value;
3516 g_cache_elpesa_inst(l_torrwnum).to_value := objinst.to_value;
3517 --
3518 l_torrwnum := l_torrwnum+1;
3519 l_prev_id := l_id;
3520 --
3521 end loop;
3522 --
3523 g_cache_elpesa_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
3524 --
3525 end elpesa_writecache;
3526 --
3527 procedure elpesa_getcacdets
3528 (p_effective_date in date,
3529 p_business_group_id in number,
3530 p_eligy_prfl_id in number,
3531 p_refresh_cache in boolean default FALSE,
3532 p_inst_set out nocopy ben_elp_cache.g_cache_elpesa_instor,
3533 p_inst_count out nocopy number) is
3534 --
3535 l_proc varchar2(72) := 'elpesa_getcacdets';
3536 l_torrwnum pls_integer;
3537 l_insttorrw_num pls_integer;
3538 l_index pls_integer;
3539 --
3540 l_not_hash_found boolean;
3541 --
3542 begin
3543 --
3544 -- Flush the cache
3545 --
3546 if p_refresh_cache then
3547 --
3548 g_cache_elpesa_lookup.delete;
3549 g_cache_elpesa_inst.delete;
3550 --
3551 end if;
3552 --
3553 -- Populate the global cache
3554 --
3555 if g_cache_elpesa_lookup.count = 0 then
3556 --
3557 -- Build the cache
3558 --
3559 ben_elp_cache.elpesa_writecache
3560 (p_effective_date => p_effective_date,
3561 p_refresh_cache => p_refresh_cache);
3562 --
3563 end if;
3564 --
3565 -- Get the instance details
3566 --
3567 l_torrwnum := 0;
3568 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
3569 --
3570 -- Check if hashed value is already allocated
3571 --
3572 if g_cache_elpesa_lookup.exists(l_index) then
3573 --
3574 -- If it does exist make sure its the right one
3575 --
3576 if g_cache_elpesa_lookup(l_index).id <> p_eligy_prfl_id then
3580 -- Loop until un-allocated has value is derived
3577 --
3578 l_not_hash_found := false;
3579 --
3581 --
3582 while not l_not_hash_found loop
3583 --
3584 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
3585 --
3586 -- Check if the hash index exists, if not we can use it
3587 --
3588 -- Bug 13253435 when moved to next hash index checking whether that
3589 -- hash index 'id' is having value of p_eligy_prfl_id or not.
3590 -- If values are equal then existing from the loop
3591 if g_cache_elpesa_lookup(l_index).id = p_eligy_prfl_id then
3592 l_not_hash_found := true;
3593 exit;
3594 end if;
3595 -- Bug 13253435
3596
3597 if not g_cache_elpesa_lookup.exists(l_index) then
3598 --
3599 -- Lets store the hash value in the index
3600 --
3601 l_not_hash_found := true;
3602 exit;
3603 --
3604 else
3605 --
3606 l_not_hash_found := false;
3607 --
3608 end if;
3609 --
3610 end loop;
3611 --
3612 end if;
3613 --
3614 end if;
3615 --
3616 for l_insttorrw_num in g_cache_elpesa_lookup(l_index).starttorele_num ..
3617 g_cache_elpesa_lookup(l_index).endtorele_num loop
3618 --
3619 p_inst_set(l_torrwnum) := g_cache_elpesa_inst(l_insttorrw_num);
3620 l_torrwnum := l_torrwnum+1;
3621 --
3622 end loop;
3623 --
3624 p_inst_count := l_torrwnum;
3625 --
3626 exception
3627 --
3628 when no_data_found then
3629 --
3630 p_inst_count := 0;
3631 --
3632 end elpesa_getcacdets;
3633 --
3634 procedure elpels_writecache
3635 (p_effective_date in date,
3636 p_refresh_cache in boolean default FALSE) is
3637 --
3638 l_proc varchar2(72) := 'elpels_writecache';
3639 l_torrwnum pls_integer;
3640 l_prev_id number;
3641 l_id number;
3642 --
3643 cursor c_elpels_look is
3644 select elp.eligy_prfl_id,
3645 elp.business_group_id
3646 from ben_eligy_prfl_f elp
3647 where p_effective_date
3648 between elp.effective_start_date
3649 and elp.effective_end_date
3650 and exists(select null
3651 from ben_elig_los_prte_f els,
3652 ben_los_fctr lsf
3653 where p_effective_date
3654 between els.effective_start_date
3655 and els.effective_end_date
3656 and els.los_fctr_id = lsf.los_fctr_id
3657 and els.business_group_id = lsf.business_group_id
3658 and els.eligy_prfl_id = elp.eligy_prfl_id)
3659 order by elp.eligy_prfl_id;
3660 --
3661 cursor c_elpels_inst is
3662 select els.eligy_prfl_id,
3663 els.elig_los_prte_id pk_id,
3664 'ELS' short_code,
3665 els.los_fctr_id,
3666 els.excld_flag,
3667 els.criteria_score,
3668 els.criteria_weight,
3669 lsf.mx_los_num,
3670 lsf.mn_los_num,
3671 lsf.no_mx_los_num_apls_flag,
3672 lsf.no_mn_los_num_apls_flag
3673 from ben_elig_los_prte_f els,
3674 ben_los_fctr lsf
3675 where p_effective_date
3676 between els.effective_start_date
3677 and els.effective_end_date
3678 and els.los_fctr_id = lsf.los_fctr_id
3679 and els.business_group_id = lsf.business_group_id
3680 order by els.eligy_prfl_id,
3681 decode(els.excld_flag,'Y',1,2),
3682 els.ordr_num;
3683 --
3684 l_not_hash_found boolean;
3685 --
3686 begin
3687 --
3688 for objlook in c_elpels_look loop
3689 --
3690 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
3691 --
3692 -- Check if hashed value is already allocated
3693 --
3694 if g_cache_elpels_lookup.exists(l_id) then
3695 --
3696 l_not_hash_found := false;
3697 --
3698 -- Loop until un-allocated has value is derived
3699 --
3700 while not l_not_hash_found loop
3701 --
3702 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3703 --
3704 -- Check if the hash index exists, if not we can use it
3705 --
3706 if not g_cache_elpels_lookup.exists(l_id) then
3707 --
3708 -- Lets store the hash value in the index
3709 --
3710 l_not_hash_found := true;
3711 exit;
3712 --
3713 else
3714 --
3715 l_not_hash_found := false;
3716 --
3717 end if;
3718 --
3719 end loop;
3720 --
3721 end if;
3722 --
3723 g_cache_elpels_lookup(l_id).id := objlook.eligy_prfl_id;
3724 g_cache_elpels_lookup(l_id).fk_id := objlook.business_group_id;
3725 --
3726 end loop;
3727 --
3728 l_torrwnum := 0;
3729 l_prev_id := -1;
3730 --
3731 for objinst in c_elpels_inst loop
3732 --
3733 -- Populate the cache lookup details
3734 --
3735 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
3736 --
3737 -- Check if hashed value is already allocated
3738 --
3739 if g_cache_elpels_lookup(l_id).id = objinst.eligy_prfl_id then
3740 --
3741 null;
3742 --
3743 else
3744 --
3745 loop
3746 --
3750 --
3747 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3748 --
3749 if g_cache_elpels_lookup(l_id).id = objinst.eligy_prfl_id then
3751 exit;
3752 --
3753 end if;
3754 --
3755 end loop;
3756 --
3757 end if;
3758 --
3759 -- Check for first row
3760 --
3761 if l_prev_id = -1 then
3762 --
3763 g_cache_elpels_lookup(l_id).starttorele_num := l_torrwnum;
3764 --
3765 elsif l_id <> l_prev_id then
3766 --
3767 g_cache_elpels_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
3768 g_cache_elpels_lookup(l_id).starttorele_num := l_torrwnum;
3769 --
3770 end if;
3771 --
3772 -- Populate the cache instance details
3773 --
3774 g_cache_elpels_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
3775 g_cache_elpels_inst(l_torrwnum).pk_id := objinst.pk_id;
3776 g_cache_elpels_inst(l_torrwnum).short_code := objinst.short_code;
3777 g_cache_elpels_inst(l_torrwnum).criteria_score := objinst.criteria_score;
3778 g_cache_elpels_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
3779 g_cache_elpels_inst(l_torrwnum).los_fctr_id := objinst.los_fctr_id;
3780 g_cache_elpels_inst(l_torrwnum).excld_flag := objinst.excld_flag;
3781 g_cache_elpels_inst(l_torrwnum).criteria_score := objinst.criteria_score;
3782 g_cache_elpels_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
3783 g_cache_elpels_inst(l_torrwnum).mx_los_num := objinst.mx_los_num;
3784 g_cache_elpels_inst(l_torrwnum).mn_los_num := objinst.mn_los_num;
3785 g_cache_elpels_inst(l_torrwnum).no_mx_los_num_apls_flag := objinst.no_mx_los_num_apls_flag;
3786 g_cache_elpels_inst(l_torrwnum).no_mn_los_num_apls_flag := objinst.no_mn_los_num_apls_flag;
3787 --
3788 l_torrwnum := l_torrwnum+1;
3789 l_prev_id := l_id;
3790 --
3791 end loop;
3792 --
3793 g_cache_elpels_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
3794 --
3795 end elpels_writecache;
3796 --
3797 procedure elpels_getcacdets
3798 (p_effective_date in date,
3799 p_business_group_id in number,
3800 p_eligy_prfl_id in number,
3801 p_refresh_cache in boolean default FALSE,
3802 p_inst_set out nocopy ben_elp_cache.g_cache_elpels_instor,
3803 p_inst_count out nocopy number) is
3804 --
3805 l_proc varchar2(72) := 'elpels_getcacdets';
3806 l_torrwnum pls_integer;
3807 l_insttorrw_num pls_integer;
3808 l_index pls_integer;
3809 --
3810 l_not_hash_found boolean;
3811 --
3812 begin
3813 --
3814 -- Flush the cache
3815 --
3816 if p_refresh_cache then
3817 --
3818 g_cache_elpels_lookup.delete;
3819 g_cache_elpels_inst.delete;
3820 --
3821 end if;
3822 --
3823 -- Populate the global cache
3824 --
3825 if g_cache_elpels_lookup.count = 0 then
3826 --
3827 -- Build the cache
3828 --
3829 ben_elp_cache.elpels_writecache
3830 (p_effective_date => p_effective_date,
3831 p_refresh_cache => p_refresh_cache);
3832 --
3833 end if;
3834 --
3835 -- Get the instance details
3836 --
3837 l_torrwnum := 0;
3838 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
3839 --
3840 -- Check if hashed value is already allocated
3841 --
3842 if g_cache_elpels_lookup.exists(l_index) then
3843 --
3844 -- If it does exist make sure its the right one
3845 --
3846 if g_cache_elpels_lookup(l_index).id <> p_eligy_prfl_id then
3847 --
3848 l_not_hash_found := false;
3849 --
3850 -- Loop until un-allocated has value is derived
3851 --
3852 while not l_not_hash_found loop
3853 --
3854 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
3855 --
3856 -- Check if the hash index exists, if not we can use it
3857 --
3858 -- Bug 13253435 when moved to next hash index checking whether that
3859 -- hash index 'id' is having value of p_eligy_prfl_id or not.
3860 -- If values are equal then existing from the loop
3861 if g_cache_elpels_lookup(l_index).id = p_eligy_prfl_id then
3862 l_not_hash_found := true;
3863 exit;
3864 end if;
3865 -- Bug 13253435
3866
3867 if not g_cache_elpels_lookup.exists(l_index) then
3868 --
3869 -- Lets store the hash value in the index
3870 --
3871 l_not_hash_found := true;
3872 exit;
3873 --
3874 else
3875 --
3876 l_not_hash_found := false;
3877 --
3878 end if;
3879 --
3880 end loop;
3881 --
3882 end if;
3883 --
3884 end if;
3885 --
3886 for l_insttorrw_num in g_cache_elpels_lookup(l_index).starttorele_num ..
3887 g_cache_elpels_lookup(l_index).endtorele_num loop
3888 --
3889 p_inst_set(l_torrwnum) := g_cache_elpels_inst(l_insttorrw_num);
3890 l_torrwnum := l_torrwnum+1;
3891 --
3892 end loop;
3893 --
3894 p_inst_count := l_torrwnum;
3895 --
3896 exception
3897 --
3898 when no_data_found then
3899 --
3900 p_inst_count := 0;
3901 --
3902 end elpels_getcacdets;
3903 --
3904 procedure elpecp_writecache
3905 (p_effective_date in date,
3906 p_refresh_cache in boolean default FALSE) is
3907 --
3908 l_proc varchar2(72) := 'elpecp_writecache';
3909 --
3910 l_torrwnum pls_integer;
3911 --
3912 l_prev_id number;
3916 select elp.eligy_prfl_id,
3913 l_id number;
3914 --
3915 cursor c_elpecp_look is
3917 elp.business_group_id
3918 from ben_eligy_prfl_f elp
3919 where p_effective_date
3920 between elp.effective_start_date
3921 and elp.effective_end_date
3922 and exists(select null
3923 from ben_elig_cmbn_age_los_prte_f ecp,
3924 ben_cmbn_age_los_fctr cla
3925 where ecp.cmbn_age_los_fctr_id = cla.cmbn_age_los_fctr_id
3926 and ecp.business_group_id = cla.business_group_id
3927 and p_effective_date
3928 between ecp.effective_start_date
3929 and ecp.effective_end_date
3930 and ecp.eligy_prfl_id = elp.eligy_prfl_id)
3931 order by elp.eligy_prfl_id;
3932 --
3933 cursor c_elpecp_inst is
3934 select ecp.eligy_prfl_id,
3935 ecp.elig_cmbn_age_los_prte_id pk_id,
3936 'ECP' short_code,
3937 ecp.cmbn_age_los_fctr_id,
3938 ecp.excld_flag,
3939 ecp.criteria_score,
3940 ecp.criteria_weight,
3941 cla.cmbnd_min_val,
3942 cla.cmbnd_max_val,
3943 cla.los_fctr_id,
3944 cla.age_fctr_id
3945 from ben_elig_cmbn_age_los_prte_f ecp,
3946 ben_cmbn_age_los_fctr cla
3947 where ecp.cmbn_age_los_fctr_id = cla.cmbn_age_los_fctr_id
3948 and ecp.business_group_id = cla.business_group_id
3949 and p_effective_date
3950 between ecp.effective_start_date
3951 and ecp.effective_end_date
3952 order by ecp.eligy_prfl_id,
3953 decode(ecp.excld_flag,'Y',1,2),
3954 ecp.ordr_num;
3955 --
3956 l_not_hash_found boolean;
3957 --
3958 begin
3959 --
3960 for objlook in c_elpecp_look loop
3961 --
3962 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
3963 --
3964 -- Check if hashed value is already allocated
3965 --
3966 if g_cache_elpecp_lookup.exists(l_id) then
3967 --
3968 l_not_hash_found := false;
3969 --
3970 -- Loop until un-allocated has value is derived
3971 --
3972 while not l_not_hash_found loop
3973 --
3974 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
3975 --
3976 -- Check if the hash index exists, if not we can use it
3977 --
3978 if not g_cache_elpecp_lookup.exists(l_id) then
3979 --
3980 -- Lets store the hash value in the index
3981 --
3982 l_not_hash_found := true;
3983 exit;
3984 --
3985 else
3986 --
3987 l_not_hash_found := false;
3988 --
3989 end if;
3990 --
3991 end loop;
3992 --
3993 end if;
3994 --
3995 g_cache_elpecp_lookup(l_id).id := objlook.eligy_prfl_id;
3996 g_cache_elpecp_lookup(l_id).fk_id := objlook.business_group_id;
3997 --
3998 end loop;
3999 --
4000 l_torrwnum := 0;
4001 l_prev_id := -1;
4002 --
4003 for objinst in c_elpecp_inst loop
4004 --
4005 -- Populate the cache lookup details
4006 --
4007 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
4008 --
4009 -- Check if hashed value is already allocated
4010 --
4011 if g_cache_elpecp_lookup(l_id).id = objinst.eligy_prfl_id then
4012 --
4013 null;
4014 --
4015 else
4016 --
4017 loop
4018 --
4019 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4020 --
4021 if g_cache_elpecp_lookup(l_id).id = objinst.eligy_prfl_id then
4022 --
4023 exit;
4024 --
4025 end if;
4026 --
4027 end loop;
4028 --
4029 end if;
4030 --
4031 -- Check for first row
4032 --
4033 if l_prev_id = -1 then
4034 --
4035 g_cache_elpecp_lookup(l_id).starttorele_num := l_torrwnum;
4036 --
4037 elsif l_id <> l_prev_id then
4038 --
4039 g_cache_elpecp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4040 g_cache_elpecp_lookup(l_id).starttorele_num := l_torrwnum;
4041 --
4042 end if;
4043 --
4044 -- Populate the cache instance details
4045 --
4046 g_cache_elpecp_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
4047 g_cache_elpecp_inst(l_torrwnum).pk_id := objinst.pk_id;
4048 g_cache_elpecp_inst(l_torrwnum).short_code := objinst.short_code;
4049 g_cache_elpecp_inst(l_torrwnum).criteria_score := objinst.criteria_score;
4050 g_cache_elpecp_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
4051 g_cache_elpecp_inst(l_torrwnum).cmbn_age_los_fctr_id := objinst.cmbn_age_los_fctr_id;
4052 g_cache_elpecp_inst(l_torrwnum).excld_flag := objinst.excld_flag;
4053 g_cache_elpecp_inst(l_torrwnum).cmbnd_min_val := objinst.cmbnd_min_val;
4054 g_cache_elpecp_inst(l_torrwnum).cmbnd_max_val := objinst.cmbnd_max_val;
4055 g_cache_elpecp_inst(l_torrwnum).los_fctr_id := objinst.los_fctr_id;
4056 g_cache_elpecp_inst(l_torrwnum).age_fctr_id := objinst.age_fctr_id;
4057 --
4058 l_torrwnum := l_torrwnum+1;
4059 l_prev_id := l_id;
4060 --
4061 end loop;
4062 --
4063 g_cache_elpecp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4064 --
4065 end elpecp_writecache;
4066 --
4067 procedure elpecp_getcacdets
4068 (p_effective_date in date,
4069 p_business_group_id in number,
4070 p_eligy_prfl_id in number,
4074 --
4071 p_refresh_cache in boolean default FALSE,
4072 p_inst_set out nocopy ben_elp_cache.g_cache_elpecp_instor,
4073 p_inst_count out nocopy number) is
4075 l_proc varchar2(72) := 'elpecp_getcacdets';
4076 l_torrwnum pls_integer;
4077 l_insttorrw_num pls_integer;
4078 l_index pls_integer;
4079 --
4080 l_not_hash_found boolean;
4081 --
4082 begin
4083 --
4084 -- Flush the cache
4085 --
4086 if p_refresh_cache then
4087 --
4088 g_cache_elpecp_lookup.delete;
4089 g_cache_elpecp_inst.delete;
4090 --
4091 end if;
4092 --
4093 -- Populate the global cache
4094 --
4095 if g_cache_elpecp_lookup.count = 0 then
4096 --
4097 -- Build the cache
4098 --
4099 ben_elp_cache.elpecp_writecache
4100 (p_effective_date => p_effective_date,
4101 p_refresh_cache => p_refresh_cache);
4102 --
4103 end if;
4104 --
4105 -- Get the instance details
4106 --
4107 l_torrwnum := 0;
4108 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
4109 --
4110 -- Check if hashed value is already allocated
4111 --
4112 if g_cache_elpecp_lookup.exists(l_index) then
4113 --
4114 -- If it does exist make sure its the right one
4115 --
4116 if g_cache_elpecp_lookup(l_index).id <> p_eligy_prfl_id then
4117 --
4118 l_not_hash_found := false;
4119 --
4120 -- Loop until un-allocated has value is derived
4121 --
4122 while not l_not_hash_found loop
4123 --
4124 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
4125 --
4126 -- Check if the hash index exists, if not we can use it
4127 --
4128 -- Bug 13253435 when moved to next hash index checking whether that
4129 -- hash index 'id' is having value of p_eligy_prfl_id or not.
4130 -- If values are equal then existing from the loop
4131 if g_cache_elpecp_lookup(l_index).id = p_eligy_prfl_id then
4132 l_not_hash_found := true;
4133 exit;
4134 end if;
4135 -- Bug 13253435
4136
4137 if not g_cache_elpecp_lookup.exists(l_index) then
4138 --
4139 -- Lets store the hash value in the index
4140 --
4141 l_not_hash_found := true;
4142 exit;
4143 --
4144 else
4145 --
4146 l_not_hash_found := false;
4147 --
4148 end if;
4149 --
4150 end loop;
4151 --
4152 end if;
4153 --
4154 end if;
4155 --
4156 for l_insttorrw_num in g_cache_elpecp_lookup(l_index).starttorele_num ..
4157 g_cache_elpecp_lookup(l_index).endtorele_num loop
4158 --
4159 p_inst_set(l_torrwnum) := g_cache_elpecp_inst(l_insttorrw_num);
4160 l_torrwnum := l_torrwnum+1;
4161 --
4162 end loop;
4163 --
4164 p_inst_count := l_torrwnum;
4165 --
4166 exception
4167 --
4168 when no_data_found then
4169 --
4170 p_inst_count := 0;
4171 --
4172 end elpecp_getcacdets;
4173 --
4174 procedure elpewl_writecache
4175 (p_effective_date in date,
4176 p_refresh_cache in boolean default FALSE) is
4177 --
4178 l_proc varchar2(72) := 'elpewl_writecache';
4179 l_torrwnum pls_integer;
4180 l_prev_id number;
4181 l_id number;
4182 --
4183 cursor c_elpewl_look is
4184 select elp.eligy_prfl_id,
4185 elp.business_group_id
4186 from ben_eligy_prfl_f elp
4187 where p_effective_date
4188 between elp.effective_start_date
4189 and elp.effective_end_date
4190 and exists(select null
4191 from ben_elig_wk_loc_prte_f ewl
4192 where p_effective_date
4193 between ewl.effective_start_date
4194 and ewl.effective_end_date
4195 and ewl.eligy_prfl_id = elp.eligy_prfl_id)
4196 order by elp.eligy_prfl_id;
4197 --
4198 cursor c_elpewl_inst is
4199 select ewl.eligy_prfl_id,
4200 ewl.elig_wk_loc_prte_id pk_id,
4201 'EWL' short_code,
4202 ewl.location_id,
4203 ewl.excld_flag,
4204 ewl.criteria_score,
4205 ewl.criteria_weight
4206 from ben_elig_wk_loc_prte_f ewl
4207 where p_effective_date
4208 between ewl.effective_start_date
4209 and ewl.effective_end_date
4210 order by ewl.eligy_prfl_id,
4211 decode(ewl.excld_flag,'Y',1,2),
4212 ewl.ordr_num;
4213 --
4214 l_not_hash_found boolean;
4215 --
4216 begin
4217 --
4218 for objlook in c_elpewl_look loop
4219 --
4220 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
4221 --
4222 -- Check if hashed value is already allocated
4223 --
4227 --
4224 if g_cache_elpewl_lookup.exists(l_id) then
4225 --
4226 l_not_hash_found := false;
4228 -- Loop until un-allocated has value is derived
4229 --
4230 while not l_not_hash_found loop
4231 --
4232 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4233 --
4234 -- Check if the hash index exists, if not we can use it
4235 --
4236 if not g_cache_elpewl_lookup.exists(l_id) then
4237 --
4238 -- Lets store the hash value in the index
4239 --
4240 l_not_hash_found := true;
4241 exit;
4242 --
4243 else
4244 --
4245 l_not_hash_found := false;
4246 --
4247 end if;
4248 --
4249 end loop;
4250 --
4251 end if;
4252 --
4253 g_cache_elpewl_lookup(l_id).id := objlook.eligy_prfl_id;
4254 g_cache_elpewl_lookup(l_id).fk_id := objlook.business_group_id;
4255 --
4256 end loop;
4257 --
4258 l_torrwnum := 0;
4259 l_prev_id := -1;
4260 --
4261 for objinst in c_elpewl_inst loop
4262 --
4263 -- Populate the cache lookup details
4264 --
4265 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
4266 --
4267 -- Check if hashed value is already allocated
4268 --
4269 if g_cache_elpewl_lookup(l_id).id = objinst.eligy_prfl_id then
4270 --
4271 null;
4272 --
4273 else
4274 --
4275 loop
4276 --
4277 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4278 --
4279 if g_cache_elpewl_lookup(l_id).id = objinst.eligy_prfl_id then
4280 --
4281 exit;
4282 --
4283 end if;
4284 --
4285 end loop;
4286 --
4287 end if;
4288 --
4289 -- Check for first row
4290 --
4291 if l_prev_id = -1 then
4292 --
4293 g_cache_elpewl_lookup(l_id).starttorele_num := l_torrwnum;
4294 --
4295 elsif l_id <> l_prev_id then
4296 --
4297 g_cache_elpewl_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4298 g_cache_elpewl_lookup(l_id).starttorele_num := l_torrwnum;
4299 --
4300 end if;
4301 --
4302 -- Populate the cache instance details
4303 --
4304 g_cache_elpewl_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
4305 g_cache_elpewl_inst(l_torrwnum).pk_id := objinst.pk_id;
4306 g_cache_elpewl_inst(l_torrwnum).short_code := objinst.short_code;
4307 g_cache_elpewl_inst(l_torrwnum).criteria_score := objinst.criteria_score;
4308 g_cache_elpewl_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
4309 g_cache_elpewl_inst(l_torrwnum).location_id := objinst.location_id;
4310 g_cache_elpewl_inst(l_torrwnum).excld_flag := objinst.excld_flag;
4311 --
4312 l_torrwnum := l_torrwnum+1;
4313 l_prev_id := l_id;
4314 --
4315 end loop;
4316 --
4317 g_cache_elpewl_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4318 --
4319 end elpewl_writecache;
4320 --
4321 procedure elpewl_getcacdets
4322 (p_effective_date in date,
4323 p_business_group_id in number,
4324 p_eligy_prfl_id in number,
4325 p_refresh_cache in boolean default FALSE,
4326 p_inst_set out nocopy ben_elp_cache.g_cache_elpewl_instor,
4327 p_inst_count out nocopy number) is
4328 --
4329 l_proc varchar2(72) := 'elpewl_getcacdets';
4330 l_torrwnum pls_integer;
4331 l_insttorrw_num pls_integer;
4332 l_index pls_integer;
4333 --
4334 l_not_hash_found boolean;
4335 --
4336 begin
4337 --
4338 -- Flush the cache
4339 --
4340 if p_refresh_cache then
4341 --
4342 g_cache_elpewl_lookup.delete;
4343 g_cache_elpewl_inst.delete;
4344 --
4345 end if;
4346 --
4347 -- Populate the global cache
4348 --
4349 if g_cache_elpewl_lookup.count = 0 then
4350 --
4351 -- Build the cache
4352 --
4353 ben_elp_cache.elpewl_writecache
4354 (p_effective_date => p_effective_date,
4355 p_refresh_cache => p_refresh_cache);
4356 --
4357 end if;
4358 --
4359 -- Get the instance details
4360 --
4361 l_torrwnum := 0;
4362 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
4363 --
4364 -- Check if hashed value is already allocated
4365 --
4366 if g_cache_elpewl_lookup.exists(l_index) then
4367 --
4368 -- If it does exist make sure its the right one
4369 --
4370 if g_cache_elpewl_lookup(l_index).id <> p_eligy_prfl_id then
4371 --
4372 l_not_hash_found := false;
4373 --
4374 -- Loop until un-allocated has value is derived
4375 --
4376 while not l_not_hash_found loop
4377 --
4378 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
4379 --
4380 -- Check if the hash index exists, if not we can use it
4381 --
4382 -- Bug 13253435 when moved to next hash index checking whether that
4386 l_not_hash_found := true;
4383 -- hash index 'id' is having value of p_eligy_prfl_id or not.
4384 -- If values are equal then existing from the loop
4385 if g_cache_elpewl_lookup(l_index).id = p_eligy_prfl_id then
4387 exit;
4388 end if;
4389 -- Bug 13253435
4390
4391 if not g_cache_elpewl_lookup.exists(l_index) then
4392 --
4393 -- Lets store the hash value in the index
4394 --
4395 l_not_hash_found := true;
4396 exit;
4397 --
4398 else
4399 --
4400 l_not_hash_found := false;
4401 --
4402 end if;
4403 --
4404 end loop;
4405 --
4406 end if;
4407 --
4408 end if;
4409 --
4410 for l_insttorrw_num in g_cache_elpewl_lookup(l_index).starttorele_num ..
4411 g_cache_elpewl_lookup(l_index).endtorele_num loop
4412 --
4413 p_inst_set(l_torrwnum) := g_cache_elpewl_inst(l_insttorrw_num);
4414 l_torrwnum := l_torrwnum+1;
4415 --
4416 end loop;
4417 --
4418 p_inst_count := l_torrwnum;
4419 --
4420 exception
4421 --
4422 when no_data_found then
4423 --
4424 p_inst_count := 0;
4425 --
4426 end elpewl_getcacdets;
4427 --
4428 procedure elpeou_writecache
4429 (p_effective_date in date,
4430 p_refresh_cache in boolean default FALSE) is
4431 --
4432 l_proc varchar2(72) := 'elpeou_writecache';
4433 l_torrwnum pls_integer;
4434 l_prev_id number;
4435 l_id number;
4436 --
4437 cursor c_elpeou_look is
4438 select elp.eligy_prfl_id,
4439 elp.business_group_id
4440 from ben_eligy_prfl_f elp
4441 where p_effective_date
4442 between elp.effective_start_date
4443 and elp.effective_end_date
4444 and exists(select null
4445 from ben_elig_org_unit_prte_f eou
4446 where p_effective_date
4447 between eou.effective_start_date
4448 and eou.effective_end_date
4449 and eou.eligy_prfl_id = elp.eligy_prfl_id)
4450 order by elp.eligy_prfl_id;
4451 --
4452 cursor c_elpeou_inst is
4453 select eou.eligy_prfl_id,
4454 eou.elig_org_unit_prte_id pk_id,
4455 'EOU' short_code,
4456 eou.organization_id,
4457 eou.excld_flag,
4458 eou.criteria_score,
4459 eou.criteria_weight
4460 from ben_elig_org_unit_prte_f eou
4461 where p_effective_date
4462 between eou.effective_start_date
4463 and eou.effective_end_date
4464 order by eou.eligy_prfl_id,
4465 decode(eou.excld_flag,'Y',1,2),
4466 eou.ordr_num;
4467 --
4468 l_not_hash_found boolean;
4469 --
4470 begin
4471 --
4472 for objlook in c_elpeou_look loop
4473 --
4474 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
4475 --
4476 -- Check if hashed value is already allocated
4477 --
4478 if g_cache_elpeou_lookup.exists(l_id) then
4479 --
4480 l_not_hash_found := false;
4481 --
4482 -- Loop until un-allocated has value is derived
4483 --
4484 while not l_not_hash_found loop
4485 --
4486 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4487 --
4488 -- Check if the hash index exists, if not we can use it
4489 --
4490 if not g_cache_elpeou_lookup.exists(l_id) then
4491 --
4492 -- Lets store the hash value in the index
4493 --
4494 l_not_hash_found := true;
4495 exit;
4496 --
4497 else
4498 --
4499 l_not_hash_found := false;
4500 --
4501 end if;
4502 --
4503 end loop;
4504 --
4505 end if;
4506 --
4507 g_cache_elpeou_lookup(l_id).id := objlook.eligy_prfl_id;
4508 g_cache_elpeou_lookup(l_id).fk_id := objlook.business_group_id;
4509 --
4510 end loop;
4511 --
4512 l_torrwnum := 0;
4513 l_prev_id := -1;
4514 --
4515 for objinst in c_elpeou_inst loop
4516 --
4517 -- Populate the cache lookup details
4518 --
4519 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
4520 --
4521 -- Check if hashed value is already allocated
4522 --
4523 if g_cache_elpeou_lookup(l_id).id = objinst.eligy_prfl_id then
4524 --
4525 null;
4526 --
4527 else
4528 --
4529 loop
4530 --
4531 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4532 --
4533 if g_cache_elpeou_lookup(l_id).id = objinst.eligy_prfl_id then
4534 --
4535 exit;
4536 --
4537 end if;
4538 --
4539 end loop;
4540 --
4541 end if;
4542 --
4543 -- Check for first row
4544 --
4545 if l_prev_id = -1 then
4546 --
4547 g_cache_elpeou_lookup(l_id).starttorele_num := l_torrwnum;
4548 --
4549 elsif l_id <> l_prev_id then
4550 --
4551 g_cache_elpeou_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4552 g_cache_elpeou_lookup(l_id).starttorele_num := l_torrwnum;
4553 --
4554 end if;
4555 --
4556 -- Populate the cache instance details
4557 --
4558 g_cache_elpeou_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
4562 g_cache_elpeou_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
4559 g_cache_elpeou_inst(l_torrwnum).pk_id := objinst.pk_id;
4560 g_cache_elpeou_inst(l_torrwnum).short_code := objinst.short_code;
4561 g_cache_elpeou_inst(l_torrwnum).criteria_score := objinst.criteria_score;
4563 g_cache_elpeou_inst(l_torrwnum).organization_id := objinst.organization_id;
4564 g_cache_elpeou_inst(l_torrwnum).excld_flag := objinst.excld_flag;
4565 --
4566 l_torrwnum := l_torrwnum+1;
4567 l_prev_id := l_id;
4568 --
4569 end loop;
4570 --
4571 g_cache_elpeou_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4572 --
4573 end elpeou_writecache;
4574 --
4575 procedure elpeou_getcacdets
4576 (p_effective_date in date,
4577 p_business_group_id in number,
4578 p_eligy_prfl_id in number,
4579 p_refresh_cache in boolean default FALSE,
4580 p_inst_set out nocopy ben_elp_cache.g_cache_elpeou_instor,
4581 p_inst_count out nocopy number) is
4582 --
4583 l_proc varchar2(72) := 'elpeou_getcacdets';
4584 l_torrwnum pls_integer;
4585 l_insttorrw_num pls_integer;
4586 l_index pls_integer;
4587 --
4588 l_not_hash_found boolean;
4589 --
4590 begin
4591 --
4592 -- Flush the cache
4593 --
4594 if p_refresh_cache then
4595 --
4596 g_cache_elpeou_lookup.delete;
4597 g_cache_elpeou_inst.delete;
4598 --
4599 end if;
4600 --
4601 -- Populate the global cache
4602 --
4603 if g_cache_elpeou_lookup.count = 0 then
4604 --
4605 -- Build the cache
4606 --
4607 ben_elp_cache.elpeou_writecache
4608 (p_effective_date => p_effective_date,
4609 p_refresh_cache => p_refresh_cache);
4610 --
4611 end if;
4612 --
4613 -- Get the instance details
4614 --
4615 l_torrwnum := 0;
4616 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
4617 --
4618 -- Check if hashed value is already allocated
4619 --
4620 if g_cache_elpeou_lookup.exists(l_index) then
4621 --
4622 -- If it does exist make sure its the right one
4623 --
4624 if g_cache_elpeou_lookup(l_index).id <> p_eligy_prfl_id then
4625 --
4626 l_not_hash_found := false;
4627 --
4628 -- Loop until un-allocated has value is derived
4629 --
4630 while not l_not_hash_found loop
4631 --
4632 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
4633 --
4634 -- Check if the hash index exists, if not we can use it
4635 --
4636 -- Bug 13253435 when moved to next hash index checking whether that
4637 -- hash index 'id' is having value of p_eligy_prfl_id or not.
4638 -- If values are equal then existing from the loop
4639 if g_cache_elpeou_lookup(l_index).id = p_eligy_prfl_id then
4640 l_not_hash_found := true;
4641 exit;
4642 end if;
4643 -- Bug 13253435
4644
4645 if not g_cache_elpeou_lookup.exists(l_index) then
4646 --
4647 -- Lets store the hash value in the index
4648 --
4649 l_not_hash_found := true;
4650 exit;
4651 --
4652 else
4653 --
4654 l_not_hash_found := false;
4655 --
4656 end if;
4657 --
4658 end loop;
4659 --
4660 end if;
4661 --
4662 end if;
4663 --
4664 for l_insttorrw_num in g_cache_elpeou_lookup(l_index).starttorele_num ..
4665 g_cache_elpeou_lookup(l_index).endtorele_num loop
4666 --
4667 p_inst_set(l_torrwnum) := g_cache_elpeou_inst(l_insttorrw_num);
4668 l_torrwnum := l_torrwnum+1;
4669 --
4670 end loop;
4671 --
4672 p_inst_count := l_torrwnum;
4673 --
4674 exception
4675 --
4676 when no_data_found then
4677 --
4678 p_inst_count := 0;
4679 --
4680 end elpeou_getcacdets;
4681 --
4682 procedure elpehs_writecache
4683 (p_effective_date in date,
4684 p_refresh_cache in boolean default FALSE) is
4685 --
4686 l_proc varchar2(72) := 'elpehs_writecache';
4687 l_torrwnum pls_integer;
4688 l_prev_id number;
4689 l_id number;
4690 --
4691 cursor c_elpehs_look is
4692 select elp.eligy_prfl_id, elp.business_group_id
4693 from ben_eligy_prfl_f elp
4694 where p_effective_date
4695 between elp.effective_start_date
4696 and elp.effective_end_date
4697 and exists(select null
4698 from ben_elig_hrly_slrd_prte_f ehs
4699 where p_effective_date
4700 between ehs.effective_start_date
4701 and ehs.effective_end_date
4702 and ehs.eligy_prfl_id = elp.eligy_prfl_id)
4703 order by elp.eligy_prfl_id;
4704 --
4705 cursor c_elpehs_inst is
4706 select ehs.eligy_prfl_id,
4707 ehs.elig_hrly_slrd_prte_id pk_id,
4708 'EHS' short_code,
4709 ehs.hrly_slrd_cd,
4710 ehs.excld_flag,
4711 ehs.criteria_score,
4712 ehs.criteria_weight
4713 from ben_elig_hrly_slrd_prte_f ehs
4714 where p_effective_date
4715 between ehs.effective_start_date
4716 and ehs.effective_end_date
4717 order by ehs.eligy_prfl_id,
4718 decode(ehs.excld_flag,'Y',1,2),
4719 ehs.ordr_num;
4720 --
4721 l_not_hash_found boolean;
4722 --
4723 begin
4724 --
4725 for objlook in c_elpehs_look loop
4726 --
4730 --
4727 l_id := ben_hash_utility.get_hashed_index(objlook.eligy_prfl_id);
4728 --
4729 -- Check if hashed value is already allocated
4731 if g_cache_elpehs_lookup.exists(l_id) then
4732 --
4733 l_not_hash_found := false;
4734 --
4735 -- Loop until un-allocated has value is derived
4736 --
4737 while not l_not_hash_found loop
4738 --
4739 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4740 --
4741 -- Check if the hash index exists, if not we can use it
4742 --
4743 if not g_cache_elpehs_lookup.exists(l_id) then
4744 --
4745 -- Lets store the hash value in the index
4746 --
4747 l_not_hash_found := true;
4748 exit;
4749 --
4750 else
4751 --
4752 l_not_hash_found := false;
4753 --
4754 end if;
4755 --
4756 end loop;
4757 --
4758 end if;
4759 --
4760 g_cache_elpehs_lookup(l_id).id := objlook.eligy_prfl_id;
4761 g_cache_elpehs_lookup(l_id).fk_id := objlook.business_group_id;
4762 --
4763 end loop;
4764 --
4765 l_torrwnum := 0;
4766 l_prev_id := -1;
4767 --
4768 for objinst in c_elpehs_inst loop
4769 --
4770 -- Populate the cache lookup details
4771 --
4772 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
4773 --
4774 -- Check if hashed value is already allocated
4775 --
4776 if g_cache_elpehs_lookup(l_id).id = objinst.eligy_prfl_id then
4777 --
4778 null;
4779 --
4780 else
4781 --
4782 loop
4783 --
4784 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4785 --
4786 if g_cache_elpehs_lookup(l_id).id = objinst.eligy_prfl_id then
4787 --
4788 exit;
4789 --
4790 end if;
4791 --
4792 end loop;
4793 --
4794 end if;
4795 --
4796 -- Check for first row
4797 --
4798 if l_prev_id = -1 then
4799 --
4800 g_cache_elpehs_lookup(l_id).starttorele_num := l_torrwnum;
4801 --
4802 elsif l_id <> l_prev_id then
4803 --
4804 g_cache_elpehs_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4805 g_cache_elpehs_lookup(l_id).starttorele_num := l_torrwnum;
4806 --
4807 end if;
4808 --
4809 -- Populate the cache instance details
4810 --
4811 g_cache_elpehs_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
4812 g_cache_elpehs_inst(l_torrwnum).pk_id := objinst.pk_id;
4813 g_cache_elpehs_inst(l_torrwnum).short_code := objinst.short_code;
4814 g_cache_elpehs_inst(l_torrwnum).criteria_score := objinst.criteria_score;
4815 g_cache_elpehs_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
4816 g_cache_elpehs_inst(l_torrwnum).hrly_slrd_cd := objinst.hrly_slrd_cd;
4817 g_cache_elpehs_inst(l_torrwnum).excld_flag := objinst.excld_flag;
4818 --
4819 l_torrwnum := l_torrwnum+1;
4820 l_prev_id := l_id;
4821 --
4822 end loop;
4823 --
4824 g_cache_elpehs_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
4825 --
4826 end elpehs_writecache;
4827 --
4828 procedure elpehs_getcacdets
4829 (p_effective_date in date,
4830 p_business_group_id in number,
4831 p_eligy_prfl_id in number,
4832 p_refresh_cache in boolean default FALSE,
4833 p_inst_set out nocopy ben_elp_cache.g_cache_elpehs_instor,
4834 p_inst_count out nocopy number) is
4835 --
4836 l_proc varchar2(72) := 'elpehs_getcacdets';
4837 l_torrwnum pls_integer;
4838 l_insttorrw_num pls_integer;
4839 l_index pls_integer;
4840 --
4841 l_not_hash_found boolean;
4842 --
4843 begin
4844 -- hr_utility.set_location('Entering : '||l_proc,10);
4845 --
4846 -- Flush the cache
4847 --
4848 if p_refresh_cache then
4849 --
4850 g_cache_elpehs_lookup.delete;
4851 g_cache_elpehs_inst.delete;
4852 --
4853 end if;
4854 --
4855 -- Populate the global cache
4856 --
4857 if g_cache_elpehs_lookup.count = 0 then
4858 --
4859 -- Build the cache
4860 --
4861 ben_elp_cache.elpehs_writecache
4862 (p_effective_date => p_effective_date,
4863 p_refresh_cache => p_refresh_cache);
4864 --
4865 end if;
4866 -- hr_utility.set_location('Done write cache : '||l_proc,20);
4867 --
4868 -- Get the instance details
4869 --
4870 l_torrwnum := 0;
4871 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
4872 --
4873 -- Check if hashed value is already allocated
4874 --
4875 if g_cache_elpehs_lookup.exists(l_index) then
4876 --
4877 -- If it does exist make sure its the right one
4878 --
4879 if g_cache_elpehs_lookup(l_index).id <> p_eligy_prfl_id then
4880 --
4881 l_not_hash_found := false;
4882 --
4883 -- Loop until un-allocated has value is derived
4884 --
4885 -- hr_utility.set_location('Hashing '||l_proc,40);
4886 while not l_not_hash_found loop
4887 --
4888 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
4889 --
4890 -- Check if the hash index exists, if not we can use it
4891 --
4892 -- Bug 13253435 when moved to next hash index checking whether that
4893 -- hash index 'id' is having value of p_eligy_prfl_id or not.
4894 -- If values are equal then existing from the loop
4898 end if;
4895 if g_cache_elpehs_lookup(l_index).id = p_eligy_prfl_id then
4896 l_not_hash_found := true;
4897 exit;
4899 -- Bug 13253435
4900
4901 if not g_cache_elpehs_lookup.exists(l_index) then
4902 --
4903 -- Lets store the hash value in the index
4904 --
4905 l_not_hash_found := true;
4906 exit;
4907 --
4908 else
4909 --
4910 l_not_hash_found := false;
4911 --
4912 end if;
4913 --
4914 end loop;
4915 --
4916 end if;
4917 --
4918 end if;
4919 --
4920 -- hr_utility.set_location('Populate '||l_proc,80);
4921 for l_insttorrw_num in g_cache_elpehs_lookup(l_index).starttorele_num ..
4922 g_cache_elpehs_lookup(l_index).endtorele_num loop
4923 --
4924 p_inst_set(l_torrwnum) := g_cache_elpehs_inst(l_insttorrw_num);
4925 l_torrwnum := l_torrwnum+1;
4926 --
4927 end loop;
4928 --
4929 p_inst_count := l_torrwnum;
4930 --
4931 -- hr_utility.set_location('Leaving : '||l_proc,100);
4932 exception
4933 --
4934 when no_data_found then
4935 --
4936 p_inst_count := 0;
4937 --
4938 end elpehs_getcacdets;
4939 --
4940 procedure elpefp_writecache
4941 (p_effective_date in date,
4942 p_refresh_cache in boolean default FALSE) is
4943 --
4944 l_proc varchar2(72) := 'elpefp_writecache';
4945 l_torrwnum pls_integer;
4946 l_prev_id number;
4947 l_id number;
4948 --
4949 cursor c_elpefp_look is
4950 select elp.eligy_prfl_id, elp.business_group_id
4951 from ben_eligy_prfl_f elp
4952 where p_effective_date
4953 between elp.effective_start_date
4954 and elp.effective_end_date
4955 and exists(select null
4956 from ben_elig_fl_tm_pt_tm_prte_f efp
4957 where p_effective_date
4958 between efp.effective_start_date
4959 and efp.effective_end_date
4960 and efp.eligy_prfl_id = elp.eligy_prfl_id)
4961 order by elp.eligy_prfl_id;
4962 --
4963 cursor c_elpefp_inst is
4964 select efp.eligy_prfl_id,
4965 efp.elig_fl_tm_pt_tm_prte_id pk_id,
4966 'EFP' short_code,
4967 efp.fl_tm_pt_tm_cd,
4968 efp.excld_flag,
4969 efp.criteria_score,
4970 efp.criteria_weight
4971 from ben_elig_fl_tm_pt_tm_prte_f efp
4972 where p_effective_date
4973 between efp.effective_start_date
4974 and efp.effective_end_date
4975 order by efp.eligy_prfl_id,
4976 decode(efp.excld_flag,'Y',1,2),
4977 efp.ordr_num;
4978 --
4979 l_not_hash_found boolean;
4980 --
4981 begin
4982 --
4983 for objlook in c_elpefp_look loop
4984 --
4985 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
4986 --
4987 -- Check if hashed value is already allocated
4988 --
4989 if g_cache_elpefp_lookup.exists(l_id) then
4990 --
4991 l_not_hash_found := false;
4992 --
4993 -- Loop until un-allocated has value is derived
4994 --
4995 while not l_not_hash_found loop
4996 --
4997 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
4998 --
4999 -- Check if the hash index exists, if not we can use it
5000 --
5001 if not g_cache_elpefp_lookup.exists(l_id) then
5002 --
5003 -- Lets store the hash value in the index
5004 --
5005 l_not_hash_found := true;
5006 exit;
5007 --
5008 else
5009 --
5010 l_not_hash_found := false;
5011 --
5012 end if;
5013 --
5014 end loop;
5015 --
5016 end if;
5017 --
5018 g_cache_elpefp_lookup(l_id).id := objlook.eligy_prfl_id;
5019 g_cache_elpefp_lookup(l_id).fk_id := objlook.business_group_id;
5020 --
5021 end loop;
5022 --
5023 l_torrwnum := 0;
5024 l_prev_id := -1;
5025 --
5026 for objinst in c_elpefp_inst loop
5027 --
5028 -- Populate the cache lookup details
5029 --
5030 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
5031 --
5032 -- Check if hashed value is already allocated
5033 --
5034 if g_cache_elpefp_lookup(l_id).id = objinst.eligy_prfl_id then
5035 --
5036 null;
5037 --
5038 else
5039 --
5040 loop
5041 --
5042 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5043 --
5044 if g_cache_elpefp_lookup(l_id).id = objinst.eligy_prfl_id then
5045 --
5046 exit;
5047 --
5048 end if;
5049 --
5050 end loop;
5051 --
5052 end if;
5053 --
5054 -- Check for first row
5055 --
5056 if l_prev_id = -1 then
5057 --
5058 g_cache_elpefp_lookup(l_id).starttorele_num := l_torrwnum;
5059 --
5060 elsif l_id <> l_prev_id then
5061 --
5062 g_cache_elpefp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5063 g_cache_elpefp_lookup(l_id).starttorele_num := l_torrwnum;
5064 --
5065 end if;
5066 --
5067 -- Populate the cache instance details
5071 g_cache_elpefp_inst(l_torrwnum).short_code := objinst.short_code;
5068 --
5069 g_cache_elpefp_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
5070 g_cache_elpefp_inst(l_torrwnum).pk_id := objinst.pk_id;
5072 g_cache_elpefp_inst(l_torrwnum).criteria_score := objinst.criteria_score;
5073 g_cache_elpefp_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
5074 g_cache_elpefp_inst(l_torrwnum).fl_tm_pt_tm_cd := objinst.fl_tm_pt_tm_cd;
5075 g_cache_elpefp_inst(l_torrwnum).excld_flag := objinst.excld_flag;
5076 --
5077 l_torrwnum := l_torrwnum+1;
5078 l_prev_id := l_id;
5079 --
5080 end loop;
5081 --
5082 g_cache_elpefp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5083 --
5084 end elpefp_writecache;
5085 --
5086 procedure elpefp_getcacdets
5087 (p_effective_date in date,
5088 p_business_group_id in number,
5089 p_eligy_prfl_id in number,
5090 p_refresh_cache in boolean default FALSE,
5091 p_inst_set out nocopy ben_elp_cache.g_cache_elpefp_instor,
5092 p_inst_count out nocopy number) is
5093 --
5094 l_proc varchar2(72) := 'elpefp_getcacdets';
5095 l_torrwnum pls_integer;
5096 l_insttorrw_num pls_integer;
5097 l_index pls_integer;
5098 --
5099 l_not_hash_found boolean;
5100 --
5101 begin
5102 --
5103 -- Flush the cache
5104 --
5105 if p_refresh_cache then
5106 --
5107 g_cache_elpefp_lookup.delete;
5108 g_cache_elpefp_inst.delete;
5109 --
5110 end if;
5111 --
5112 -- Populate the global cache
5113 --
5114 if g_cache_elpefp_lookup.count = 0 then
5115 --
5116 -- Build the cache
5117 --
5118 ben_elp_cache.elpefp_writecache
5119 (p_effective_date => p_effective_date,
5120 p_refresh_cache => p_refresh_cache);
5121 --
5122 end if;
5123 --
5124 -- Get the instance details
5125 --
5126 l_torrwnum := 0;
5127 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
5128 --
5129 -- Check if hashed value is already allocated
5130 --
5131 if g_cache_elpefp_lookup.exists(l_index) then
5132 --
5133 -- If it does exist make sure its the right one
5134 --
5135 if g_cache_elpefp_lookup(l_index).id <> p_eligy_prfl_id then
5136 --
5137 l_not_hash_found := false;
5138 --
5139 -- Loop until un-allocated has value is derived
5140 --
5141 while not l_not_hash_found loop
5142 --
5143 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
5144 --
5145 -- Check if the hash index exists, if not we can use it
5146 --
5147 -- Bug 13253435 when moved to next hash index checking whether that
5148 -- hash index 'id' is having value of p_eligy_prfl_id or not.
5149 -- If values are equal then existing from the loop
5150 if g_cache_elpefp_lookup(l_index).id = p_eligy_prfl_id then
5151 l_not_hash_found := true;
5152 exit;
5153 end if;
5154 -- Bug 13253435
5155
5156 if not g_cache_elpefp_lookup.exists(l_index) then
5157 --
5158 -- Lets store the hash value in the index
5159 --
5160 l_not_hash_found := true;
5161 exit;
5162 --
5163 else
5164 --
5165 l_not_hash_found := false;
5166 --
5167 end if;
5168 --
5169 end loop;
5170 --
5171 end if;
5172 --
5173 end if;
5174 --
5175 for l_insttorrw_num in g_cache_elpefp_lookup(l_index).starttorele_num ..
5176 g_cache_elpefp_lookup(l_index).endtorele_num loop
5177 --
5178 p_inst_set(l_torrwnum) := g_cache_elpefp_inst(l_insttorrw_num);
5179 l_torrwnum := l_torrwnum+1;
5180 --
5181 end loop;
5182 --
5183 p_inst_count := l_torrwnum;
5184 --
5185 exception
5186 --
5187 when no_data_found then
5188 --
5189 p_inst_count := 0;
5190 --
5191 end elpefp_getcacdets;
5192 --
5193 procedure elpesh_writecache
5194 (p_effective_date in date,
5195 p_refresh_cache in boolean default FALSE) is
5196 --
5197 l_proc varchar2(72) := 'elpesh_writecache';
5198 l_torrwnum pls_integer;
5199 l_prev_id number;
5200 l_id number;
5201 --
5202 cursor c_elpesh_look is
5203 select elp.eligy_prfl_id,
5204 elp.business_group_id
5205 from ben_eligy_prfl_f elp
5206 where p_effective_date
5207 between elp.effective_start_date
5208 and elp.effective_end_date
5209 and exists(select null
5210 from ben_elig_schedd_hrs_prte_f esh
5211 where p_effective_date
5212 between esh.effective_start_date
5213 and esh.effective_end_date
5214 and esh.eligy_prfl_id = elp.eligy_prfl_id)
5215 order by elp.eligy_prfl_id;
5216 --
5217 cursor c_elpesh_inst is
5218 select esh.eligy_prfl_id,
5219 esh.elig_schedd_hrs_prte_id pk_id,
5220 'ESH' short_code,
5221 esh.hrs_num,
5222 esh.determination_cd,
5223 esh.determination_rl,
5224 esh.rounding_cd,
5225 esh.rounding_rl,
5226 esh.max_hrs_num,
5227 esh.schedd_hrs_rl,
5228 esh.freq_cd,
5229 esh.excld_flag,
5235 and esh.effective_end_date
5230 esh.criteria_score,
5231 esh.criteria_weight
5232 from ben_elig_schedd_hrs_prte_f esh
5233 where p_effective_date
5234 between esh.effective_start_date
5236 order by esh.eligy_prfl_id,
5237 decode(esh.excld_flag,'Y',1,2),
5238 esh.ordr_num;
5239 --
5240 l_not_hash_found boolean;
5241 --
5242 begin
5243 --
5244 for objlook in c_elpesh_look loop
5245 --
5246 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
5247 --
5248 -- Check if hashed value is already allocated
5249 --
5250 if g_cache_elpesh_lookup.exists(l_id) then
5251 --
5252 l_not_hash_found := false;
5253 --
5254 -- Loop until un-allocated has value is derived
5255 --
5256 while not l_not_hash_found loop
5257 --
5258 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5259 --
5260 -- Check if the hash index exists, if not we can use it
5261 --
5262 if not g_cache_elpesh_lookup.exists(l_id) then
5263 --
5264 -- Lets store the hash value in the index
5265 --
5266 l_not_hash_found := true;
5267 exit;
5268 --
5269 else
5270 --
5271 l_not_hash_found := false;
5272 --
5273 end if;
5274 --
5278 --
5275 end loop;
5276 --
5277 end if;
5279 g_cache_elpesh_lookup(l_id).id := objlook.eligy_prfl_id;
5280 g_cache_elpesh_lookup(l_id).fk_id := objlook.business_group_id;
5281 --
5282 end loop;
5283 --
5284 l_torrwnum := 0;
5285 l_prev_id := -1;
5286 --
5287 for objinst in c_elpesh_inst loop
5288 --
5289 -- Populate the cache lookup details
5290 --
5291 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
5292 --
5293 -- Check if hashed value is already allocated
5294 --
5295 if g_cache_elpesh_lookup(l_id).id = objinst.eligy_prfl_id then
5296 --
5297 null;
5298 --
5299 else
5300 --
5301 loop
5302 --
5303 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5304 --
5305 if g_cache_elpesh_lookup(l_id).id = objinst.eligy_prfl_id then
5306 --
5307 exit;
5308 --
5309 end if;
5310 --
5311 end loop;
5312 --
5313 end if;
5314 --
5315 -- Check for first row
5316 --
5317 if l_prev_id = -1 then
5318 --
5319 g_cache_elpesh_lookup(l_id).starttorele_num := l_torrwnum;
5320 --
5321 elsif l_id <> l_prev_id then
5322 --
5323 g_cache_elpesh_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5324 g_cache_elpesh_lookup(l_id).starttorele_num := l_torrwnum;
5325 --
5326 end if;
5327 --
5328 -- Populate the cache instance details
5329 --
5330 g_cache_elpesh_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
5331 g_cache_elpesh_inst(l_torrwnum).pk_id := objinst.pk_id;
5332 g_cache_elpesh_inst(l_torrwnum).short_code := objinst.short_code;
5333 g_cache_elpesh_inst(l_torrwnum).criteria_score := objinst.criteria_score;
5334 g_cache_elpesh_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
5335 g_cache_elpesh_inst(l_torrwnum).hrs_num := objinst.hrs_num;
5336 g_cache_elpesh_inst(l_torrwnum).determination_cd:= objinst.determination_cd;
5337 g_cache_elpesh_inst(l_torrwnum).determination_rl:= objinst.determination_rl;
5338 g_cache_elpesh_inst(l_torrwnum).rounding_cd:= objinst.rounding_cd;
5339 g_cache_elpesh_inst(l_torrwnum).rounding_rl:= objinst.rounding_rl;
5340 g_cache_elpesh_inst(l_torrwnum).max_hrs_num:= objinst.max_hrs_num;
5341 g_cache_elpesh_inst(l_torrwnum).schedd_hrs_rl:= objinst.schedd_hrs_rl;
5342 g_cache_elpesh_inst(l_torrwnum).freq_cd := objinst.freq_cd;
5343 g_cache_elpesh_inst(l_torrwnum).excld_flag := objinst.excld_flag;
5344 --
5345 l_torrwnum := l_torrwnum+1;
5346 l_prev_id := l_id;
5347 --
5348 end loop;
5349 --
5350 g_cache_elpesh_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5351 --
5352 end elpesh_writecache;
5353 --
5354 procedure elpesh_getcacdets
5355 (p_effective_date in date,
5356 p_business_group_id in number,
5357 p_eligy_prfl_id in number,
5358 p_refresh_cache in boolean default FALSE,
5359 p_inst_set out nocopy ben_elp_cache.g_cache_elpesh_instor,
5360 p_inst_count out nocopy number) is
5361 --
5362 l_proc varchar2(72) := 'elpesh_getcacdets';
5363 l_torrwnum pls_integer;
5364 l_insttorrw_num pls_integer;
5365 l_index pls_integer;
5366 --
5367 l_not_hash_found boolean;
5368 --
5369 begin
5370 --
5371 -- Flush the cache
5372 --
5373 if p_refresh_cache then
5374 --
5375 g_cache_elpesh_lookup.delete;
5376 g_cache_elpesh_inst.delete;
5377 --
5378 end if;
5379 --
5380 -- Populate the global cache
5381 --
5382 if g_cache_elpesh_lookup.count = 0 then
5383 --
5384 -- Build the cache
5385 --
5386 ben_elp_cache.elpesh_writecache
5387 (p_effective_date => p_effective_date,
5388 p_refresh_cache => p_refresh_cache);
5389 --
5390 end if;
5391 --
5392 -- Get the instance details
5393 --
5394 l_torrwnum := 0;
5395 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
5396 --
5397 -- Check if hashed value is already allocated
5398 --
5399 if g_cache_elpesh_lookup.exists(l_index) then
5400 --
5401 -- If it does exist make sure its the right one
5402 --
5403 if g_cache_elpesh_lookup(l_index).id <> p_eligy_prfl_id then
5404 --
5405 l_not_hash_found := false;
5406 --
5407 -- Loop until un-allocated has value is derived
5408 --
5409 while not l_not_hash_found loop
5410 --
5411 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
5412 --
5413 -- Check if the hash index exists, if not we can use it
5414 --
5415 -- Bug 13253435 when moved to next hash index checking whether that
5416 -- hash index 'id' is having value of p_eligy_prfl_id or not.
5417 -- If values are equal then existing from the loop
5418 if g_cache_elpesh_lookup(l_index).id = p_eligy_prfl_id then
5419 l_not_hash_found := true;
5420 exit;
5421 end if;
5422 -- Bug 13253435
5423
5424 if not g_cache_elpesh_lookup.exists(l_index) then
5425 --
5426 -- Lets store the hash value in the index
5427 --
5428 l_not_hash_found := true;
5429 exit;
5430 --
5431 else
5432 --
5433 l_not_hash_found := false;
5434 --
5438 --
5435 end if;
5436 --
5437 end loop;
5439 end if;
5440 --
5441 end if;
5442 --
5443 for l_insttorrw_num in g_cache_elpesh_lookup(l_index).starttorele_num ..
5444 g_cache_elpesh_lookup(l_index).endtorele_num loop
5445 --
5446 p_inst_set(l_torrwnum) := g_cache_elpesh_inst(l_insttorrw_num);
5447 l_torrwnum := l_torrwnum+1;
5448 --
5449 end loop;
5450 --
5451 p_inst_count := l_torrwnum;
5452 --
5453 exception
5454 --
5455 when no_data_found then
5456 --
5457 p_inst_count := 0;
5458 --
5459 end elpesh_getcacdets;
5460 --
5461 procedure elpehw_writecache
5462 (p_effective_date in date,
5463 p_refresh_cache in boolean default FALSE) is
5464 --
5465 l_proc varchar2(72) := 'elpehw_writecache';
5466 l_torrwnum pls_integer;
5467 l_prev_id number;
5468 l_id number;
5469 --
5470 cursor c_elpehw_look is
5471 select elp.eligy_prfl_id, elp.business_group_id
5472 from ben_eligy_prfl_f elp
5473 where p_effective_date
5474 between elp.effective_start_date
5475 and elp.effective_end_date
5476 and exists(select null
5477 from ben_elig_hrs_wkd_prte_f ecl,
5478 ben_hrs_wkd_in_perd_fctr clf
5479 where ecl.hrs_wkd_in_perd_fctr_id =
5480 clf.hrs_wkd_in_perd_fctr_id
5481 and ecl.business_group_id = clf.business_group_id
5482 and p_effective_date
5483 between ecl.effective_start_date
5484 and ecl.effective_end_date
5485 and ecl.eligy_prfl_id = elp.eligy_prfl_id)
5486 order by elp.eligy_prfl_id;
5487 --
5488 cursor c_elpehw_inst is
5489 select ecl.eligy_prfl_id,
5490 ecl.elig_hrs_wkd_prte_id pk_id,
5491 'EHW' short_code,
5492 ecl.hrs_wkd_in_perd_fctr_id,
5493 ecl.excld_flag,
5494 ecl.criteria_score,
5495 ecl.criteria_weight,
5496 clf.mn_hrs_num,
5497 clf.mx_hrs_num,
5498 clf.no_mn_hrs_wkd_flag,
5499 clf.no_mx_hrs_wkd_flag,
5500 clf.hrs_src_cd
5501 from ben_elig_hrs_wkd_prte_f ecl,
5502 ben_hrs_wkd_in_perd_fctr clf
5503 where ecl.hrs_wkd_in_perd_fctr_id = clf.hrs_wkd_in_perd_fctr_id
5504 and ecl.business_group_id = clf.business_group_id
5505 and p_effective_date
5506 between ecl.effective_start_date
5507 and ecl.effective_end_date
5508 order by ecl.eligy_prfl_id,
5509 decode(ecl.excld_flag,'Y',1,2),
5510 ecl.ordr_num;
5511 --
5512 l_not_hash_found boolean;
5513 --
5514 begin
5515 --
5516 for objlook in c_elpehw_look loop
5517 --
5518 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
5519 --
5520 -- Check if hashed value is already allocated
5521 --
5522 if g_cache_elpehw_lookup.exists(l_id) then
5523 --
5524 l_not_hash_found := false;
5525 --
5526 -- Loop until un-allocated has value is derived
5527 --
5528 while not l_not_hash_found loop
5529 --
5530 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5531 --
5532 -- Check if the hash index exists, if not we can use it
5533 --
5534 if not g_cache_elpehw_lookup.exists(l_id) then
5535 --
5536 -- Lets store the hash value in the index
5537 --
5538 l_not_hash_found := true;
5539 exit;
5540 --
5541 else
5542 --
5543 l_not_hash_found := false;
5544 --
5545 end if;
5546 --
5547 end loop;
5548 --
5549 end if;
5550 --
5551 g_cache_elpehw_lookup(l_id).id := objlook.eligy_prfl_id;
5552 g_cache_elpehw_lookup(l_id).fk_id := objlook.business_group_id;
5553 --
5554 end loop;
5555 --
5556 l_torrwnum := 0;
5557 l_prev_id := -1;
5558 --
5559 for objinst in c_elpehw_inst loop
5560 --
5561 -- Populate the cache lookup details
5562 --
5563 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
5564 --
5565 -- Check if hashed value is already allocated
5566 --
5567 if g_cache_elpehw_lookup(l_id).id = objinst.eligy_prfl_id then
5568 --
5569 null;
5570 --
5571 else
5572 --
5573 loop
5574 --
5575 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5576 --
5577 if g_cache_elpehw_lookup(l_id).id = objinst.eligy_prfl_id then
5578 --
5579 exit;
5580 --
5581 end if;
5582 --
5583 end loop;
5584 --
5585 end if;
5586 --
5587 -- Check for first row
5588 --
5589 if l_prev_id = -1 then
5590 --
5591 g_cache_elpehw_lookup(l_id).starttorele_num := l_torrwnum;
5592 --
5593 elsif l_id <> l_prev_id then
5594 --
5595 g_cache_elpehw_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5596 g_cache_elpehw_lookup(l_id).starttorele_num := l_torrwnum;
5597 --
5598 end if;
5599 --
5600 -- Populate the cache instance details
5601 --
5605 g_cache_elpehw_inst(l_torrwnum).criteria_score := objinst.criteria_score;
5602 g_cache_elpehw_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
5603 g_cache_elpehw_inst(l_torrwnum).pk_id := objinst.pk_id;
5604 g_cache_elpehw_inst(l_torrwnum).short_code := objinst.short_code;
5606 g_cache_elpehw_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
5607 g_cache_elpehw_inst(l_torrwnum).excld_flag := objinst.excld_flag;
5608 g_cache_elpehw_inst(l_torrwnum).mn_hrs_num := objinst.mn_hrs_num;
5609 g_cache_elpehw_inst(l_torrwnum).mx_hrs_num := objinst.mx_hrs_num;
5610 g_cache_elpehw_inst(l_torrwnum).no_mn_hrs_wkd_flag := objinst.no_mn_hrs_wkd_flag;
5611 g_cache_elpehw_inst(l_torrwnum).no_mx_hrs_wkd_flag := objinst.no_mx_hrs_wkd_flag;
5612 g_cache_elpehw_inst(l_torrwnum).hrs_src_cd := objinst.hrs_src_cd;
5613 --
5614 l_torrwnum := l_torrwnum+1;
5615 l_prev_id := l_id;
5616 --
5617 end loop;
5618 --
5619 g_cache_elpehw_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5620 --
5621 end elpehw_writecache;
5622 --
5623 procedure elpehw_getcacdets
5624 (p_effective_date in date,
5625 p_business_group_id in number,
5626 p_eligy_prfl_id in number,
5627 p_hrs_src_cd in varchar2 default null,
5628 p_refresh_cache in boolean default FALSE,
5629 p_inst_set out nocopy ben_elp_cache.g_cache_elpehw_instor,
5630 p_inst_count out nocopy number) is
5631 --
5632 l_proc varchar2(72) := 'elpehw_getcacdets';
5633 l_torrwnum pls_integer;
5634 l_insttorrw_num pls_integer;
5635 l_index pls_integer;
5636 --
5637 l_not_hash_found boolean;
5638 --
5639 begin
5640 --
5641 -- Flush the cache
5642 --
5643 if p_refresh_cache then
5644 --
5645 g_cache_elpehw_lookup.delete;
5646 g_cache_elpehw_inst.delete;
5647 --
5648 end if;
5649 --
5650 -- Populate the global cache
5651 --
5652 if g_cache_elpehw_lookup.count = 0 then
5653 --
5654 -- Build the cache
5655 --
5656 ben_elp_cache.elpehw_writecache
5657 (p_effective_date => p_effective_date,
5658 p_refresh_cache => p_refresh_cache);
5659 --
5660 end if;
5661 --
5662 -- Get the instance details
5663 --
5664 l_torrwnum := 0;
5665 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
5666 --
5667 -- Check if hashed value is already allocated
5668 --
5669 if g_cache_elpehw_lookup.exists(l_index) then
5670 --
5671 -- If it does exist make sure its the right one
5672 --
5673 if g_cache_elpehw_lookup(l_index).id <> p_eligy_prfl_id then
5674 --
5675 l_not_hash_found := false;
5676 --
5677 -- Loop until un-allocated has value is derived
5678 --
5679 while not l_not_hash_found loop
5680 --
5681 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
5682 --
5683 -- Check if the hash index exists, if not we can use it
5684 --
5685 -- Bug 13253435 when moved to next hash index checking whether that
5686 -- hash index 'id' is having value of p_eligy_prfl_id or not.
5687 -- If values are equal then existing from the loop
5688 if g_cache_elpehw_lookup(l_index).id = p_eligy_prfl_id then
5689 l_not_hash_found := true;
5690 exit;
5691 end if;
5692 -- Bug 13253435
5693
5694 if not g_cache_elpehw_lookup.exists(l_index) then
5695 --
5696 -- Lets store the hash value in the index
5697 --
5698 l_not_hash_found := true;
5699 exit;
5700 --
5701 else
5702 --
5703 l_not_hash_found := false;
5704 --
5705 end if;
5706 --
5707 end loop;
5708 --
5709 end if;
5710 --
5711 end if;
5712 --
5713 for l_insttorrw_num in g_cache_elpehw_lookup(l_index).starttorele_num ..
5714 g_cache_elpehw_lookup(l_index).endtorele_num loop
5715 --
5716 if nvl(g_cache_elpehw_inst(l_insttorrw_num).hrs_src_cd,'ZZZZZ') = nvl(p_hrs_src_cd,'XXXXX') then
5717 --
5718 p_inst_set(l_torrwnum) := g_cache_elpehw_inst(l_insttorrw_num);
5719 l_torrwnum := l_torrwnum+1;
5720 --
5721 end if;
5722 --
5723 end loop;
5724 --
5725 p_inst_count := l_torrwnum;
5726 --
5727 exception
5728 --
5729 when no_data_found then
5730 --
5731 p_inst_count := 0;
5732 --
5733 end elpehw_getcacdets;
5734 --
5735 procedure elpecl_writecache
5736 (p_effective_date in date,
5737 p_refresh_cache in boolean default FALSE) is
5738 --
5739 l_proc varchar2(72) := 'elpecl_writecache';
5740 l_torrwnum pls_integer;
5741 l_prev_id number;
5742 l_id number;
5743 --
5744 cursor c_elpecl_look is
5745 select elp.eligy_prfl_id, elp.business_group_id
5746 from ben_eligy_prfl_f elp
5747 where p_effective_date
5748 between elp.effective_start_date
5749 and elp.effective_end_date
5750 and exists(select null
5751 from ben_elig_comp_lvl_prte_f ecl,
5752 ben_comp_lvl_fctr clf
5753 where ecl.comp_lvl_fctr_id = clf.comp_lvl_fctr_id
5754 and ecl.business_group_id = clf.business_group_id
5755 and p_effective_date
5756 between ecl.effective_start_date
5757 and ecl.effective_end_date
5758 and ecl.eligy_prfl_id = elp.eligy_prfl_id)
5759 order by elp.eligy_prfl_id;
5760 --
5764 'ECL' short_code,
5761 cursor c_elpecl_inst is
5762 select ecl.eligy_prfl_id,
5763 ecl.elig_comp_lvl_prte_id pk_id,
5765 ecl.excld_flag,
5766 ecl.criteria_score,
5767 ecl.criteria_weight,
5768 clf.mn_comp_val,
5769 clf.mx_comp_val,
5770 clf.no_mn_comp_flag,
5771 clf.no_mx_comp_flag,
5772 clf.comp_src_cd,
5773 clf.comp_lvl_fctr_id
5774 from ben_elig_comp_lvl_prte_f ecl,
5775 ben_comp_lvl_fctr clf
5776 where ecl.comp_lvl_fctr_id = clf.comp_lvl_fctr_id
5777 and ecl.business_group_id = clf.business_group_id
5778 and p_effective_date
5779 between ecl.effective_start_date
5780 and ecl.effective_end_date
5781 order by ecl.eligy_prfl_id,
5782 decode(ecl.excld_flag,'Y',1,2),
5783 ecl.ordr_num;
5784 --
5785 l_not_hash_found boolean;
5786 --
5787 begin
5788 --
5789 for objlook in c_elpecl_look loop
5790 --
5791 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
5792 --
5793 -- Check if hashed value is already allocated
5794 --
5795 if g_cache_elpecl_lookup.exists(l_id) then
5796 --
5797 l_not_hash_found := false;
5798 --
5799 -- Loop until un-allocated has value is derived
5800 --
5801 while not l_not_hash_found loop
5802 --
5803 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5804 --
5805 -- Check if the hash index exists, if not we can use it
5806 --
5807 if not g_cache_elpecl_lookup.exists(l_id) then
5808 --
5809 -- Lets store the hash value in the index
5810 --
5811 l_not_hash_found := true;
5812 exit;
5813 --
5814 else
5815 --
5816 l_not_hash_found := false;
5817 --
5818 end if;
5819 --
5820 end loop;
5821 --
5822 end if;
5823 --
5824 g_cache_elpecl_lookup(l_id).id := objlook.eligy_prfl_id;
5825 g_cache_elpecl_lookup(l_id).fk_id := objlook.business_group_id;
5826 --
5827 end loop;
5828 --
5829 l_torrwnum := 0;
5830 l_prev_id := -1;
5831 --
5832 for objinst in c_elpecl_inst loop
5833 --
5834 -- Populate the cache lookup details
5835 --
5836 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
5837 --
5838 -- Check if hashed value is already allocated
5839 --
5840 if g_cache_elpecl_lookup(l_id).id = objinst.eligy_prfl_id then
5841 --
5842 null;
5843 --
5844 else
5845 --
5846 loop
5847 --
5848 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
5849 --
5850 if g_cache_elpecl_lookup(l_id).id = objinst.eligy_prfl_id then
5851 --
5852 exit;
5853 --
5854 end if;
5855 --
5856 end loop;
5857 --
5858 end if;
5859 --
5860 -- Check for first row
5861 --
5862 if l_prev_id = -1 then
5863 --
5864 g_cache_elpecl_lookup(l_id).starttorele_num := l_torrwnum;
5865 --
5866 elsif l_id <> l_prev_id then
5867 --
5868 g_cache_elpecl_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5869 g_cache_elpecl_lookup(l_id).starttorele_num := l_torrwnum;
5870 --
5871 end if;
5872 --
5873 -- Populate the cache instance details
5874 --
5875 g_cache_elpecl_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
5876 g_cache_elpecl_inst(l_torrwnum).pk_id := objinst.pk_id;
5877 g_cache_elpecl_inst(l_torrwnum).short_code := objinst.short_code;
5878 g_cache_elpecl_inst(l_torrwnum).criteria_score := objinst.criteria_score;
5879 g_cache_elpecl_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
5880 g_cache_elpecl_inst(l_torrwnum).excld_flag := objinst.excld_flag;
5881 g_cache_elpecl_inst(l_torrwnum).mn_comp_val := objinst.mn_comp_val;
5882 g_cache_elpecl_inst(l_torrwnum).mx_comp_val := objinst.mx_comp_val;
5883 g_cache_elpecl_inst(l_torrwnum).no_mn_comp_flag := objinst.no_mn_comp_flag;
5884 g_cache_elpecl_inst(l_torrwnum).no_mx_comp_flag := objinst.no_mx_comp_flag;
5885 g_cache_elpecl_inst(l_torrwnum).comp_src_cd := objinst.comp_src_cd;
5886 g_cache_elpecl_inst(l_torrwnum).comp_lvl_fctr_id := objinst.comp_lvl_fctr_id;
5887 --
5888 l_torrwnum := l_torrwnum+1;
5889 l_prev_id := l_id;
5890 --
5891 end loop;
5892 --
5893 g_cache_elpecl_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
5894 --
5895 end elpecl_writecache;
5896 --
5897 procedure elpecl_getcacdets
5898 (p_effective_date in date,
5899 p_business_group_id in number,
5900 p_eligy_prfl_id in number,
5901 p_comp_src_cd in varchar2 default null,
5902 p_refresh_cache in boolean default FALSE,
5903 p_inst_set out nocopy ben_elp_cache.g_cache_elpecl_instor,
5904 p_inst_count out nocopy number) is
5905 --
5906 l_proc varchar2(72) := 'elpecl_getcacdets';
5907 l_torrwnum pls_integer;
5908 l_insttorrw_num pls_integer;
5909 l_index pls_integer;
5910 --
5911 l_not_hash_found boolean;
5912 --
5913 begin
5914 --
5915 -- Flush the cache
5916 --
5917 if p_refresh_cache then
5918 --
5919 g_cache_elpecl_lookup.delete;
5920 g_cache_elpecl_inst.delete;
5921 --
5922 end if;
5923 --
5924 -- Populate the global cache
5925 --
5929 --
5926 if g_cache_elpecl_lookup.count = 0 then
5927 --
5928 -- Build the cache
5930 ben_elp_cache.elpecl_writecache
5931 (p_effective_date => p_effective_date,
5932 p_refresh_cache => p_refresh_cache);
5933 --
5934 end if;
5935 --
5936 -- Get the instance details
5937 --
5938 l_torrwnum := 0;
5939 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
5940 --
5941 -- Check if hashed value is already allocated
5942 --
5943 if g_cache_elpecl_lookup.exists(l_index) then
5944 --
5945 -- If it does exist make sure its the right one
5946 --
5947 if g_cache_elpecl_lookup(l_index).id <> p_eligy_prfl_id then
5948 --
5949 l_not_hash_found := false;
5950 --
5951 -- Loop until un-allocated has value is derived
5952 --
5953 while not l_not_hash_found loop
5954 --
5955 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
5956 --
5957 -- Check if the hash index exists, if not we can use it
5958 --
5959 -- Bug 13253435 when moved to next hash index checking whether that
5960 -- hash index 'id' is having value of p_eligy_prfl_id or not.
5961 -- If values are equal then existing from the loop
5962 if g_cache_elpecl_lookup(l_index).id = p_eligy_prfl_id then
5963 l_not_hash_found := true;
5964 exit;
5965 end if;
5966 -- Bug 13253435
5967
5968 if not g_cache_elpecl_lookup.exists(l_index) then
5969 --
5970 -- Lets store the hash value in the index
5971 --
5972 l_not_hash_found := true;
5973 exit;
5974 --
5975 else
5976 --
5977 l_not_hash_found := false;
5978 --
5979 end if;
5980 --
5981 end loop;
5982 --
5983 end if;
5984 --
5985 end if;
5986 --
5987 for l_insttorrw_num in g_cache_elpecl_lookup(l_index).starttorele_num ..
5988 g_cache_elpecl_lookup(l_index).endtorele_num loop
5989 --
5990 if nvl(g_cache_elpecl_inst(l_insttorrw_num).comp_src_cd,'ZZZZZ') = nvl(p_comp_src_cd,'XXXXX') then
5991 --
5992 p_inst_set(l_torrwnum) := g_cache_elpecl_inst(l_insttorrw_num);
5993 l_torrwnum := l_torrwnum+1;
5994 --
5995 end if;
5996 --
5997 end loop;
5998 --
5999 p_inst_count := l_torrwnum;
6000 --
6001 exception
6002 --
6003 when no_data_found then
6004 --
6005 p_inst_count := 0;
6006 --
6007 end elpecl_getcacdets;
6008 --
6009 procedure elpepf_writecache
6010 (p_effective_date in date,
6011 p_refresh_cache in boolean default FALSE) is
6012 --
6013 l_proc varchar2(72) := 'elpepf_writecache';
6014 l_torrwnum pls_integer;
6015 l_prev_id number;
6016 l_id number;
6017 --
6018 cursor c_elpepf_look is
6019 select epl.eligy_prfl_id,
6020 epl.business_group_id
6021 from ben_eligy_prfl_f epl
6022 where p_effective_date
6023 between epl.effective_start_date
6024 and epl.effective_end_date
6025 and exists(select null
6026 from ben_elig_pct_fl_tm_prte_f epf,
6027 ben_pct_fl_tm_fctr pff
6028 where epf.pct_fl_tm_fctr_id = pff.pct_fl_tm_fctr_id
6029 and epf.business_group_id = pff.business_group_id
6030 and p_effective_date
6031 between epf.effective_start_date
6032 and epf.effective_end_date
6033 and epf.eligy_prfl_id = epl.eligy_prfl_id)
6034 order by epl.eligy_prfl_id;
6035 --
6036 cursor c_elpepf_inst is
6037 select epf.eligy_prfl_id,
6038 epf.elig_pct_fl_tm_prte_id pk_id,
6039 'EPF' short_code,
6040 epf.pct_fl_tm_fctr_id,
6041 epf.excld_flag,
6042 epf.criteria_score,
6043 epf.criteria_weight,
6044 pff.mx_pct_val,
6045 pff.mn_pct_val,
6046 pff.no_mn_pct_val_flag,
6047 pff.no_mx_pct_val_flag
6048 from ben_elig_pct_fl_tm_prte_f epf,
6049 ben_pct_fl_tm_fctr pff
6050 where epf.pct_fl_tm_fctr_id = pff.pct_fl_tm_fctr_id
6051 and epf.business_group_id = pff.business_group_id
6052 and p_effective_date
6053 between epf.effective_start_date
6054 and epf.effective_end_date
6055 order by epf.eligy_prfl_id,
6056 decode(epf.excld_flag,'Y',1,2),
6057 epf.ordr_num;
6058 --
6059 l_not_hash_found boolean;
6060 --
6061 begin
6062 --
6063 for objlook in c_elpepf_look loop
6064 --
6065 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
6066 --
6067 -- Check if hashed value is already allocated
6068 --
6069 if g_cache_elpepf_lookup.exists(l_id) then
6070 --
6071 l_not_hash_found := false;
6072 --
6073 -- Loop until un-allocated has value is derived
6074 --
6075 while not l_not_hash_found loop
6076 --
6077 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6078 --
6079 -- Check if the hash index exists, if not we can use it
6080 --
6081 if not g_cache_elpepf_lookup.exists(l_id) then
6082 --
6083 -- Lets store the hash value in the index
6084 --
6085 l_not_hash_found := true;
6086 exit;
6087 --
6088 else
6089 --
6093 --
6090 l_not_hash_found := false;
6091 --
6092 end if;
6094 end loop;
6095 --
6096 end if;
6097 --
6098 g_cache_elpepf_lookup(l_id).id := objlook.eligy_prfl_id;
6099 g_cache_elpepf_lookup(l_id).fk_id := objlook.business_group_id;
6100 --
6101 end loop;
6102 --
6103 l_torrwnum := 0;
6104 l_prev_id := -1;
6105 --
6106 for objinst in c_elpepf_inst loop
6107 --
6108 -- Populate the cache lookup details
6109 --
6110 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
6111 --
6112 -- Check if hashed value is already allocated
6113 --
6114 if g_cache_elpepf_lookup(l_id).id = objinst.eligy_prfl_id then
6115 --
6116 null;
6117 --
6118 else
6119 --
6120 loop
6121 --
6122 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6123 --
6124 if g_cache_elpepf_lookup(l_id).id = objinst.eligy_prfl_id then
6125 --
6126 exit;
6127 --
6128 end if;
6129 --
6130 end loop;
6131 --
6132 end if;
6133 --
6134 -- Check for first row
6135 --
6136 if l_prev_id = -1 then
6137 --
6138 g_cache_elpepf_lookup(l_id).starttorele_num := l_torrwnum;
6139 --
6140 elsif l_id <> l_prev_id then
6141 --
6142 g_cache_elpepf_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6143 g_cache_elpepf_lookup(l_id).starttorele_num := l_torrwnum;
6144 --
6145 end if;
6146 --
6147 -- Populate the cache instance details
6148 --
6149 g_cache_elpepf_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
6150 g_cache_elpepf_inst(l_torrwnum).pk_id := objinst.pk_id;
6151 g_cache_elpepf_inst(l_torrwnum).short_code := objinst.short_code;
6152 g_cache_elpepf_inst(l_torrwnum).criteria_score := objinst.criteria_score;
6153 g_cache_elpepf_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
6154 g_cache_elpepf_inst(l_torrwnum).excld_flag := objinst.excld_flag;
6155 g_cache_elpepf_inst(l_torrwnum).mx_pct_val := objinst.mx_pct_val;
6156 g_cache_elpepf_inst(l_torrwnum).mn_pct_val := objinst.mn_pct_val;
6157 g_cache_elpepf_inst(l_torrwnum).no_mn_pct_val_flag := objinst.no_mn_pct_val_flag;
6158 g_cache_elpepf_inst(l_torrwnum).no_mx_pct_val_flag := objinst.no_mx_pct_val_flag;
6159 --
6160 l_torrwnum := l_torrwnum+1;
6161 l_prev_id := l_id;
6162 --
6163 end loop;
6164 --
6165 g_cache_elpepf_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6166 --
6167 end elpepf_writecache;
6168 --
6169 procedure elpepf_getcacdets
6170 (p_effective_date in date,
6171 p_business_group_id in number,
6172 p_eligy_prfl_id in number,
6173 p_refresh_cache in boolean default FALSE,
6174 p_inst_set out nocopy ben_elp_cache.g_cache_elpepf_instor,
6175 p_inst_count out nocopy number) is
6176 --
6177 l_proc varchar2(72) := 'elpepf_getcacdets';
6178 l_torrwnum pls_integer;
6179 l_insttorrw_num pls_integer;
6180 l_index pls_integer;
6181 --
6182 l_not_hash_found boolean;
6183 --
6184 begin
6185 --
6186 -- Flush the cache
6187 --
6188 if p_refresh_cache then
6189 --
6190 g_cache_elpepf_lookup.delete;
6191 g_cache_elpepf_inst.delete;
6192 --
6193 end if;
6194 --
6195 -- Populate the global cache
6196 --
6197 if g_cache_elpepf_lookup.count = 0 then
6198 --
6199 -- Build the cache
6200 --
6201 ben_elp_cache.elpepf_writecache
6202 (p_effective_date => p_effective_date,
6203 p_refresh_cache => p_refresh_cache);
6204 --
6205 end if;
6206 --
6207 -- Get the instance details
6208 --
6209 l_torrwnum := 0;
6210 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
6211 --
6212 -- Check if hashed value is already allocated
6213 --
6214 if g_cache_elpepf_lookup.exists(l_index) then
6215 --
6216 -- If it does exist make sure its the right one
6217 --
6218 if g_cache_elpepf_lookup(l_index).id <> p_eligy_prfl_id then
6219 --
6220 l_not_hash_found := false;
6221 --
6222 -- Loop until un-allocated has value is derived
6223 --
6224 while not l_not_hash_found loop
6225 --
6226 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
6227 --
6228 -- Check if the hash index exists, if not we can use it
6229 --
6230 -- Bug 13253435 when moved to next hash index checking whether that
6231 -- hash index 'id' is having value of p_eligy_prfl_id or not.
6232 -- If values are equal then existing from the loop
6233 if g_cache_elpepf_lookup(l_index).id = p_eligy_prfl_id then
6234 l_not_hash_found := true;
6235 exit;
6236 end if;
6237 -- Bug 13253435
6238
6239 if not g_cache_elpepf_lookup.exists(l_index) then
6240 --
6241 -- Lets store the hash value in the index
6242 --
6243 l_not_hash_found := true;
6244 exit;
6245 --
6246 else
6247 --
6248 l_not_hash_found := false;
6249 --
6250 end if;
6251 --
6252 end loop;
6253 --
6254 end if;
6255 --
6256 end if;
6257 --
6258 for l_insttorrw_num in g_cache_elpepf_lookup(l_index).starttorele_num ..
6259 g_cache_elpepf_lookup(l_index).endtorele_num loop
6263 --
6260 --
6261 p_inst_set(l_torrwnum) := g_cache_elpepf_inst(l_insttorrw_num);
6262 l_torrwnum := l_torrwnum+1;
6264 end loop;
6265 --
6266 p_inst_count := l_torrwnum;
6267 --
6268 exception
6269 --
6270 when no_data_found then
6271 --
6272 p_inst_count := 0;
6273 --
6274 end elpepf_getcacdets;
6275 --
6276 procedure elpegr_writecache
6277 (p_effective_date in date,
6278 p_refresh_cache in boolean default FALSE) is
6279 --
6280 l_proc varchar2(72) := 'elpegr_writecache';
6281 l_torrwnum pls_integer;
6282 l_prev_id number;
6283 l_id number;
6284 --
6285 cursor c_elpegr_look is
6286 select elp.eligy_prfl_id,
6287 elp.business_group_id
6288 from ben_eligy_prfl_f elp
6289 where p_effective_date
6290 between elp.effective_start_date
6291 and elp.effective_end_date
6292 and exists(select null
6293 from ben_elig_grd_prte_f egr
6294 where p_effective_date
6295 between egr.effective_start_date
6296 and egr.effective_end_date
6297 and egr.eligy_prfl_id = elp.eligy_prfl_id)
6298 order by elp.eligy_prfl_id;
6299 --
6300 cursor c_elpegr_inst is
6301 select egr.eligy_prfl_id,
6302 egr.elig_grd_prte_id pk_id,
6303 'EGR' short_code,
6304 egr.grade_id,
6305 egr.excld_flag,
6306 egr.criteria_score,
6307 egr.criteria_weight
6308 from ben_elig_grd_prte_f egr
6309 where p_effective_date
6310 between egr.effective_start_date
6311 and egr.effective_end_date
6312 order by egr.eligy_prfl_id,
6313 decode(egr.excld_flag,'Y',1,2),
6314 egr.ordr_num;
6315 --
6316 l_not_hash_found boolean;
6317 --
6318 begin
6319 --
6320 for objlook in c_elpegr_look loop
6321 --
6322 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
6323 --
6324 -- Check if hashed value is already allocated
6325 --
6326 if g_cache_elpegr_lookup.exists(l_id) then
6327 --
6328 l_not_hash_found := false;
6329 --
6330 -- Loop until un-allocated has value is derived
6331 --
6332 while not l_not_hash_found loop
6333 --
6334 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6335 --
6336 -- Check if the hash index exists, if not we can use it
6337 --
6338 if not g_cache_elpegr_lookup.exists(l_id) then
6339 --
6340 -- Lets store the hash value in the index
6341 --
6342 l_not_hash_found := true;
6343 exit;
6344 --
6345 else
6346 --
6347 l_not_hash_found := false;
6348 --
6349 end if;
6350 --
6351 end loop;
6352 --
6353 end if;
6354 --
6355 g_cache_elpegr_lookup(l_id).id := objlook.eligy_prfl_id;
6356 g_cache_elpegr_lookup(l_id).fk_id := objlook.business_group_id;
6357 --
6358 end loop;
6359 --
6360 l_torrwnum := 0;
6361 l_prev_id := -1;
6362 --
6363 for objinst in c_elpegr_inst loop
6364 --
6365 -- Populate the cache lookup details
6366 --
6367 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
6368 --
6369 -- Check if hashed value is already allocated
6370 --
6371 if g_cache_elpegr_lookup(l_id).id = objinst.eligy_prfl_id then
6372 --
6373 null;
6374 --
6375 else
6376 --
6377 loop
6378 --
6379 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6380 --
6381 if g_cache_elpegr_lookup(l_id).id = objinst.eligy_prfl_id then
6382 --
6383 exit;
6384 --
6385 end if;
6386 --
6387 end loop;
6388 --
6389 end if;
6390 --
6391 -- Check for first row
6392 --
6393 if l_prev_id = -1 then
6394 --
6395 g_cache_elpegr_lookup(l_id).starttorele_num := l_torrwnum;
6396 --
6397 elsif l_id <> l_prev_id then
6398 --
6399 g_cache_elpegr_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6400 g_cache_elpegr_lookup(l_id).starttorele_num := l_torrwnum;
6401 --
6402 end if;
6403 --
6404 -- Populate the cache instance details
6405 --
6406 g_cache_elpegr_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
6407 g_cache_elpegr_inst(l_torrwnum).pk_id := objinst.pk_id;
6408 g_cache_elpegr_inst(l_torrwnum).short_code := objinst.short_code;
6409 g_cache_elpegr_inst(l_torrwnum).criteria_score := objinst.criteria_score;
6410 g_cache_elpegr_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
6411 g_cache_elpegr_inst(l_torrwnum).grade_id := objinst.grade_id;
6412 g_cache_elpegr_inst(l_torrwnum).excld_flag := objinst.excld_flag;
6413 --
6414 l_torrwnum := l_torrwnum+1;
6415 l_prev_id := l_id;
6416 --
6417 end loop;
6418 --
6419 g_cache_elpegr_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6420 --
6421 end elpegr_writecache;
6422 --
6423 procedure elpegr_getcacdets
6424 (p_effective_date in date,
6425 p_business_group_id in number,
6426 p_eligy_prfl_id in number,
6430 --
6427 p_refresh_cache in boolean default FALSE,
6428 p_inst_set out nocopy ben_elp_cache.g_cache_elpegr_instor,
6429 p_inst_count out nocopy number) is
6431 l_proc varchar2(72) := 'elpegr_getcacdets';
6432 l_torrwnum pls_integer;
6433 l_insttorrw_num pls_integer;
6434 l_index pls_integer;
6435 --
6436 l_not_hash_found boolean;
6437 --
6438 begin
6439 --
6440 -- Flush the cache
6441 --
6442 if p_refresh_cache then
6443 --
6444 g_cache_elpegr_lookup.delete;
6445 g_cache_elpegr_inst.delete;
6446 --
6447 end if;
6448 --
6449 -- Populate the global cache
6450 --
6451 if g_cache_elpegr_lookup.count = 0 then
6452 --
6453 -- Build the cache
6454 --
6455 ben_elp_cache.elpegr_writecache
6456 (p_effective_date => p_effective_date,
6457 p_refresh_cache => p_refresh_cache);
6458 --
6459 end if;
6460 --
6461 -- Get the instance details
6462 --
6463 l_torrwnum := 0;
6464 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
6465 --
6466 -- Check if hashed value is already allocated
6467 --
6468 if g_cache_elpegr_lookup.exists(l_index) then
6469 --
6470 -- If it does exist make sure its the right one
6471 --
6472 if g_cache_elpegr_lookup(l_index).id <> p_eligy_prfl_id then
6473 --
6474 l_not_hash_found := false;
6475 --
6476 -- Loop until un-allocated has value is derived
6477 --
6478 while not l_not_hash_found loop
6479 --
6480 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
6481 --
6482 -- Check if the hash index exists, if not we can use it
6483 --
6484 -- Bug 13253435 when moved to next hash index checking whether that
6485 -- hash index 'id' is having value of p_eligy_prfl_id or not.
6486 -- If values are equal then existing from the loop
6487 if g_cache_elpegr_lookup(l_index).id = p_eligy_prfl_id then
6488 l_not_hash_found := true;
6489 exit;
6490 end if;
6491 -- Bug 13253435
6492
6493 if not g_cache_elpegr_lookup.exists(l_index) then
6494 --
6495 -- Lets store the hash value in the index
6496 --
6497 l_not_hash_found := true;
6498 exit;
6499 --
6500 else
6501 --
6502 l_not_hash_found := false;
6503 --
6504 end if;
6505 --
6506 end loop;
6507 --
6508 end if;
6509 --
6510 end if;
6511 --
6512 for l_insttorrw_num in g_cache_elpegr_lookup(l_index).starttorele_num ..
6513 g_cache_elpegr_lookup(l_index).endtorele_num loop
6514 --
6515 p_inst_set(l_torrwnum) := g_cache_elpegr_inst(l_insttorrw_num);
6516 l_torrwnum := l_torrwnum+1;
6517 --
6518 end loop;
6519 --
6520 p_inst_count := l_torrwnum;
6521 --
6522 exception
6523 --
6524 when no_data_found then
6525 --
6526 p_inst_count := 0;
6527 --
6528 end elpegr_getcacdets;
6529 --
6530 procedure elpegn_writecache
6531 (p_effective_date in date,
6532 p_refresh_cache in boolean default FALSE) is
6533 --
6534 l_proc varchar2(72) := 'elpegn_writecache';
6535 l_torrwnum pls_integer;
6536 l_prev_id number;
6537 l_id number;
6538 --
6539 cursor c_elpegn_look is
6540 select elp.eligy_prfl_id,
6541 elp.business_group_id
6542 from ben_eligy_prfl_f elp
6543 where p_effective_date
6544 between elp.effective_start_date
6545 and elp.effective_end_date
6546 and exists(select null
6547 from ben_elig_grd_prte_f egn
6548 where p_effective_date
6549 between egn.effective_start_date
6550 and egn.effective_end_date
6551 and egn.eligy_prfl_id = elp.eligy_prfl_id)
6552 order by elp.eligy_prfl_id;
6553 --
6554 cursor c_elpegn_inst is
6555 select egn.eligy_prfl_id,
6556 egn.elig_gndr_prte_id pk_id,
6557 'EGN' short_code,
6558 egn.sex,
6559 egn.excld_flag,
6560 egn.criteria_score,
6561 egn.criteria_weight
6562 from ben_elig_gndr_prte_f egn
6563 where p_effective_date
6564 between egn.effective_start_date
6565 and egn.effective_end_date
6566 order by egn.eligy_prfl_id,
6567 decode(egn.excld_flag,'Y',1,2),
6568 egn.ordr_num;
6569 --
6570 l_not_hash_found boolean;
6571 --
6572 begin
6573 --
6574 for objlook in c_elpegn_look loop
6575 --
6576 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
6577 --
6578 -- Check if hashed value is already allocated
6579 --
6580 if g_cache_elpegn_lookup.exists(l_id) then
6581 --
6582 l_not_hash_found := false;
6583 --
6584 -- Loop until un-allocated has value is derived
6585 --
6586 while not l_not_hash_found loop
6587 --
6588 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6589 --
6590 -- Check if the hash index exists, if not we can use it
6591 --
6592 if not g_cache_elpegn_lookup.exists(l_id) then
6593 --
6597 exit;
6594 -- Lets store the hash value in the index
6595 --
6596 l_not_hash_found := true;
6598 --
6599 else
6600 --
6601 l_not_hash_found := false;
6602 --
6603 end if;
6604 --
6605 end loop;
6606 --
6607 end if;
6608 --
6609 g_cache_elpegn_lookup(l_id).id := objlook.eligy_prfl_id;
6610 g_cache_elpegn_lookup(l_id).fk_id := objlook.business_group_id;
6611 --
6612 end loop;
6613 --
6614 l_torrwnum := 0;
6615 l_prev_id := -1;
6616 --
6617 for objinst in c_elpegn_inst loop
6618 --
6619 -- Populate the cache lookup details
6620 --
6621 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
6622 --
6623 -- Check if hashed value is already allocated
6624 --
6625 if g_cache_elpegn_lookup(l_id).id = objinst.eligy_prfl_id then
6626 --
6627 null;
6628 --
6629 else
6630 --
6631 loop
6632 --
6633 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6634 --
6635 if g_cache_elpegn_lookup(l_id).id = objinst.eligy_prfl_id then
6636 --
6637 exit;
6638 --
6639 end if;
6640 --
6641 end loop;
6642 --
6643 end if;
6644 --
6645 -- Check for first row
6646 --
6647 if l_prev_id = -1 then
6648 --
6649 g_cache_elpegn_lookup(l_id).starttorele_num := l_torrwnum;
6650 --
6651 elsif l_id <> l_prev_id then
6652 --
6653 g_cache_elpegn_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6654 g_cache_elpegn_lookup(l_id).starttorele_num := l_torrwnum;
6655 --
6656 end if;
6657 --
6658 -- Populate the cache instance details
6659 --
6660 g_cache_elpegn_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
6661 g_cache_elpegn_inst(l_torrwnum).pk_id := objinst.pk_id;
6662 g_cache_elpegn_inst(l_torrwnum).short_code := objinst.short_code;
6663 g_cache_elpegn_inst(l_torrwnum).criteria_score := objinst.criteria_score;
6664 g_cache_elpegn_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
6665 g_cache_elpegn_inst(l_torrwnum).sex := objinst.sex;
6666 g_cache_elpegn_inst(l_torrwnum).excld_flag := objinst.excld_flag;
6667 --
6668 l_torrwnum := l_torrwnum+1;
6669 l_prev_id := l_id;
6670 --
6671 end loop;
6672 --
6673 g_cache_elpegn_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6674 --
6675 end elpegn_writecache;
6676 --
6677 procedure elpegn_getcacdets
6678 (p_effective_date in date,
6679 p_business_group_id in number,
6680 p_eligy_prfl_id in number,
6681 p_refresh_cache in boolean default FALSE,
6682 p_inst_set out nocopy ben_elp_cache.g_cache_elpegn_instor,
6683 p_inst_count out nocopy number) is
6684 --
6685 l_proc varchar2(72) := 'elpegn_getcacdets';
6686 l_torrwnum pls_integer;
6687 l_insttorrw_num pls_integer;
6688 l_index pls_integer;
6689 --
6690 l_not_hash_found boolean;
6691 --
6692 begin
6693 --
6694 -- Flush the cache
6695 --
6696 if p_refresh_cache then
6697 --
6698 g_cache_elpegn_lookup.delete;
6699 g_cache_elpegn_inst.delete;
6700 --
6701 end if;
6702 --
6703 -- Populate the global cache
6704 --
6705 if g_cache_elpegn_lookup.count = 0 then
6706 --
6707 -- Build the cache
6708 --
6709 ben_elp_cache.elpegn_writecache
6710 (p_effective_date => p_effective_date,
6711 p_refresh_cache => p_refresh_cache);
6712 --
6713 end if;
6714 --
6715 -- Get the instance details
6716 --
6717 l_torrwnum := 0;
6718 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
6719 --
6720 -- Check if hashed value is already allocated
6721 --
6722 if g_cache_elpegn_lookup.exists(l_index) then
6723 --
6724 -- If it does exist make sure its the right one
6725 --
6726 if g_cache_elpegn_lookup(l_index).id <> p_eligy_prfl_id then
6727 --
6728 l_not_hash_found := false;
6729 --
6730 -- Loop until un-allocated has value is derived
6731 --
6732 while not l_not_hash_found loop
6733 --
6734 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
6735 --
6736 -- Check if the hash index exists, if not we can use it
6737 --
6738 -- Bug 13253435 when moved to next hash index checking whether that
6739 -- hash index 'id' is having value of p_eligy_prfl_id or not.
6740 -- If values are equal then existing from the loop
6741 if g_cache_elpegn_lookup(l_index).id = p_eligy_prfl_id then
6742 l_not_hash_found := true;
6743 exit;
6744 end if;
6745 -- Bug 13253435
6746
6747 if not g_cache_elpegn_lookup.exists(l_index) then
6748 --
6749 -- Lets store the hash value in the index
6750 --
6751 l_not_hash_found := true;
6752 exit;
6753 --
6754 else
6755 --
6756 l_not_hash_found := false;
6757 --
6758 end if;
6759 --
6760 end loop;
6761 --
6762 end if;
6763 --
6764 end if;
6765 --
6766 for l_insttorrw_num in g_cache_elpegn_lookup(l_index).starttorele_num ..
6767 g_cache_elpegn_lookup(l_index).endtorele_num loop
6768 --
6772 end loop;
6769 p_inst_set(l_torrwnum) := g_cache_elpegn_inst(l_insttorrw_num);
6770 l_torrwnum := l_torrwnum+1;
6771 --
6773 --
6774 p_inst_count := l_torrwnum;
6775 --
6776 exception
6777 --
6778 when no_data_found then
6779 --
6780 p_inst_count := 0;
6781 --
6782 end elpegn_getcacdets;
6783 --
6784 procedure elpejp_writecache
6785 (p_effective_date in date,
6786 p_refresh_cache in boolean default FALSE) is
6787 --
6788 l_proc varchar2(72) := 'elpejp_writecache';
6789 l_torrwnum pls_integer;
6790 l_prev_id number;
6791 l_id number;
6792 --
6793 cursor c_elpejp_look is
6794 select elp.eligy_prfl_id, elp.business_group_id
6795 from ben_eligy_prfl_f elp
6796 where p_effective_date
6797 between elp.effective_start_date
6798 and elp.effective_end_date
6799 and exists(select null
6800 from ben_elig_job_prte_f ejp
6801 where p_effective_date
6802 between ejp.effective_start_date
6803 and ejp.effective_end_date
6804 and ejp.eligy_prfl_id = elp.eligy_prfl_id)
6805 order by elp.eligy_prfl_id;
6806 --
6807 cursor c_elpejp_inst is
6808 select ejp.eligy_prfl_id,
6809 ejp.elig_job_prte_id pk_id,
6810 'EJP' short_code,
6811 ejp.job_id,
6812 ejp.excld_flag,
6813 ejp.criteria_score,
6814 ejp.criteria_weight
6815 from ben_elig_job_prte_f ejp
6816 where p_effective_date
6817 between ejp.effective_start_date
6818 and ejp.effective_end_date
6819 order by ejp.eligy_prfl_id,
6820 decode(ejp.excld_flag,'Y',1,2),
6821 ejp.ordr_num;
6822 --
6823 l_not_hash_found boolean;
6824 --
6825 begin
6826 --
6827 for objlook in c_elpejp_look loop
6828 --
6829 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
6830 --
6831 -- Check if hashed value is already allocated
6832 --
6833 if g_cache_elpejp_lookup.exists(l_id) then
6834 --
6835 l_not_hash_found := false;
6836 --
6837 -- Loop until un-allocated has value is derived
6838 --
6839 while not l_not_hash_found loop
6840 --
6841 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6842 --
6843 -- Check if the hash index exists, if not we can use it
6844 --
6845 if not g_cache_elpejp_lookup.exists(l_id) then
6846 --
6847 -- Lets store the hash value in the index
6848 --
6849 l_not_hash_found := true;
6850 exit;
6851 --
6852 else
6853 --
6854 l_not_hash_found := false;
6855 --
6856 end if;
6857 --
6858 end loop;
6859 --
6860 end if;
6861 --
6862 g_cache_elpejp_lookup(l_id).id := objlook.eligy_prfl_id;
6863 g_cache_elpejp_lookup(l_id).fk_id := objlook.business_group_id;
6864 --
6865 end loop;
6866 --
6867 l_torrwnum := 0;
6868 l_prev_id := -1;
6869 --
6870 for objinst in c_elpejp_inst loop
6871 --
6872 -- Populate the cache lookup details
6873 --
6874 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
6875 --
6876 -- Check if hashed value is already allocated
6877 --
6878 if g_cache_elpejp_lookup(l_id).id = objinst.eligy_prfl_id then
6879 --
6880 null;
6881 --
6882 else
6883 --
6884 loop
6885 --
6886 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
6887 --
6888 if g_cache_elpejp_lookup(l_id).id = objinst.eligy_prfl_id then
6889 --
6890 exit;
6891 --
6892 end if;
6893 --
6894 end loop;
6895 --
6896 end if;
6897 --
6898 if l_prev_id = -1 then
6899 --
6900 g_cache_elpejp_lookup(l_id).starttorele_num := l_torrwnum;
6901 --
6902 elsif l_id <> l_prev_id then
6903 --
6904 g_cache_elpejp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6905 g_cache_elpejp_lookup(l_id).starttorele_num := l_torrwnum;
6906 --
6907 end if;
6908 --
6909 -- Populate the cache instance details
6910 --
6911 g_cache_elpejp_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
6912 g_cache_elpejp_inst(l_torrwnum).pk_id := objinst.pk_id;
6913 g_cache_elpejp_inst(l_torrwnum).short_code := objinst.short_code;
6914 g_cache_elpejp_inst(l_torrwnum).criteria_score := objinst.criteria_score;
6915 g_cache_elpejp_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
6916 g_cache_elpejp_inst(l_torrwnum).job_id := objinst.job_id;
6917 g_cache_elpejp_inst(l_torrwnum).excld_flag := objinst.excld_flag;
6918 --
6919 l_torrwnum := l_torrwnum+1;
6920 l_prev_id := l_id;
6921 --
6922 end loop;
6923 --
6924 g_cache_elpejp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
6925 --
6926 end elpejp_writecache;
6927 --
6928 procedure elpejp_getcacdets
6929 (p_effective_date in date,
6930 p_business_group_id in number,
6931 p_eligy_prfl_id in number,
6932 p_refresh_cache in boolean default FALSE,
6933 p_inst_set out nocopy ben_elp_cache.g_cache_elpejp_instor,
6934 p_inst_count out nocopy number) is
6935 --
6936 l_proc varchar2(72) := 'elpejp_getcacdets';
6937 l_torrwnum pls_integer;
6941 l_not_hash_found boolean;
6938 l_insttorrw_num pls_integer;
6939 l_index pls_integer;
6940 --
6942 --
6943 begin
6944 --
6945 -- Flush the cache
6946 --
6947 if p_refresh_cache then
6948 --
6949 g_cache_elpejp_lookup.delete;
6950 g_cache_elpejp_inst.delete;
6951 --
6952 end if;
6953 --
6954 -- Populate the global cache
6955 --
6956 if g_cache_elpejp_lookup.count = 0 then
6957 --
6958 -- Build the cache
6959 --
6960 ben_elp_cache.elpejp_writecache
6961 (p_effective_date => p_effective_date,
6962 p_refresh_cache => p_refresh_cache);
6963 --
6964 end if;
6965 --
6966 -- Get the instance details
6967 --
6968 l_torrwnum := 0;
6969 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
6970 --
6971 -- Check if hashed value is already allocated
6972 --
6973 if g_cache_elpejp_lookup.exists(l_index) then
6974 --
6975 -- If it does exist make sure its the right one
6976 --
6977 if g_cache_elpejp_lookup(l_index).id <> p_eligy_prfl_id then
6978 --
6979 l_not_hash_found := false;
6980 --
6981 -- Loop until un-allocated has value is derived
6982 --
6983 while not l_not_hash_found loop
6984 --
6985 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
6986 --
6987 -- Check if the hash index exists, if not we can use it
6988 --
6989 -- Bug 13253435 when moved to next hash index checking whether that
6990 -- hash index 'id' is having value of p_eligy_prfl_id or not.
6991 -- If values are equal then existing from the loop
6992 if g_cache_elpejp_lookup(l_index).id = p_eligy_prfl_id then
6993 l_not_hash_found := true;
6994 exit;
6995 end if;
6996 -- Bug 13253435
6997
6998 if not g_cache_elpejp_lookup.exists(l_index) then
6999 --
7000 -- Lets store the hash value in the index
7001 --
7002 l_not_hash_found := true;
7003 exit;
7004 --
7005 else
7006 --
7007 l_not_hash_found := false;
7008 --
7009 end if;
7010 --
7011 end loop;
7012 --
7013 end if;
7014 --
7015 end if;
7016 --
7017 for l_insttorrw_num in g_cache_elpejp_lookup(l_index).starttorele_num ..
7018 g_cache_elpejp_lookup(l_index).endtorele_num loop
7019 --
7020 p_inst_set(l_torrwnum) := g_cache_elpejp_inst(l_insttorrw_num);
7021 l_torrwnum := l_torrwnum+1;
7022 --
7023 end loop;
7024 --
7025 p_inst_count := l_torrwnum;
7026 --
7027 exception
7028 --
7029 when no_data_found then
7030 --
7031 p_inst_count := 0;
7032 --
7033 end elpejp_getcacdets;
7034 --
7035 procedure elpepb_writecache
7036 (p_effective_date in date,
7037 p_refresh_cache in boolean default FALSE) is
7038 --
7039 l_proc varchar2(72) := 'elpepb_writecache';
7040 l_torrwnum pls_integer;
7041 l_prev_id number;
7042 l_id number;
7043 --
7044 cursor c_elpepb_look is
7045 select elp.eligy_prfl_id,
7046 elp.business_group_id
7047 from ben_eligy_prfl_f elp
7048 where p_effective_date
7049 between elp.effective_start_date
7050 and elp.effective_end_date
7051 and exists(select null
7052 from ben_elig_py_bss_prte_f epb
7053 where p_effective_date
7054 between epb.effective_start_date
7055 and epb.effective_end_date
7056 and epb.eligy_prfl_id = elp.eligy_prfl_id)
7057 order by elp.eligy_prfl_id;
7058 --
7059 cursor c_elpepb_inst is
7060 select epb.eligy_prfl_id,
7061 epb.elig_py_bss_prte_id pk_id,
7062 'EPB' short_code,
7063 epb.pay_basis_id,
7064 epb.excld_flag,
7065 epb.criteria_score,
7066 epb.criteria_weight
7067 from ben_elig_py_bss_prte_f epb
7068 where p_effective_date
7069 between epb.effective_start_date
7070 and epb.effective_end_date
7071 order by epb.eligy_prfl_id,
7072 decode(epb.excld_flag,'Y',1,2),
7073 epb.ordr_num;
7074 --
7075 l_not_hash_found boolean;
7076 --
7077 begin
7078 --
7079 for objlook in c_elpepb_look loop
7080 --
7081 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
7082 --
7083 -- Check if hashed value is already allocated
7084 --
7085 if g_cache_elpepb_lookup.exists(l_id) then
7086 --
7087 l_not_hash_found := false;
7088 --
7089 -- Loop until un-allocated has value is derived
7090 --
7091 while not l_not_hash_found loop
7092 --
7093 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7094 --
7095 -- Check if the hash index exists, if not we can use it
7096 --
7097 if not g_cache_elpepb_lookup.exists(l_id) then
7098 --
7099 -- Lets store the hash value in the index
7100 --
7101 l_not_hash_found := true;
7102 exit;
7103 --
7104 else
7105 --
7106 l_not_hash_found := false;
7107 --
7108 end if;
7109 --
7110 end loop;
7111 --
7112 end if;
7113 --
7117 end loop;
7114 g_cache_elpepb_lookup(l_id).id := objlook.eligy_prfl_id;
7115 g_cache_elpepb_lookup(l_id).fk_id := objlook.business_group_id;
7116 --
7118 --
7119 l_torrwnum := 0;
7120 l_prev_id := -1;
7121 --
7122 for objinst in c_elpepb_inst loop
7123 --
7124 -- Populate the cache lookup details
7125 --
7126 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
7127 --
7128 -- Check if hashed value is already allocated
7129 --
7130 if g_cache_elpepb_lookup(l_id).id = objinst.eligy_prfl_id then
7131 --
7132 null;
7133 --
7134 else
7135 --
7136 loop
7137 --
7138 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7139 --
7140 if g_cache_elpepb_lookup(l_id).id = objinst.eligy_prfl_id then
7141 --
7142 exit;
7143 --
7144 end if;
7145 --
7146 end loop;
7147 --
7148 end if;
7149 --
7150 -- Check for first row
7151 --
7152 if l_prev_id = -1 then
7153 --
7154 g_cache_elpepb_lookup(l_id).starttorele_num := l_torrwnum;
7155 --
7156 elsif l_id <> l_prev_id then
7157 --
7158 g_cache_elpepb_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7159 g_cache_elpepb_lookup(l_id).starttorele_num := l_torrwnum;
7160 --
7161 end if;
7162 --
7163 -- Populate the cache instance details
7164 --
7165 g_cache_elpepb_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
7166 g_cache_elpepb_inst(l_torrwnum).pk_id := objinst.pk_id;
7167 g_cache_elpepb_inst(l_torrwnum).short_code := objinst.short_code;
7168 g_cache_elpepb_inst(l_torrwnum).criteria_score := objinst.criteria_score;
7169 g_cache_elpepb_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
7170 g_cache_elpepb_inst(l_torrwnum).pay_basis_id := objinst.pay_basis_id;
7171 g_cache_elpepb_inst(l_torrwnum).excld_flag := objinst.excld_flag;
7172 --
7173 l_torrwnum := l_torrwnum+1;
7174 l_prev_id := l_id;
7175 --
7176 end loop;
7177 --
7178 g_cache_elpepb_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7179 --
7180 end elpepb_writecache;
7181 --
7182 procedure elpepb_getcacdets
7183 (p_effective_date in date,
7184 p_business_group_id in number,
7185 p_eligy_prfl_id in number,
7186 p_refresh_cache in boolean default FALSE,
7187 p_inst_set out nocopy ben_elp_cache.g_cache_elpepb_instor,
7188 p_inst_count out nocopy number) is
7189 --
7190 l_proc varchar2(72) := 'elpepb_getcacdets';
7191 l_torrwnum pls_integer;
7192 l_insttorrw_num pls_integer;
7193 l_index pls_integer;
7194 --
7195 l_not_hash_found boolean;
7196 --
7197 begin
7198 --
7199 -- Flush the cache
7200 --
7201 if p_refresh_cache then
7202 --
7203 g_cache_elpepb_lookup.delete;
7204 g_cache_elpepb_inst.delete;
7205 --
7206 end if;
7207 --
7208 -- Populate the global cache
7209 --
7210 if g_cache_elpepb_lookup.count = 0 then
7211 --
7212 -- Build the cache
7213 --
7214 ben_elp_cache.elpepb_writecache
7215 (p_effective_date => p_effective_date,
7216 p_refresh_cache => p_refresh_cache);
7217 --
7218 end if;
7219 --
7220 -- Get the instance details
7221 --
7222 l_torrwnum := 0;
7223 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
7224 --
7225 -- Check if hashed value is already allocated
7226 --
7227 if g_cache_elpepb_lookup.exists(l_index) then
7228 --
7229 -- If it does exist make sure its the right one
7230 --
7231 if g_cache_elpepb_lookup(l_index).id <> p_eligy_prfl_id then
7232 --
7233 l_not_hash_found := false;
7234 --
7235 -- Loop until un-allocated has value is derived
7236 --
7237 while not l_not_hash_found loop
7238 --
7239 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
7240 --
7241 -- Check if the hash index exists, if not we can use it
7242 --
7243 -- Bug 13253435 when moved to next hash index checking whether that
7244 -- hash index 'id' is having value of p_eligy_prfl_id or not.
7245 -- If values are equal then existing from the loop
7246 if g_cache_elpepb_lookup(l_index).id = p_eligy_prfl_id then
7247 l_not_hash_found := true;
7248 exit;
7249 end if;
7250 -- Bug 13253435
7251
7252 if not g_cache_elpepb_lookup.exists(l_index) then
7253 --
7254 -- Lets store the hash value in the index
7255 --
7256 l_not_hash_found := true;
7257 exit;
7258 --
7259 else
7260 --
7261 l_not_hash_found := false;
7262 --
7263 end if;
7264 --
7265 end loop;
7266 --
7267 end if;
7268 --
7269 end if;
7270 --
7271 for l_insttorrw_num in g_cache_elpepb_lookup(l_index).starttorele_num ..
7272 g_cache_elpepb_lookup(l_index).endtorele_num loop
7273 --
7274 p_inst_set(l_torrwnum) := g_cache_elpepb_inst(l_insttorrw_num);
7275 l_torrwnum := l_torrwnum+1;
7276 --
7277 end loop;
7278 --
7279 p_inst_count := l_torrwnum;
7280 --
7281 exception
7282 --
7283 when no_data_found then
7284 --
7285 p_inst_count := 0;
7286 --
7287 end elpepb_getcacdets;
7288 --
7292 --
7289 procedure elpepy_writecache
7290 (p_effective_date in date,
7291 p_refresh_cache in boolean default FALSE) is
7293 l_proc varchar2(72) := 'elpepy_writecache';
7294 l_torrwnum pls_integer;
7295 l_prev_id number;
7296 l_id number;
7297 --
7298 cursor c_elpepy_look is
7299 select elp.eligy_prfl_id, elp.business_group_id
7300 from ben_eligy_prfl_f elp
7301 where p_effective_date
7302 between elp.effective_start_date
7303 and elp.effective_end_date
7304 and exists(select null
7305 from ben_elig_pyrl_prte_f epy
7306 where p_effective_date
7307 between epy.effective_start_date
7308 and epy.effective_end_date
7309 and epy.eligy_prfl_id = elp.eligy_prfl_id)
7310 order by elp.eligy_prfl_id;
7311 --
7312 cursor c_elpepy_inst is
7313 select epy.eligy_prfl_id,
7314 epy.elig_pyrl_prte_id pk_id,
7315 'EPY' short_code,
7316 epy.payroll_id,
7317 epy.excld_flag,
7318 epy.criteria_score,
7319 epy.criteria_weight
7320 from ben_elig_pyrl_prte_f epy
7321 where p_effective_date
7322 between epy.effective_start_date
7323 and epy.effective_end_date
7324 order by epy.eligy_prfl_id,
7325 decode(epy.excld_flag,'Y',1,2),
7326 epy.ordr_num;
7327 --
7328 l_not_hash_found boolean;
7329 --
7330 begin
7331 --
7332 for objlook in c_elpepy_look loop
7333 --
7334 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
7335 --
7336 -- Check if hashed value is already allocated
7337 --
7338 if g_cache_elpepy_lookup.exists(l_id) then
7339 --
7340 l_not_hash_found := false;
7341 --
7342 -- Loop until un-allocated has value is derived
7343 --
7344 while not l_not_hash_found loop
7345 --
7346 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7347 --
7348 -- Check if the hash index exists, if not we can use it
7349 --
7350 if not g_cache_elpepy_lookup.exists(l_id) then
7351 --
7352 -- Lets store the hash value in the index
7353 --
7354 l_not_hash_found := true;
7355 exit;
7356 --
7357 else
7358 --
7359 l_not_hash_found := false;
7360 --
7361 end if;
7362 --
7363 end loop;
7364 --
7365 end if;
7366 --
7367 g_cache_elpepy_lookup(l_id).id := objlook.eligy_prfl_id;
7368 g_cache_elpepy_lookup(l_id).fk_id := objlook.business_group_id;
7369 --
7370 end loop;
7371 --
7372 l_torrwnum := 0;
7373 l_prev_id := -1;
7374 --
7375 for objinst in c_elpepy_inst loop
7376 --
7377 -- Populate the cache lookup details
7378 --
7379 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
7380 --
7381 -- Check if hashed value is already allocated
7382 --
7383 if g_cache_elpepy_lookup(l_id).id = objinst.eligy_prfl_id then
7384 --
7385 null;
7386 --
7387 else
7388 --
7389 loop
7390 --
7391 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7392 --
7393 if g_cache_elpepy_lookup(l_id).id = objinst.eligy_prfl_id then
7394 --
7395 exit;
7396 --
7397 end if;
7398 --
7399 end loop;
7400 --
7401 end if;
7402 --
7403 -- Check for first row
7404 --
7405 if l_prev_id = -1 then
7406 --
7407 g_cache_elpepy_lookup(l_id).starttorele_num := l_torrwnum;
7408 --
7409 elsif l_id <> l_prev_id then
7410 --
7411 g_cache_elpepy_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7412 g_cache_elpepy_lookup(l_id).starttorele_num := l_torrwnum;
7413 --
7414 end if;
7415 --
7416 -- Populate the cache instance details
7417 --
7418 g_cache_elpepy_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
7419 g_cache_elpepy_inst(l_torrwnum).pk_id := objinst.pk_id;
7420 g_cache_elpepy_inst(l_torrwnum).short_code := objinst.short_code;
7421 g_cache_elpepy_inst(l_torrwnum).criteria_score := objinst.criteria_score;
7422 g_cache_elpepy_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
7423 g_cache_elpepy_inst(l_torrwnum).payroll_id := objinst.payroll_id;
7424 g_cache_elpepy_inst(l_torrwnum).excld_flag := objinst.excld_flag;
7425 --
7426 l_torrwnum := l_torrwnum+1;
7427 l_prev_id := l_id;
7428 --
7429 end loop;
7430 --
7431 g_cache_elpepy_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7432 --
7433 end elpepy_writecache;
7434 --
7435 procedure elpepy_getcacdets
7436 (p_effective_date in date,
7437 p_business_group_id in number,
7438 p_eligy_prfl_id in number,
7439 p_refresh_cache in boolean default FALSE,
7440 p_inst_set out nocopy ben_elp_cache.g_cache_elpepy_instor,
7441 p_inst_count out nocopy number) is
7442 --
7443 l_proc varchar2(72) := 'elpepy_getcacdets';
7444 l_torrwnum pls_integer;
7445 l_insttorrw_num pls_integer;
7446 l_index pls_integer;
7447 --
7448 l_not_hash_found boolean;
7449 --
7450 begin
7451 --
7455 --
7452 -- Flush the cache
7453 --
7454 if p_refresh_cache then
7456 g_cache_elpepy_lookup.delete;
7457 g_cache_elpepy_inst.delete;
7458 --
7459 end if;
7460 --
7461 -- Populate the global cache
7462 --
7463 if g_cache_elpepy_lookup.count = 0 then
7464 --
7465 -- Build the cache
7466 --
7467 ben_elp_cache.elpepy_writecache
7468 (p_effective_date => p_effective_date,
7469 p_refresh_cache => p_refresh_cache);
7470 --
7471 end if;
7472 --
7473 -- Get the instance details
7474 --
7475 l_torrwnum := 0;
7476 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
7477 --
7478 -- Check if hashed value is already allocated
7479 --
7480 if g_cache_elpepy_lookup.exists(l_index) then
7481 --
7482 -- If it does exist make sure its the right one
7483 --
7484 if g_cache_elpepy_lookup(l_index).id <> p_eligy_prfl_id then
7485 --
7486 l_not_hash_found := false;
7487 --
7488 -- Loop until un-allocated has value is derived
7489 --
7490 while not l_not_hash_found loop
7491 --
7492 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
7493 --
7494 -- Check if the hash index exists, if not we can use it
7495 --
7496 -- Bug 13253435 when moved to next hash index checking whether that
7497 -- hash index 'id' is having value of p_eligy_prfl_id or not.
7498 -- If values are equal then existing from the loop
7499 if g_cache_elpepy_lookup(l_index).id = p_eligy_prfl_id then
7500 l_not_hash_found := true;
7501 exit;
7502 end if;
7503 -- Bug 13253435
7504
7505 if not g_cache_elpepy_lookup.exists(l_index) then
7506 --
7507 -- Lets store the hash value in the index
7508 --
7509 l_not_hash_found := true;
7510 exit;
7511 --
7512 else
7513 --
7514 l_not_hash_found := false;
7515 --
7516 end if;
7517 --
7518 end loop;
7519 --
7520 end if;
7521 --
7522 end if;
7523 --
7524 for l_insttorrw_num in g_cache_elpepy_lookup(l_index).starttorele_num ..
7525 g_cache_elpepy_lookup(l_index).endtorele_num loop
7526 --
7527 p_inst_set(l_torrwnum) := g_cache_elpepy_inst(l_insttorrw_num);
7528 l_torrwnum := l_torrwnum+1;
7529 --
7530 end loop;
7531 --
7532 p_inst_count := l_torrwnum;
7533 --
7534 exception
7535 --
7536 when no_data_found then
7537 --
7538 p_inst_count := 0;
7539 --
7540 end elpepy_getcacdets;
7541 --
7542 procedure elpebu_writecache
7543 (p_effective_date in date,
7544 p_refresh_cache in boolean default false) is
7545 --
7546 l_proc varchar2(72) := 'elpebu_writecache';
7547 l_torrwnum pls_integer;
7548 l_prev_id number;
7549 l_id number;
7550 --
7551 cursor c_elpebu_look is
7552 select elp.eligy_prfl_id,
7553 elp.business_group_id
7554 from ben_eligy_prfl_f elp
7555 where p_effective_date
7556 between elp.effective_start_date
7557 and elp.effective_end_date
7558 and exists(select null
7559 from ben_elig_brgng_unit_prte_f ebu
7560 where p_effective_date
7561 between ebu.effective_start_date
7562 and ebu.effective_end_date
7563 and ebu.eligy_prfl_id = elp.eligy_prfl_id)
7564 order by elp.eligy_prfl_id;
7565 --
7566 cursor c_elpebu_inst is
7567 select ebu.eligy_prfl_id,
7568 ebu.elig_brgng_unit_prte_id pk_id,
7569 'EBU' short_code,
7570 ebu.brgng_unit_cd,
7571 ebu.excld_flag,
7572 ebu.criteria_score,
7573 ebu.criteria_weight
7574 from ben_elig_brgng_unit_prte_f ebu
7575 where p_effective_date
7576 between ebu.effective_start_date
7577 and ebu.effective_end_date
7578 order by ebu.eligy_prfl_id,
7579 decode(ebu.excld_flag,'Y',1,2),
7580 ebu.ordr_num;
7581 --
7582 l_not_hash_found boolean;
7583 --
7584 begin
7585 --
7586 for objlook in c_elpebu_look loop
7587 --
7588 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
7589 --
7590 -- Check if hashed value is already allocated
7591 --
7592 if g_cache_elpebu_lookup.exists(l_id) then
7593 --
7594 l_not_hash_found := false;
7595 --
7596 -- Loop until un-allocated has value is derived
7597 --
7598 while not l_not_hash_found loop
7599 --
7600 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7601 --
7602 -- Check if the hash index exists, if not we can use it
7603 --
7604 if not g_cache_elpebu_lookup.exists(l_id) then
7605 --
7606 -- Lets store the hash value in the index
7607 --
7608 l_not_hash_found := true;
7609 exit;
7610 --
7611 else
7612 --
7613 l_not_hash_found := false;
7614 --
7615 end if;
7616 --
7617 end loop;
7618 --
7619 end if;
7620 --
7624 end loop;
7621 g_cache_elpebu_lookup(l_id).id := objlook.eligy_prfl_id;
7622 g_cache_elpebu_lookup(l_id).fk_id := objlook.business_group_id;
7623 --
7625 --
7626 l_torrwnum := 0;
7627 l_prev_id := -1;
7628 --
7629 for objinst in c_elpebu_inst loop
7630 --
7631 -- Populate the cache lookup details
7632 --
7633 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
7634 --
7635 -- Check if hashed value is already allocated
7636 --
7637 if g_cache_elpebu_lookup(l_id).id = objinst.eligy_prfl_id then
7638 --
7639 null;
7640 --
7641 else
7642 --
7643 loop
7644 --
7645 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7646 --
7647 if g_cache_elpebu_lookup(l_id).id = objinst.eligy_prfl_id then
7648 --
7649 exit;
7650 --
7651 end if;
7652 --
7653 end loop;
7654 --
7655 end if;
7656 --
7657 -- Check for first row
7658 --
7659 if l_prev_id = -1 then
7660 --
7661 g_cache_elpebu_lookup(l_id).starttorele_num := l_torrwnum;
7662 --
7663 elsif l_id <> l_prev_id then
7664 --
7665 g_cache_elpebu_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7666 g_cache_elpebu_lookup(l_id).starttorele_num := l_torrwnum;
7667 --
7668 end if;
7669 --
7670 -- Populate the cache instance details
7671 --
7672 g_cache_elpebu_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
7673 g_cache_elpebu_inst(l_torrwnum).pk_id := objinst.pk_id;
7674 g_cache_elpebu_inst(l_torrwnum).short_code := objinst.short_code;
7675 g_cache_elpebu_inst(l_torrwnum).criteria_score := objinst.criteria_score;
7676 g_cache_elpebu_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
7677 g_cache_elpebu_inst(l_torrwnum).brgng_unit_cd := objinst.brgng_unit_cd;
7678 g_cache_elpebu_inst(l_torrwnum).excld_flag := objinst.excld_flag;
7679 --
7680 l_torrwnum := l_torrwnum+1;
7681 l_prev_id := l_id;
7682 --
7683 end loop;
7684 --
7685 g_cache_elpebu_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7686 --
7687 end elpebu_writecache;
7688 --
7689 procedure elpebu_getcacdets
7690 (p_effective_date in date,
7691 p_business_group_id in number,
7692 p_eligy_prfl_id in number,
7693 p_refresh_cache in boolean default FALSE,
7694 p_inst_set out nocopy ben_elp_cache.g_cache_elpebu_instor,
7695 p_inst_count out nocopy number) is
7696 --
7697 l_proc varchar2(72) := 'elpebu_getcacdets';
7698 l_torrwnum pls_integer;
7699 l_insttorrw_num pls_integer;
7700 l_index pls_integer;
7701 --
7702 l_not_hash_found boolean;
7703 --
7704 begin
7705 --
7706 -- Flush the cache
7707 --
7708 if p_refresh_cache then
7709 --
7710 g_cache_elpebu_lookup.delete;
7711 g_cache_elpebu_inst.delete;
7712 --
7713 end if;
7714 --
7715 -- Populate the global cache
7716 --
7717 if g_cache_elpebu_lookup.count = 0 then
7718 --
7719 -- Build the cache
7720 --
7721 ben_elp_cache.elpebu_writecache
7722 (p_effective_date => p_effective_date,
7723 p_refresh_cache => p_refresh_cache);
7724 --
7725 end if;
7726 --
7727 -- Get the instance details
7728 --
7729 l_torrwnum := 0;
7730 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
7731 --
7732 -- Check if hashed value is already allocated
7733 --
7734 if g_cache_elpebu_lookup.exists(l_index) then
7735 --
7736 -- If it does exist make sure its the right one
7737 --
7738 if g_cache_elpebu_lookup(l_index).id <> p_eligy_prfl_id then
7739 --
7740 l_not_hash_found := false;
7741 --
7742 -- Loop until un-allocated has value is derived
7743 --
7744 while not l_not_hash_found loop
7745 --
7746 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
7747 --
7748 -- Check if the hash index exists, if not we can use it
7749 --
7750 -- Bug 13253435 when moved to next hash index checking whether that
7751 -- hash index 'id' is having value of p_eligy_prfl_id or not.
7752 -- If values are equal then existing from the loop
7753 if g_cache_elpebu_lookup(l_index).id = p_eligy_prfl_id then
7754 l_not_hash_found := true;
7755 exit;
7756 end if;
7757 -- Bug 13253435
7758
7759 if not g_cache_elpebu_lookup.exists(l_index) then
7760 --
7761 -- Lets store the hash value in the index
7762 --
7763 l_not_hash_found := true;
7764 exit;
7765 --
7766 else
7767 --
7768 l_not_hash_found := false;
7769 --
7770 end if;
7771 --
7772 end loop;
7773 --
7774 end if;
7775 --
7776 end if;
7777 --
7778 for l_insttorrw_num in g_cache_elpebu_lookup(l_index).starttorele_num ..
7779 g_cache_elpebu_lookup(l_index).endtorele_num loop
7780 --
7781 p_inst_set(l_torrwnum) := g_cache_elpebu_inst(l_insttorrw_num);
7782 l_torrwnum := l_torrwnum+1;
7783 --
7784 end loop;
7785 --
7786 p_inst_count := l_torrwnum;
7787 --
7788 exception
7789 --
7790 when no_data_found then
7791 --
7792 p_inst_count := 0;
7793 --
7794 end elpebu_getcacdets;
7795 --
7799 --
7796 procedure elpelu_writecache
7797 (p_effective_date in date,
7798 p_refresh_cache in boolean default FALSE) is
7800 l_proc varchar2(72) := 'elpelu_writecache';
7801 l_torrwnum pls_integer;
7802 l_prev_id number;
7803 l_id number;
7804 --
7805 cursor c_elpelu_look is
7806 select elp.eligy_prfl_id,
7807 elp.business_group_id
7808 from ben_eligy_prfl_f elp
7809 where p_effective_date
7810 between elp.effective_start_date
7811 and elp.effective_end_date
7812 and exists(select null
7813 from ben_elig_lbr_mmbr_prte_f elu
7814 where p_effective_date
7815 between elu.effective_start_date
7816 and elu.effective_end_date
7817 and elu.eligy_prfl_id = elp.eligy_prfl_id)
7818 order by elp.eligy_prfl_id;
7819 --
7820 cursor c_elpelu_inst is
7821 select elu.eligy_prfl_id,
7822 elu.elig_lbr_mmbr_prte_id pk_id,
7823 'ELU' short_code,
7824 elu.lbr_mmbr_flag,
7825 elu.excld_flag,
7826 elu.criteria_score,
7827 elu.criteria_weight
7828 from ben_elig_lbr_mmbr_prte_f elu
7829 where p_effective_date
7830 between elu.effective_start_date
7831 and elu.effective_end_date
7832 order by elu.eligy_prfl_id,
7833 decode(elu.excld_flag,'Y',1,2),
7834 elu.ordr_num;
7835 --
7836 l_not_hash_found boolean;
7837 --
7838 begin
7839 --
7840 for objlook in c_elpelu_look loop
7841 --
7842 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
7843 --
7844 -- Check if hashed value is already allocated
7845 --
7846 if g_cache_elpelu_lookup.exists(l_id) then
7847 --
7848 l_not_hash_found := false;
7849 --
7850 -- Loop until un-allocated has value is derived
7851 --
7852 while not l_not_hash_found loop
7853 --
7854 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7855 --
7856 -- Check if the hash index exists, if not we can use it
7857 --
7858 if not g_cache_elpelu_lookup.exists(l_id) then
7859 --
7860 -- Lets store the hash value in the index
7861 --
7862 l_not_hash_found := true;
7863 exit;
7864 --
7865 else
7866 --
7867 l_not_hash_found := false;
7868 --
7869 end if;
7870 --
7871 end loop;
7872 --
7873 end if;
7874 --
7875 g_cache_elpelu_lookup(l_id).id := objlook.eligy_prfl_id;
7876 g_cache_elpelu_lookup(l_id).fk_id := objlook.business_group_id;
7877 --
7878 end loop;
7879 --
7880 l_torrwnum := 0;
7881 l_prev_id := -1;
7882 --
7883 for objinst in c_elpelu_inst loop
7884 --
7885 -- Populate the cache lookup details
7886 --
7887 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
7888 --
7889 -- Check if hashed value is already allocated
7890 --
7891 if g_cache_elpelu_lookup(l_id).id = objinst.eligy_prfl_id then
7892 --
7893 null;
7894 --
7895 else
7896 --
7897 loop
7898 --
7899 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
7900 --
7901 if g_cache_elpelu_lookup(l_id).id = objinst.eligy_prfl_id then
7902 --
7903 exit;
7904 --
7905 end if;
7906 --
7907 end loop;
7908 --
7909 end if;
7910 --
7911 -- Check for first row
7912 --
7913 if l_prev_id = -1 then
7914 --
7915 g_cache_elpelu_lookup(l_id).starttorele_num := l_torrwnum;
7916 --
7917 elsif l_id <> l_prev_id then
7918 --
7919 g_cache_elpelu_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7920 g_cache_elpelu_lookup(l_id).starttorele_num := l_torrwnum;
7921 --
7922 end if;
7923 --
7924 -- Populate the cache instance details
7925 --
7926 g_cache_elpelu_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
7927 g_cache_elpelu_inst(l_torrwnum).pk_id := objinst.pk_id;
7928 g_cache_elpelu_inst(l_torrwnum).short_code := objinst.short_code;
7929 g_cache_elpelu_inst(l_torrwnum).criteria_score := objinst.criteria_score;
7930 g_cache_elpelu_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
7931 g_cache_elpelu_inst(l_torrwnum).lbr_mmbr_flag := objinst.lbr_mmbr_flag;
7932 g_cache_elpelu_inst(l_torrwnum).excld_flag := objinst.excld_flag;
7933 --
7934 l_torrwnum := l_torrwnum+1;
7935 l_prev_id := l_id;
7936 --
7937 end loop;
7938 --
7939 g_cache_elpelu_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
7940 --
7941 end elpelu_writecache;
7942 --
7943 procedure elpelu_getcacdets
7944 (p_effective_date in date,
7945 p_business_group_id in number,
7946 p_eligy_prfl_id in number,
7947 p_refresh_cache in boolean default FALSE,
7948 p_inst_set out nocopy ben_elp_cache.g_cache_elpelu_instor,
7949 p_inst_count out nocopy number) is
7950 --
7951 l_proc varchar2(72) := 'elpelu_getcacdets';
7952 l_torrwnum pls_integer;
7953 l_insttorrw_num pls_integer;
7954 l_index pls_integer;
7955 --
7956 l_not_hash_found boolean;
7957 --
7958 begin
7959 --
7960 -- Flush the cache
7961 --
7962 if p_refresh_cache then
7963 --
7964 g_cache_elpelu_lookup.delete;
7968 --
7965 g_cache_elpelu_inst.delete;
7966 --
7967 end if;
7969 -- Populate the global cache
7970 --
7971 if g_cache_elpelu_lookup.count = 0 then
7972 --
7973 -- Build the cache
7974 --
7975 ben_elp_cache.elpelu_writecache
7976 (p_effective_date => p_effective_date,
7977 p_refresh_cache => p_refresh_cache);
7978 --
7979 end if;
7980 --
7981 -- Get the instance details
7982 --
7983 l_torrwnum := 0;
7984 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
7985 --
7986 -- Check if hashed value is already allocated
7987 --
7988 if g_cache_elpelu_lookup.exists(l_index) then
7989 --
7990 -- If it does exist make sure its the right one
7991 --
7992 if g_cache_elpelu_lookup(l_index).id <> p_eligy_prfl_id then
7993 --
7994 l_not_hash_found := false;
7995 --
7996 -- Loop until un-allocated has value is derived
7997 --
7998 while not l_not_hash_found loop
7999 --
8000 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
8001 --
8002 -- Check if the hash index exists, if not we can use it
8003 --
8004 -- Bug 13253435 when moved to next hash index checking whether that
8005 -- hash index 'id' is having value of p_eligy_prfl_id or not.
8006 -- If values are equal then existing from the loop
8007 if g_cache_elpelu_lookup(l_index).id = p_eligy_prfl_id then
8008 l_not_hash_found := true;
8009 exit;
8010 end if;
8011 -- Bug 13253435
8012
8013 if not g_cache_elpelu_lookup.exists(l_index) then
8014 --
8015 -- Lets store the hash value in the index
8016 --
8017 l_not_hash_found := true;
8018 exit;
8019 --
8020 else
8021 --
8022 l_not_hash_found := false;
8023 --
8024 end if;
8025 --
8026 end loop;
8027 --
8028 end if;
8029 --
8030 end if;
8031 --
8032 for l_insttorrw_num in g_cache_elpelu_lookup(l_index).starttorele_num ..
8033 g_cache_elpelu_lookup(l_index).endtorele_num loop
8034 --
8035 p_inst_set(l_torrwnum) := g_cache_elpelu_inst(l_insttorrw_num);
8036 l_torrwnum := l_torrwnum+1;
8037 --
8038 end loop;
8039 --
8040 p_inst_count := l_torrwnum;
8041 --
8042 exception
8043 --
8044 when no_data_found then
8045 --
8046 p_inst_count := 0;
8047 --
8048 end elpelu_getcacdets;
8049 --
8050 procedure elpelr_writecache
8051 (p_effective_date in date,
8052 p_refresh_cache in boolean default FALSE) is
8053 --
8054 l_proc varchar2(72) := 'elpelr_writecache';
8055 l_torrwnum pls_integer;
8056 l_prev_id number;
8057 l_id number;
8058 --
8059 cursor c_elpelr_look is
8060 select elp.eligy_prfl_id,
8061 elp.business_group_id
8062 from ben_eligy_prfl_f elp
8063 where p_effective_date
8064 between elp.effective_start_date
8065 and elp.effective_end_date
8066 and exists(select null
8067 from ben_elig_loa_rsn_prte_f elr
8068 where p_effective_date
8069 between elr.effective_start_date
8070 and elr.effective_end_date
8071 and elr.eligy_prfl_id = elp.eligy_prfl_id)
8072 order by elp.eligy_prfl_id;
8073 --
8074 cursor c_elpelr_inst is
8075 select elr.eligy_prfl_id,
8076 elr.elig_loa_rsn_prte_id pk_id,
8077 'ELR' short_code,
8078 elr.absence_attendance_type_id,
8079 elr.abs_attendance_reason_id,
8080 elr.excld_flag,
8081 elr.criteria_score,
8082 elr.criteria_weight
8083 from ben_elig_loa_rsn_prte_f elr
8084 where p_effective_date
8085 between elr.effective_start_date
8086 and elr.effective_end_date
8087 order by elr.eligy_prfl_id,
8088 decode(elr.excld_flag,'Y',1,2),
8089 elr.ordr_num;
8090 --
8091 l_not_hash_found boolean;
8092 --
8093 begin
8094 --
8095 for objlook in c_elpelr_look loop
8096 --
8097 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
8098 --
8099 -- Check if hashed value is already allocated
8100 --
8101 if g_cache_elpelr_lookup.exists(l_id) then
8102 --
8103 l_not_hash_found := false;
8104 --
8105 -- Loop until un-allocated has value is derived
8106 --
8107 while not l_not_hash_found loop
8108 --
8109 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8110 --
8111 -- Check if the hash index exists, if not we can use it
8112 --
8113 if not g_cache_elpelr_lookup.exists(l_id) then
8114 --
8115 -- Lets store the hash value in the index
8116 --
8117 l_not_hash_found := true;
8118 exit;
8119 --
8120 else
8121 --
8122 l_not_hash_found := false;
8123 --
8124 end if;
8125 --
8126 end loop;
8127 --
8128 end if;
8129 --
8130 g_cache_elpelr_lookup(l_id).id := objlook.eligy_prfl_id;
8131 g_cache_elpelr_lookup(l_id).fk_id := objlook.business_group_id;
8132 --
8133 end loop;
8134 --
8135 l_torrwnum := 0;
8136 l_prev_id := -1;
8137 --
8138 for objinst in c_elpelr_inst loop
8142 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
8139 --
8140 -- Populate the cache lookup details
8141 --
8143 --
8144 -- Check if hashed value is already allocated
8145 --
8146 if g_cache_elpelr_lookup(l_id).id = objinst.eligy_prfl_id then
8147 --
8148 null;
8149 --
8150 else
8151 --
8152 loop
8153 --
8154 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8155 --
8156 if g_cache_elpelr_lookup(l_id).id = objinst.eligy_prfl_id then
8157 --
8158 exit;
8159 --
8160 end if;
8161 --
8162 end loop;
8163 --
8164 end if;
8165 --
8166 -- Check for first row
8167 --
8168 if l_prev_id = -1 then
8169 --
8170 g_cache_elpelr_lookup(l_id).starttorele_num := l_torrwnum;
8171 --
8172 elsif l_id <> l_prev_id then
8173 --
8174 g_cache_elpelr_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8175 g_cache_elpelr_lookup(l_id).starttorele_num := l_torrwnum;
8176 --
8177 end if;
8178 --
8179 -- Populate the cache instance details
8180 --
8181 g_cache_elpelr_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
8182 g_cache_elpelr_inst(l_torrwnum).pk_id := objinst.pk_id;
8183 g_cache_elpelr_inst(l_torrwnum).short_code := objinst.short_code;
8184 g_cache_elpelr_inst(l_torrwnum).criteria_score := objinst.criteria_score;
8185 g_cache_elpelr_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
8186 g_cache_elpelr_inst(l_torrwnum).absence_attendance_type_id := objinst.absence_attendance_type_id;
8187 g_cache_elpelr_inst(l_torrwnum).abs_attendance_reason_id := objinst.abs_attendance_reason_id;
8188 g_cache_elpelr_inst(l_torrwnum).excld_flag := objinst.excld_flag;
8189 --
8190 l_torrwnum := l_torrwnum+1;
8191 l_prev_id := l_id;
8192 --
8193 end loop;
8194 --
8195 g_cache_elpelr_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8196 --
8197 end elpelr_writecache;
8198 --
8199 procedure elpelr_getcacdets
8200 (p_effective_date in date,
8201 p_business_group_id in number,
8202 p_eligy_prfl_id in number,
8203 p_refresh_cache in boolean default FALSE,
8204 p_inst_set out nocopy ben_elp_cache.g_cache_elpelr_instor,
8205 p_inst_count out nocopy number) is
8206 --
8207 l_proc varchar2(72) := 'elpelr_getcacdets';
8208 l_torrwnum pls_integer;
8209 l_insttorrw_num pls_integer;
8210 l_index pls_integer;
8211 --
8212 l_not_hash_found boolean;
8213 --
8214 begin
8215 --
8216 -- Flush the cache
8217 --
8218 if p_refresh_cache then
8219 --
8220 g_cache_elpelr_lookup.delete;
8221 g_cache_elpelr_inst.delete;
8222 --
8223 end if;
8224 --
8225 -- Populate the global cache
8226 --
8227 if g_cache_elpelr_lookup.count = 0 then
8228 --
8229 -- Build the cache
8230 --
8231 ben_elp_cache.elpelr_writecache
8232 (p_effective_date => p_effective_date,
8233 p_refresh_cache => p_refresh_cache);
8234 --
8235 end if;
8236 --
8237 -- Get the instance details
8238 --
8239 l_torrwnum := 0;
8240 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
8241 --
8242 -- Check if hashed value is already allocated
8243 --
8244 if g_cache_elpelr_lookup.exists(l_index) then
8245 --
8246 -- If it does exist make sure its the right one
8247 --
8248 if g_cache_elpelr_lookup(l_index).id <> p_eligy_prfl_id then
8249 --
8250 l_not_hash_found := false;
8251 --
8252 -- Loop until un-allocated has value is derived
8253 --
8254 while not l_not_hash_found loop
8255 --
8256 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
8257 --
8258 -- Check if the hash index exists, if not we can use it
8259 --
8260 -- Bug 13253435 when moved to next hash index checking whether that
8261 -- hash index 'id' is having value of p_eligy_prfl_id or not.
8262 -- If values are equal then existing from the loop
8263 if g_cache_elpelr_lookup(l_index).id = p_eligy_prfl_id then
8264 l_not_hash_found := true;
8265 exit;
8266 end if;
8267 -- Bug 13253435
8268
8269 if not g_cache_elpelr_lookup.exists(l_index) then
8270 --
8271 -- Lets store the hash value in the index
8272 --
8273 l_not_hash_found := true;
8274 exit;
8275 --
8276 else
8277 --
8278 l_not_hash_found := false;
8279 --
8280 end if;
8281 --
8282 end loop;
8283 --
8284 end if;
8285 --
8286 end if;
8287 --
8288 for l_insttorrw_num in g_cache_elpelr_lookup(l_index).starttorele_num ..
8289 g_cache_elpelr_lookup(l_index).endtorele_num loop
8290 --
8291 p_inst_set(l_torrwnum) := g_cache_elpelr_inst(l_insttorrw_num);
8292 l_torrwnum := l_torrwnum+1;
8293 --
8294 end loop;
8295 --
8296 p_inst_count := l_torrwnum;
8297 --
8298 exception
8299 --
8300 when no_data_found then
8301 --
8302 p_inst_count := 0;
8303 --
8304 end elpelr_getcacdets;
8305 --
8306 procedure elpeap_writecache
8307 (p_effective_date in date,
8308 p_refresh_cache in boolean default FALSE) is
8309 --
8310 l_proc varchar2(72) := 'elpeap_writecache';
8314 --
8311 l_torrwnum pls_integer;
8312 l_prev_id number;
8313 l_id number;
8315 cursor c_elpeap_look is
8316 select elp.eligy_prfl_id, elp.business_group_id
8317 from ben_eligy_prfl_f elp
8318 where p_effective_date
8319 between elp.effective_start_date
8320 and elp.effective_end_date
8321 and exists(select null
8322 from ben_elig_age_prte_f eap,
8323 ben_age_fctr agf
8324 where eap.age_fctr_id = agf.age_fctr_id
8325 and eap.business_group_id = agf.business_group_id
8326 and p_effective_date
8327 between eap.effective_start_date
8328 and eap.effective_end_date
8329 and eap.eligy_prfl_id = elp.eligy_prfl_id)
8330 order by elp.eligy_prfl_id;
8331 --
8332 cursor c_elpeap_inst is
8333 select eap.eligy_prfl_id,
8334 eap.elig_age_prte_id pk_id,
8335 'EAP' short_code,
8336 eap.age_fctr_id,
8337 eap.excld_flag,
8338 eap.criteria_score,
8339 eap.criteria_weight,
8340 agf.mx_age_num,
8341 agf.mn_age_num,
8342 agf.no_mn_age_flag,
8343 agf.no_mx_age_flag
8344 from ben_elig_age_prte_f eap,
8345 ben_age_fctr agf
8346 where eap.age_fctr_id = agf.age_fctr_id
8347 and eap.business_group_id = agf.business_group_id
8348 and p_effective_date
8349 between eap.effective_start_date
8350 and eap.effective_end_date
8351 order by eap.eligy_prfl_id,
8352 decode(eap.excld_flag,'Y',1,2),
8353 eap.ordr_num;
8354 --
8355 l_not_hash_found boolean;
8356 --
8357 begin
8358 --
8359 for objlook in c_elpeap_look loop
8360 --
8361 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
8362 --
8363 -- Check if hashed value is already allocated
8364 --
8365 if g_cache_elpeap_lookup.exists(l_id) then
8366 --
8367 l_not_hash_found := false;
8368 --
8369 -- Loop until un-allocated has value is derived
8370 --
8371 while not l_not_hash_found loop
8372 --
8373 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8374 --
8375 -- Check if the hash index exists, if not we can use it
8376 --
8377 if not g_cache_elpeap_lookup.exists(l_id) then
8378 --
8379 -- Lets store the hash value in the index
8380 --
8381 l_not_hash_found := true;
8382 exit;
8383 --
8384 else
8385 --
8386 l_not_hash_found := false;
8387 --
8388 end if;
8389 --
8390 end loop;
8391 --
8392 end if;
8393 --
8394 g_cache_elpeap_lookup(l_id).id := objlook.eligy_prfl_id;
8395 g_cache_elpeap_lookup(l_id).fk_id := objlook.business_group_id;
8396 --
8397 end loop;
8398 --
8399 l_torrwnum := 0;
8400 l_prev_id := -1;
8401 --
8402 for objinst in c_elpeap_inst loop
8403 --
8404 -- Populate the cache lookup details
8405 --
8406 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
8407 --
8408 -- Check if hashed value is already allocated
8409 --
8410 if g_cache_elpeap_lookup(l_id).id = objinst.eligy_prfl_id then
8411 --
8412 null;
8413 --
8414 else
8415 --
8416 loop
8417 --
8418 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8419 --
8420 if g_cache_elpeap_lookup(l_id).id = objinst.eligy_prfl_id then
8421 --
8422 exit;
8423 --
8424 end if;
8425 --
8426 end loop;
8427 --
8428 end if;
8429 --
8430 -- Check for first row
8431 --
8432 if l_prev_id = -1 then
8433 --
8434 g_cache_elpeap_lookup(l_id).starttorele_num := l_torrwnum;
8435 --
8436 elsif l_id <> l_prev_id then
8437 --
8438 g_cache_elpeap_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8439 g_cache_elpeap_lookup(l_id).starttorele_num := l_torrwnum;
8440 --
8441 end if;
8442 --
8443 -- Populate the cache instance details
8444 --
8445 g_cache_elpeap_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
8446 g_cache_elpeap_inst(l_torrwnum).pk_id := objinst.pk_id;
8447 g_cache_elpeap_inst(l_torrwnum).short_code := objinst.short_code;
8448 g_cache_elpeap_inst(l_torrwnum).criteria_score := objinst.criteria_score;
8449 g_cache_elpeap_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
8450 g_cache_elpeap_inst(l_torrwnum).age_fctr_id := objinst.age_fctr_id;
8451 g_cache_elpeap_inst(l_torrwnum).excld_flag := objinst.excld_flag;
8452 g_cache_elpeap_inst(l_torrwnum).mx_age_num := objinst.mx_age_num;
8453 g_cache_elpeap_inst(l_torrwnum).mn_age_num := objinst.mn_age_num;
8454 g_cache_elpeap_inst(l_torrwnum).no_mn_age_flag := objinst.no_mn_age_flag;
8455 g_cache_elpeap_inst(l_torrwnum).no_mx_age_flag := objinst.no_mx_age_flag;
8456 --
8457 l_torrwnum := l_torrwnum+1;
8458 l_prev_id := l_id;
8459 --
8460 end loop;
8461 --
8462 g_cache_elpeap_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8463 --
8464 end elpeap_writecache;
8465 --
8466 procedure elpeap_getcacdets
8467 (p_effective_date in date,
8468 p_business_group_id in number,
8469 p_eligy_prfl_id in number,
8470 p_refresh_cache in boolean default FALSE,
8474 l_proc varchar2(72) := 'elpeap_getcacdets';
8471 p_inst_set out nocopy ben_elp_cache.g_cache_elpeap_instor,
8472 p_inst_count out nocopy number) is
8473 --
8475 l_torrwnum pls_integer;
8476 l_insttorrw_num pls_integer;
8477 l_index pls_integer;
8478 --
8479 l_not_hash_found boolean;
8480 --
8481 begin
8482 --
8483 -- Flush the cache
8484 --
8485 if p_refresh_cache then
8486 --
8487 g_cache_elpeap_lookup.delete;
8488 g_cache_elpeap_inst.delete;
8489 --
8490 end if;
8491 --
8492 -- Populate the global cache
8493 --
8494 if g_cache_elpeap_lookup.count = 0 then
8495 --
8496 -- Build the cache
8497 --
8498 ben_elp_cache.elpeap_writecache
8499 (p_effective_date => p_effective_date,
8500 p_refresh_cache => p_refresh_cache);
8501 --
8502 end if;
8503 --
8504 -- Get the instance details
8505 --
8506 l_torrwnum := 0;
8507 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
8508 --
8509 -- Check if hashed value is already allocated
8510 --
8511 if g_cache_elpeap_lookup.exists(l_index) then
8512 --
8513 -- If it does exist make sure its the right one
8514 --
8515 if g_cache_elpeap_lookup(l_index).id <> p_eligy_prfl_id then
8516 --
8517 l_not_hash_found := false;
8518 --
8519 -- Loop until un-allocated has value is derived
8520 --
8521 while not l_not_hash_found loop
8522 --
8523 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
8524 --
8525 -- Check if the hash index exists, if not we can use it
8526 --
8527 -- Bug 13253435 when moved to next hash index checking whether that
8528 -- hash index 'id' is having value of p_eligy_prfl_id or not.
8529 -- If values are equal then existing from the loop
8530 if g_cache_elpeap_lookup(l_index).id = p_eligy_prfl_id then
8531 l_not_hash_found := true;
8532 exit;
8533 end if;
8534 -- Bug 13253435
8535
8536 if not g_cache_elpeap_lookup.exists(l_index) then
8537 --
8538 -- Lets store the hash value in the index
8539 --
8540 l_not_hash_found := true;
8541 exit;
8542 --
8543 else
8544 --
8545 l_not_hash_found := false;
8546 --
8547 end if;
8548 --
8549 end loop;
8550 --
8551 end if;
8552 --
8553 end if;
8554 --
8555 for l_insttorrw_num in g_cache_elpeap_lookup(l_index).starttorele_num ..
8556 g_cache_elpeap_lookup(l_index).endtorele_num loop
8557 --
8558 p_inst_set(l_torrwnum) := g_cache_elpeap_inst(l_insttorrw_num);
8559 l_torrwnum := l_torrwnum+1;
8560 --
8561 end loop;
8562 --
8563 p_inst_count := l_torrwnum;
8564 --
8565 exception
8566 --
8567 when no_data_found then
8568 --
8569 p_inst_count := 0;
8570 --
8571 end elpeap_getcacdets;
8572 --
8573 procedure elpepz_writecache
8574 (p_effective_date in date,
8575 p_refresh_cache in boolean default FALSE) is
8576 --
8577 l_proc varchar2(72) := 'elpepz_writecache';
8578 l_torrwnum pls_integer;
8579 l_prev_id number;
8580 l_id number;
8581 --
8582 cursor c_elpepz_look is
8583 select elp.eligy_prfl_id,
8584 elp.business_group_id
8585 from ben_eligy_prfl_f elp
8586 where p_effective_date
8587 between elp.effective_start_date
8588 and elp.effective_end_date
8589 and exists(select null
8590 from ben_elig_pstl_cd_r_rng_prte_f epz,
8591 ben_pstl_zip_rng_f rzr
8592 where epz.pstl_zip_rng_id = rzr.pstl_zip_rng_id
8593 and epz.business_group_id = rzr.business_group_id
8594 and p_effective_date
8595 between rzr.effective_start_date
8596 and rzr.effective_end_date
8597 and p_effective_date
8598 between epz.effective_start_date
8599 and epz.effective_end_date
8600 and epz.eligy_prfl_id = elp.eligy_prfl_id)
8601 order by elp.eligy_prfl_id;
8602 --
8603 cursor c_elpepz_inst is
8604 select epz.eligy_prfl_id,
8605 epz.elig_pstl_cd_r_rng_prte_id pk_id,
8606 'EPZ' short_code,
8607 epz.excld_flag,
8608 epz.criteria_score,
8609 epz.criteria_weight,
8610 rzr.from_value,
8611 rzr.to_value
8612 from ben_elig_pstl_cd_r_rng_prte_f epz,
8613 ben_pstl_zip_rng_f rzr
8614 where epz.pstl_zip_rng_id = rzr.pstl_zip_rng_id
8615 and epz.business_group_id = rzr.business_group_id
8616 and p_effective_date
8617 between rzr.effective_start_date
8618 and rzr.effective_end_date
8619 and p_effective_date
8620 between epz.effective_start_date
8621 and epz.effective_end_date
8622 order by epz.eligy_prfl_id,
8623 decode(epz.excld_flag,'Y',1,2),
8624 epz.ordr_num;
8625 --
8626 l_not_hash_found boolean;
8627 --
8628 begin
8629 --
8630 for objlook in c_elpepz_look loop
8631 --
8632 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
8636 if g_cache_elpepz_lookup.exists(l_id) then
8633 --
8634 -- Check if hashed value is already allocated
8635 --
8637 --
8638 l_not_hash_found := false;
8639 --
8640 -- Loop until un-allocated has value is derived
8641 --
8642 while not l_not_hash_found loop
8643 --
8644 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8645 --
8646 -- Check if the hash index exists, if not we can use it
8647 --
8648 if not g_cache_elpepz_lookup.exists(l_id) then
8649 --
8650 -- Lets store the hash value in the index
8651 --
8652 l_not_hash_found := true;
8653 exit;
8654 --
8655 else
8656 --
8657 l_not_hash_found := false;
8658 --
8659 end if;
8660 --
8661 end loop;
8662 --
8663 end if;
8664 --
8665 g_cache_elpepz_lookup(l_id).id := objlook.eligy_prfl_id;
8666 g_cache_elpepz_lookup(l_id).fk_id := objlook.business_group_id;
8667 --
8668 end loop;
8669 --
8670 l_torrwnum := 0;
8671 l_prev_id := -1;
8672 --
8673 for objinst in c_elpepz_inst loop
8674 --
8675 -- Populate the cache lookup details
8676 --
8677 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
8678 --
8679 -- Check if hashed value is already allocated
8680 --
8681 if g_cache_elpepz_lookup(l_id).id = objinst.eligy_prfl_id then
8682 --
8683 null;
8684 --
8685 else
8686 --
8687 loop
8688 --
8689 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8690 --
8691 if g_cache_elpepz_lookup(l_id).id = objinst.eligy_prfl_id then
8692 --
8693 exit;
8694 --
8695 end if;
8696 --
8697 end loop;
8698 --
8699 end if;
8700 --
8701 -- Check for first row
8702 --
8703 if l_prev_id = -1 then
8704 --
8705 g_cache_elpepz_lookup(l_id).starttorele_num := l_torrwnum;
8706 --
8707 elsif l_id <> l_prev_id then
8708 --
8709 g_cache_elpepz_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8710 g_cache_elpepz_lookup(l_id).starttorele_num := l_torrwnum;
8711 --
8712 end if;
8713 --
8714 -- Populate the cache instance details
8715 --
8716 g_cache_elpepz_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
8717 g_cache_elpepz_inst(l_torrwnum).pk_id := objinst.pk_id;
8718 g_cache_elpepz_inst(l_torrwnum).short_code := objinst.short_code;
8719 g_cache_elpepz_inst(l_torrwnum).criteria_score := objinst.criteria_score;
8720 g_cache_elpepz_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
8721 g_cache_elpepz_inst(l_torrwnum).excld_flag := objinst.excld_flag;
8722 g_cache_elpepz_inst(l_torrwnum).from_value := objinst.from_value;
8723 g_cache_elpepz_inst(l_torrwnum).to_value := objinst.to_value;
8724 --
8725 l_torrwnum := l_torrwnum+1;
8726 l_prev_id := l_id;
8727 --
8728 end loop;
8729 --
8730 g_cache_elpepz_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8731 --
8732 end elpepz_writecache;
8733 --
8734 procedure elpepz_getcacdets
8735 (p_effective_date in date,
8736 p_business_group_id in number,
8737 p_eligy_prfl_id in number,
8738 p_refresh_cache in boolean default FALSE,
8739 p_inst_set out nocopy ben_elp_cache.g_cache_elpepz_instor,
8740 p_inst_count out nocopy number) is
8741 --
8742 l_proc varchar2(72) := 'elpepz_getcacdets';
8743 l_torrwnum pls_integer;
8744 l_insttorrw_num pls_integer;
8745 l_index pls_integer;
8746 --
8747 l_not_hash_found boolean;
8748 --
8749 begin
8750 --
8751 -- Flush the cache
8752 --
8753 if p_refresh_cache then
8754 --
8755 g_cache_elpepz_lookup.delete;
8756 g_cache_elpepz_inst.delete;
8757 --
8758 end if;
8759 --
8760 -- Populate the global cache
8761 --
8762 if g_cache_elpepz_lookup.count = 0 then
8763 --
8764 -- Build the cache
8765 --
8766 ben_elp_cache.elpepz_writecache
8767 (p_effective_date => p_effective_date,
8768 p_refresh_cache => p_refresh_cache);
8769 --
8770 end if;
8771 --
8772 -- Get the instance details
8773 --
8774 l_torrwnum := 0;
8775 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
8776 --
8777 -- Check if hashed value is already allocated
8778 --
8779 if g_cache_elpepz_lookup.exists(l_index) then
8780 --
8781 -- If it does exist make sure its the right one
8782 --
8783 if g_cache_elpepz_lookup(l_index).id <> p_eligy_prfl_id then
8784 --
8785 l_not_hash_found := false;
8786 --
8787 -- Loop until un-allocated has value is derived
8788 --
8789 while not l_not_hash_found loop
8790 --
8791 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
8792 --
8793 -- Check if the hash index exists, if not we can use it
8794 --
8795 -- Bug 13253435 when moved to next hash index checking whether that
8796 -- hash index 'id' is having value of p_eligy_prfl_id or not.
8797 -- If values are equal then existing from the loop
8798 if g_cache_elpepz_lookup(l_index).id = p_eligy_prfl_id then
8799 l_not_hash_found := true;
8800 exit;
8801 end if;
8802 -- Bug 13253435
8806 -- Lets store the hash value in the index
8803
8804 if not g_cache_elpepz_lookup.exists(l_index) then
8805 --
8807 --
8808 l_not_hash_found := true;
8809 exit;
8810 --
8811 else
8812 --
8813 l_not_hash_found := false;
8814 --
8815 end if;
8816 --
8817 end loop;
8818 --
8819 end if;
8820 --
8821 end if;
8822 --
8823 for l_insttorrw_num in g_cache_elpepz_lookup(l_index).starttorele_num ..
8824 g_cache_elpepz_lookup(l_index).endtorele_num loop
8825 --
8826 p_inst_set(l_torrwnum) := g_cache_elpepz_inst(l_insttorrw_num);
8827 l_torrwnum := l_torrwnum+1;
8828 --
8829 end loop;
8830 --
8831 p_inst_count := l_torrwnum;
8832 --
8833 exception
8834 --
8835 when no_data_found then
8836 --
8837 p_inst_count := 0;
8838 --
8839 end elpepz_getcacdets;
8840 --
8841 procedure elpebn_writecache
8842 (p_effective_date in date,
8843 p_refresh_cache in boolean default FALSE) is
8844 --
8845 l_proc varchar2(72) := 'elpebn_writecache';
8846 l_torrwnum pls_integer;
8847 l_prev_id number;
8848 l_id number;
8849 --
8850 cursor c_elpebn_look is
8851 select elp.eligy_prfl_id,
8852 elp.business_group_id
8853 from ben_eligy_prfl_f elp
8854 where p_effective_date
8855 between elp.effective_start_date
8856 and elp.effective_end_date
8857 and exists(select null
8858 from ben_elig_benfts_grp_prte_f ebn
8859 where p_effective_date
8860 between ebn.effective_start_date
8861 and ebn.effective_end_date
8862 and ebn.eligy_prfl_id = elp.eligy_prfl_id)
8863 order by elp.eligy_prfl_id;
8864 --
8865 cursor c_elpebn_inst is
8866 select ebn.eligy_prfl_id,
8867 ebn.elig_benfts_grp_prte_id pk_id,
8868 'EBN' short_code,
8869 ebn.benfts_grp_id,
8870 ebn.excld_flag,
8871 ebn.criteria_score,
8872 ebn.criteria_weight
8873 from ben_elig_benfts_grp_prte_f ebn
8874 where p_effective_date
8875 between ebn.effective_start_date
8876 and ebn.effective_end_date
8877 order by ebn.eligy_prfl_id,
8878 decode(ebn.excld_flag,'Y',1,2),
8879 ebn.ordr_num;
8880 --
8881 l_not_hash_found boolean;
8882 --
8883 begin
8884 --
8885 for objlook in c_elpebn_look loop
8886 --
8887 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
8888 --
8889 -- Check if hashed value is already allocated
8890 --
8891 if g_cache_elpebn_lookup.exists(l_id) then
8892 --
8893 l_not_hash_found := false;
8894 --
8895 -- Loop until un-allocated has value is derived
8896 --
8897 while not l_not_hash_found loop
8898 --
8899 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8900 --
8901 -- Check if the hash index exists, if not we can use it
8902 --
8903 if not g_cache_elpebn_lookup.exists(l_id) then
8904 --
8905 -- Lets store the hash value in the index
8906 --
8907 l_not_hash_found := true;
8908 exit;
8909 --
8910 else
8911 --
8912 l_not_hash_found := false;
8913 --
8914 end if;
8915 --
8916 end loop;
8917 --
8918 end if;
8919 --
8920 g_cache_elpebn_lookup(l_id).id := objlook.eligy_prfl_id;
8921 g_cache_elpebn_lookup(l_id).fk_id := objlook.business_group_id;
8922 --
8923 end loop;
8924 --
8925 l_torrwnum := 0;
8926 l_prev_id := -1;
8927 --
8928 for objinst in c_elpebn_inst loop
8929 --
8930 -- Populate the cache lookup details
8931 --
8932 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
8933 --
8934 -- Check if hashed value is already allocated
8935 --
8936 if g_cache_elpebn_lookup(l_id).id = objinst.eligy_prfl_id then
8937 --
8938 null;
8939 --
8940 else
8941 --
8942 loop
8943 --
8944 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
8945 --
8946 if g_cache_elpebn_lookup(l_id).id = objinst.eligy_prfl_id then
8947 --
8948 exit;
8949 --
8950 end if;
8951 --
8952 end loop;
8953 --
8954 end if;
8955 --
8956 -- Check for first row
8957 --
8958 if l_prev_id = -1 then
8959 --
8960 g_cache_elpebn_lookup(l_id).starttorele_num := l_torrwnum;
8961 --
8962 elsif l_id <> l_prev_id then
8963 --
8964 g_cache_elpebn_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8965 g_cache_elpebn_lookup(l_id).starttorele_num := l_torrwnum;
8966 --
8967 end if;
8968 --
8969 -- Populate the cache instance details
8970 --
8971 g_cache_elpebn_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
8972 g_cache_elpebn_inst(l_torrwnum).pk_id := objinst.pk_id;
8973 g_cache_elpebn_inst(l_torrwnum).short_code := objinst.short_code;
8974 g_cache_elpebn_inst(l_torrwnum).criteria_score := objinst.criteria_score;
8975 g_cache_elpebn_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
8979 l_torrwnum := l_torrwnum+1;
8976 g_cache_elpebn_inst(l_torrwnum).benfts_grp_id := objinst.benfts_grp_id;
8977 g_cache_elpebn_inst(l_torrwnum).excld_flag := objinst.excld_flag;
8978 --
8980 l_prev_id := l_id;
8981 --
8982 end loop;
8983 --
8984 g_cache_elpebn_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
8985 --
8986 end elpebn_writecache;
8987 --
8988 procedure elpebn_getcacdets
8989 (p_effective_date in date,
8990 p_business_group_id in number,
8991 p_eligy_prfl_id in number,
8992 p_refresh_cache in boolean default FALSE,
8993 p_inst_set out nocopy ben_elp_cache.g_cache_elpebn_instor,
8994 p_inst_count out nocopy number) is
8995 --
8996 l_proc varchar2(72) := 'elpebn_getcacdets';
8997 l_torrwnum pls_integer;
8998 l_insttorrw_num pls_integer;
8999 l_index pls_integer;
9000 --
9001 l_not_hash_found boolean;
9002 --
9003 begin
9004 --
9005 -- Flush the cache
9006 --
9007 if p_refresh_cache then
9008 --
9009 g_cache_elpebn_lookup.delete;
9010 g_cache_elpebn_inst.delete;
9011 --
9012 end if;
9013 --
9014 -- Populate the global cache
9015 --
9016 if g_cache_elpebn_lookup.count = 0 then
9017 --
9018 -- Build the cache
9019 --
9020 ben_elp_cache.elpebn_writecache
9021 (p_effective_date => p_effective_date,
9022 p_refresh_cache => p_refresh_cache);
9023 --
9024 end if;
9025 --
9026 -- Get the instance details
9027 --
9028 l_torrwnum := 0;
9029 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
9030 --
9031 -- Check if hashed value is already allocated
9032 --
9033 if g_cache_elpebn_lookup.exists(l_index) then
9034 --
9035 -- If it does exist make sure its the right one
9036 --
9037 if g_cache_elpebn_lookup(l_index).id <> p_eligy_prfl_id then
9038 --
9039 l_not_hash_found := false;
9040 --
9041 -- Loop until un-allocated has value is derived
9042 --
9043 while not l_not_hash_found loop
9044 --
9045 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
9046 --
9047 -- Check if the hash index exists, if not we can use it
9048 --
9049 -- Bug 13253435 when moved to next hash index checking whether that
9050 -- hash index 'id' is having value of p_eligy_prfl_id or not.
9051 -- If values are equal then existing from the loop
9052 if g_cache_elpebn_lookup(l_index).id = p_eligy_prfl_id then
9053 l_not_hash_found := true;
9054 exit;
9055 end if;
9056 -- Bug 13253435
9057
9058 if not g_cache_elpebn_lookup.exists(l_index) then
9059 --
9060 -- Lets store the hash value in the index
9061 --
9062 l_not_hash_found := true;
9063 exit;
9064 --
9065 else
9066 --
9067 l_not_hash_found := false;
9068 --
9069 end if;
9070 --
9071 end loop;
9072 --
9073 end if;
9074 --
9075 end if;
9076 --
9077 for l_insttorrw_num in g_cache_elpebn_lookup(l_index).starttorele_num ..
9078 g_cache_elpebn_lookup(l_index).endtorele_num loop
9079 --
9080 p_inst_set(l_torrwnum) := g_cache_elpebn_inst(l_insttorrw_num);
9081 l_torrwnum := l_torrwnum+1;
9082 --
9083 end loop;
9084 --
9085 p_inst_count := l_torrwnum;
9086 --
9087 exception
9088 --
9089 when no_data_found then
9090 --
9091 p_inst_count := 0;
9092 --
9093 end elpebn_getcacdets;
9094 --
9095 procedure elpeln_writecache
9096 (p_effective_date in date,
9097 p_refresh_cache in boolean default FALSE) is
9098 --
9099 l_proc varchar2(72) := 'elpeln_writecache';
9100 l_torrwnum pls_integer;
9101 l_prev_id number;
9102 l_id number;
9103 --
9104 cursor c_elpeln_look is
9105 select elp.eligy_prfl_id,
9106 elp.business_group_id
9107 from ben_eligy_prfl_f elp
9108 where p_effective_date
9109 between elp.effective_start_date
9110 and elp.effective_end_date
9111 and exists(select null
9112 from ben_elig_lgl_enty_prte_f eln,
9113 hr_all_organization_units hao
9114 where eln.organization_id = hao.organization_id
9115 and eln.business_group_id = hao.business_group_id
9116 and p_effective_date
9117 between eln.effective_start_date
9118 and eln.effective_end_date
9119 and eln.eligy_prfl_id = elp.eligy_prfl_id)
9120 order by elp.eligy_prfl_id;
9121 --
9122 cursor c_elpeln_inst is
9123 select eln.eligy_prfl_id,
9124 eln.elig_lgl_enty_prte_id pk_id,
9125 'ELN' short_code,
9126 eln.excld_flag,
9127 eln.criteria_score,
9128 eln.criteria_weight,
9129 hao.name
9130 from ben_elig_lgl_enty_prte_f eln,
9131 hr_all_organization_units hao
9132 where eln.organization_id = hao.organization_id
9133 and eln.business_group_id = hao.business_group_id
9134 and p_effective_date
9135 between eln.effective_start_date
9136 and eln.effective_end_date
9137 order by eln.eligy_prfl_id,
9138 decode(eln.excld_flag,'Y',1,2),
9139 eln.ordr_num;
9140 --
9141 l_not_hash_found boolean;
9142 --
9143 begin
9144 --
9148 --
9145 for objlook in c_elpeln_look loop
9146 --
9147 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
9149 -- Check if hashed value is already allocated
9150 --
9151 if g_cache_elpeln_lookup.exists(l_id) then
9152 --
9153 l_not_hash_found := false;
9154 --
9155 -- Loop until un-allocated has value is derived
9156 --
9157 while not l_not_hash_found loop
9158 --
9159 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9160 --
9161 -- Check if the hash index exists, if not we can use it
9162 --
9163 if not g_cache_elpeln_lookup.exists(l_id) then
9164 --
9165 -- Lets store the hash value in the index
9166 --
9167 l_not_hash_found := true;
9168 exit;
9169 --
9170 else
9171 --
9172 l_not_hash_found := false;
9173 --
9174 end if;
9175 --
9176 end loop;
9177 --
9178 end if;
9179 --
9180 g_cache_elpeln_lookup(l_id).id := objlook.eligy_prfl_id;
9181 g_cache_elpeln_lookup(l_id).fk_id := objlook.business_group_id;
9182 --
9183 end loop;
9184 --
9185 l_torrwnum := 0;
9186 l_prev_id := -1;
9187 --
9188 for objinst in c_elpeln_inst loop
9189 --
9190 -- Populate the cache lookup details
9191 --
9192 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
9193 --
9194 -- Check if hashed value is already allocated
9195 --
9196 if g_cache_elpeln_lookup(l_id).id = objinst.eligy_prfl_id then
9197 --
9198 null;
9199 --
9200 else
9201 --
9202 loop
9203 --
9204 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9205 --
9206 if g_cache_elpeln_lookup(l_id).id = objinst.eligy_prfl_id then
9207 --
9208 exit;
9209 --
9210 end if;
9211 --
9212 end loop;
9213 --
9214 end if;
9215 --
9216 -- Check for first row
9217 --
9218 if l_prev_id = -1 then
9219 --
9220 g_cache_elpeln_lookup(l_id).starttorele_num := l_torrwnum;
9221 --
9222 elsif l_id <> l_prev_id then
9223 --
9224 g_cache_elpeln_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9225 g_cache_elpeln_lookup(l_id).starttorele_num := l_torrwnum;
9226 --
9227 end if;
9228 --
9229 -- Populate the cache instance details
9230 --
9231 g_cache_elpeln_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
9232 g_cache_elpeln_inst(l_torrwnum).pk_id := objinst.pk_id;
9233 g_cache_elpeln_inst(l_torrwnum).short_code := objinst.short_code;
9234 g_cache_elpeln_inst(l_torrwnum).criteria_score := objinst.criteria_score;
9235 g_cache_elpeln_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
9236 g_cache_elpeln_inst(l_torrwnum).excld_flag := objinst.excld_flag;
9237 g_cache_elpeln_inst(l_torrwnum).name := objinst.name;
9238 --
9239 l_torrwnum := l_torrwnum+1;
9240 l_prev_id := l_id;
9241 --
9242 end loop;
9243 --
9244 g_cache_elpeln_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9245 --
9246 end elpeln_writecache;
9247 --
9248 procedure elpeln_getcacdets
9249 (p_effective_date in date,
9250 p_business_group_id in number,
9251 p_eligy_prfl_id in number,
9252 p_refresh_cache in boolean default FALSE,
9253 p_inst_set out nocopy ben_elp_cache.g_cache_elpeln_instor,
9254 p_inst_count out nocopy number) is
9255 --
9256 l_proc varchar2(72) := 'elpeln_getcacdets';
9257 l_torrwnum pls_integer;
9258 l_insttorrw_num pls_integer;
9259 l_index pls_integer;
9260 --
9261 l_not_hash_found boolean;
9262 --
9263 begin
9264 --
9265 -- Flush the cache
9266 --
9267 if p_refresh_cache then
9268 --
9269 g_cache_elpeln_lookup.delete;
9270 g_cache_elpeln_inst.delete;
9271 --
9272 end if;
9273 --
9274 -- Populate the global cache
9275 --
9276 if g_cache_elpeln_lookup.count = 0 then
9277 --
9278 -- Build the cache
9279 --
9280 ben_elp_cache.elpeln_writecache
9281 (p_effective_date => p_effective_date,
9282 p_refresh_cache => p_refresh_cache);
9283 --
9284 end if;
9285 --
9286 -- Get the instance details
9287 --
9288 l_torrwnum := 0;
9289 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
9290 --
9291 -- Check if hashed value is already allocated
9292 --
9293 if g_cache_elpeln_lookup.exists(l_index) then
9294 --
9295 -- If it does exist make sure its the right one
9296 --
9297 if g_cache_elpeln_lookup(l_index).id <> p_eligy_prfl_id then
9298 --
9299 l_not_hash_found := false;
9300 --
9301 -- Loop until un-allocated has value is derived
9302 --
9303 while not l_not_hash_found loop
9304 --
9305 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
9306 --
9307 -- Check if the hash index exists, if not we can use it
9308 --
9309 -- Bug 13253435 when moved to next hash index checking whether that
9310 -- hash index 'id' is having value of p_eligy_prfl_id or not.
9311 -- If values are equal then existing from the loop
9312 if g_cache_elpeln_lookup(l_index).id = p_eligy_prfl_id then
9313 l_not_hash_found := true;
9314 exit;
9318 if not g_cache_elpeln_lookup.exists(l_index) then
9315 end if;
9316 -- Bug 13253435
9317
9319 --
9320 -- Lets store the hash value in the index
9321 --
9322 l_not_hash_found := true;
9323 exit;
9324 --
9325 else
9326 --
9327 l_not_hash_found := false;
9328 --
9329 end if;
9330 --
9331 end loop;
9332 --
9333 end if;
9334 --
9335 end if;
9336 --
9337 for l_insttorrw_num in g_cache_elpeln_lookup(l_index).starttorele_num ..
9338 g_cache_elpeln_lookup(l_index).endtorele_num loop
9339 --
9340 p_inst_set(l_torrwnum) := g_cache_elpeln_inst(l_insttorrw_num);
9341 l_torrwnum := l_torrwnum+1;
9342 --
9343 end loop;
9344 --
9345 p_inst_count := l_torrwnum;
9346 --
9347 exception
9348 --
9349 when no_data_found then
9350 --
9351 p_inst_count := 0;
9352 --
9353 end elpeln_getcacdets;
9354 --
9355 procedure elpepp_writecache
9356 (p_effective_date in date,
9357 p_refresh_cache in boolean default FALSE) is
9358 --
9359 l_proc varchar2(72) := 'elpepp_writecache';
9360 l_torrwnum pls_integer;
9361 l_prev_id number;
9362 l_id number;
9363 --
9364 cursor c_elpepp_look is
9365 select elp.eligy_prfl_id,
9366 elp.business_group_id
9367 from ben_eligy_prfl_f elp
9368 where p_effective_date
9369 between elp.effective_start_date
9370 and elp.effective_end_date
9371 and exists(select null
9372 from ben_elig_prtt_anthr_pl_prte_f epp
9373 where p_effective_date
9374 between epp.effective_start_date
9375 and epp.effective_end_date
9376 and epp.eligy_prfl_id = elp.eligy_prfl_id)
9377 order by elp.eligy_prfl_id;
9378 --
9379 cursor c_elpepp_inst is
9380 select epp.eligy_prfl_id,
9381 epp.pl_id,
9382 epp.excld_flag
9383 from ben_elig_prtt_anthr_pl_prte_f epp
9384 where p_effective_date
9385 between epp.effective_start_date
9386 and epp.effective_end_date
9387 order by epp.eligy_prfl_id,
9388 decode(epp.excld_flag,'Y',1,2),
9389 epp.ordr_num;
9390 --
9391 l_not_hash_found boolean;
9392 --
9393 begin
9394 --
9395 for objlook in c_elpepp_look loop
9396 --
9397 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
9398 --
9399 -- Check if hashed value is already allocated
9400 --
9401 if g_cache_elpepp_lookup.exists(l_id) then
9402 --
9403 l_not_hash_found := false;
9404 --
9405 -- Loop until un-allocated has value is derived
9406 --
9407 while not l_not_hash_found loop
9408 --
9409 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9410 --
9411 -- Check if the hash index exists, if not we can use it
9412 --
9413 if not g_cache_elpepp_lookup.exists(l_id) then
9414 --
9415 -- Lets store the hash value in the index
9416 --
9417 l_not_hash_found := true;
9418 exit;
9419 --
9420 else
9421 --
9422 l_not_hash_found := false;
9423 --
9424 end if;
9425 --
9426 end loop;
9427 --
9428 end if;
9429 --
9430 g_cache_elpepp_lookup(l_id).id := objlook.eligy_prfl_id;
9431 g_cache_elpepp_lookup(l_id).fk_id := objlook.business_group_id;
9432 --
9433 end loop;
9434 --
9435 l_torrwnum := 0;
9436 l_prev_id := -1;
9437 --
9438 for objinst in c_elpepp_inst loop
9439 --
9440 -- Populate the cache lookup details
9441 --
9442 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
9443 --
9444 -- Check if hashed value is already allocated
9445 --
9446 if g_cache_elpepp_lookup(l_id).id = objinst.eligy_prfl_id then
9447 --
9448 null;
9449 --
9450 else
9451 --
9452 loop
9453 --
9454 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9455 --
9456 if g_cache_elpepp_lookup(l_id).id = objinst.eligy_prfl_id then
9457 --
9458 exit;
9459 --
9460 end if;
9461 --
9462 end loop;
9463 --
9464 end if;
9465 --
9466 -- Check for first row
9467 --
9468 if l_prev_id = -1 then
9469 --
9470 g_cache_elpepp_lookup(l_id).starttorele_num := l_torrwnum;
9471 --
9472 elsif l_id <> l_prev_id then
9473 --
9474 g_cache_elpepp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9475 g_cache_elpepp_lookup(l_id).starttorele_num := l_torrwnum;
9476 --
9477 end if;
9478 --
9479 -- Populate the cache instance details
9480 --
9481 g_cache_elpepp_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
9482 g_cache_elpepp_inst(l_torrwnum).pl_id := objinst.pl_id;
9483 g_cache_elpepp_inst(l_torrwnum).excld_flag := objinst.excld_flag;
9484 --
9485 l_torrwnum := l_torrwnum+1;
9486 l_prev_id := l_id;
9487 --
9488 end loop;
9489 --
9490 g_cache_elpepp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9491 --
9492 end elpepp_writecache;
9493 --
9494 procedure elpepp_getcacdets
9498 p_refresh_cache in boolean default FALSE,
9495 (p_effective_date in date,
9496 p_business_group_id in number,
9497 p_eligy_prfl_id in number,
9499 p_inst_set out nocopy ben_elp_cache.g_cache_elpepp_instor,
9500 p_inst_count out nocopy number) is
9501 --
9502 l_proc varchar2(72) := 'elpepp_getcacdets';
9503 l_torrwnum pls_integer;
9504 l_insttorrw_num pls_integer;
9505 l_index pls_integer;
9506 --
9507 l_not_hash_found boolean;
9508 --
9509 begin
9510 --
9511 -- Flush the cache
9512 --
9513 if p_refresh_cache then
9514 --
9515 g_cache_elpepp_lookup.delete;
9516 g_cache_elpepp_inst.delete;
9517 --
9518 end if;
9519 --
9520 -- Populate the global cache
9521 --
9522 if g_cache_elpepp_lookup.count = 0 then
9523 --
9524 -- Build the cache
9525 --
9526 ben_elp_cache.elpepp_writecache
9527 (p_effective_date => p_effective_date,
9528 p_refresh_cache => p_refresh_cache);
9529 --
9530 end if;
9531 --
9532 -- Get the instance details
9533 --
9534 l_torrwnum := 0;
9535 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
9536 --
9537 -- Check if hashed value is already allocated
9538 --
9539 if g_cache_elpepp_lookup.exists(l_index) then
9540 --
9541 -- If it does exist make sure its the right one
9542 --
9543 if g_cache_elpepp_lookup(l_index).id <> p_eligy_prfl_id then
9544 --
9545 l_not_hash_found := false;
9546 --
9547 -- Loop until un-allocated has value is derived
9548 --
9549 while not l_not_hash_found loop
9550 --
9551 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
9552 --
9553 -- Check if the hash index exists, if not we can use it
9554 --
9555 -- Bug 13253435 when moved to next hash index checking whether that
9556 -- hash index 'id' is having value of p_eligy_prfl_id or not.
9557 -- If values are equal then existing from the loop
9558 if g_cache_elpepp_lookup(l_index).id = p_eligy_prfl_id then
9559 l_not_hash_found := true;
9560 exit;
9561 end if;
9562 -- Bug 13253435
9563
9564 if not g_cache_elpepp_lookup.exists(l_index) then
9565 --
9566 -- Lets store the hash value in the index
9567 --
9568 l_not_hash_found := true;
9569 exit;
9570 --
9571 else
9572 --
9573 l_not_hash_found := false;
9574 --
9575 end if;
9576 --
9577 end loop;
9578 --
9579 end if;
9580 --
9581 end if;
9582 --
9583 for l_insttorrw_num in g_cache_elpepp_lookup(l_index).starttorele_num ..
9584 g_cache_elpepp_lookup(l_index).endtorele_num loop
9585 --
9586 p_inst_set(l_torrwnum) := g_cache_elpepp_inst(l_insttorrw_num);
9587 l_torrwnum := l_torrwnum+1;
9588 --
9589 end loop;
9590 --
9591 p_inst_count := l_torrwnum;
9592 --
9593 exception
9594 --
9595 when no_data_found then
9596 --
9597 p_inst_count := 0;
9598 --
9599 end elpepp_getcacdets;
9600 --
9601 procedure elpeoy_writecache
9602 (p_effective_date in date,
9603 p_refresh_cache in boolean default FALSE) is
9604 --
9605 l_proc varchar2(72) := 'elpeoy_writecache';
9606 l_torrwnum pls_integer;
9607 l_prev_id number;
9608 l_id number;
9609 --
9610 cursor c_elpeoy_look is
9611 select elp.eligy_prfl_id,
9612 elp.business_group_id
9613 from ben_eligy_prfl_f elp
9614 where p_effective_date
9615 between elp.effective_start_date
9616 and elp.effective_end_date
9617 and exists(select null
9618 from ben_elig_othr_ptip_prte_f eoy
9619 where p_effective_date
9620 between eoy.effective_start_date
9621 and eoy.effective_end_date
9622 and eoy.eligy_prfl_id = elp.eligy_prfl_id)
9623 order by elp.eligy_prfl_id;
9624 --
9625 cursor c_elpeoy_inst is
9626 select eoy.eligy_prfl_id,
9627 eoy.ptip_id,
9628 eoy.only_pls_subj_cobra_flag,
9629 eoy.excld_flag
9630 from ben_elig_othr_ptip_prte_f eoy
9631 where p_effective_date
9632 between eoy.effective_start_date
9633 and eoy.effective_end_date
9634 order by eoy.eligy_prfl_id,
9635 decode(eoy.excld_flag,'Y',1,2),
9636 eoy.ordr_num;
9637 --
9638 l_not_hash_found boolean;
9639 --
9640 begin
9641 --
9642 for objlook in c_elpeoy_look loop
9643 --
9644 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
9645 --
9646 -- Check if hashed value is already allocated
9647 --
9648 if g_cache_elpeoy_lookup.exists(l_id) then
9649 --
9650 l_not_hash_found := false;
9651 --
9652 -- Loop until un-allocated has value is derived
9653 --
9654 while not l_not_hash_found loop
9655 --
9656 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9657 --
9658 -- Check if the hash index exists, if not we can use it
9659 --
9660 if not g_cache_elpeoy_lookup.exists(l_id) then
9661 --
9665 exit;
9662 -- Lets store the hash value in the index
9663 --
9664 l_not_hash_found := true;
9666 --
9667 else
9668 --
9669 l_not_hash_found := false;
9670 --
9671 end if;
9672 --
9673 end loop;
9674 --
9675 end if;
9676 --
9677 g_cache_elpeoy_lookup(l_id).id := objlook.eligy_prfl_id;
9678 g_cache_elpeoy_lookup(l_id).fk_id := objlook.business_group_id;
9679 --
9680 end loop;
9681 --
9682 l_torrwnum := 0;
9683 l_prev_id := -1;
9684 --
9685 for objinst in c_elpeoy_inst loop
9686 --
9687 -- Populate the cache lookup details
9688 --
9689 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
9690 --
9691 -- Check if hashed value is already allocated
9692 --
9693 if g_cache_elpeoy_lookup(l_id).id = objinst.eligy_prfl_id then
9694 --
9695 null;
9696 --
9697 else
9698 --
9699 loop
9700 --
9701 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9702 --
9703 if g_cache_elpeoy_lookup(l_id).id = objinst.eligy_prfl_id then
9704 --
9705 exit;
9706 --
9707 end if;
9708 --
9709 end loop;
9710 --
9711 end if;
9712 --
9713 -- Check for first row
9714 --
9715 if l_prev_id = -1 then
9716 --
9717 g_cache_elpeoy_lookup(l_id).starttorele_num := l_torrwnum;
9718 --
9719 elsif l_id <> l_prev_id then
9720 --
9721 g_cache_elpeoy_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9722 g_cache_elpeoy_lookup(l_id).starttorele_num := l_torrwnum;
9723 --
9724 end if;
9725 --
9726 -- Populate the cache instance details
9727 --
9728 g_cache_elpeoy_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
9729 g_cache_elpeoy_inst(l_torrwnum).ptip_id := objinst.ptip_id;
9730 g_cache_elpeoy_inst(l_torrwnum).only_pls_subj_cobra_flag :=
9731 objinst.only_pls_subj_cobra_flag;
9732 g_cache_elpeoy_inst(l_torrwnum).excld_flag := objinst.excld_flag;
9733 --
9734 l_torrwnum := l_torrwnum+1;
9735 l_prev_id := l_id;
9736 --
9737 end loop;
9738 --
9739 g_cache_elpeoy_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9740 --
9741 end elpeoy_writecache;
9742 --
9743 procedure elpeoy_getcacdets
9744 (p_effective_date in date,
9745 p_business_group_id in number,
9746 p_eligy_prfl_id in number,
9747 p_refresh_cache in boolean default FALSE,
9748 p_inst_set out nocopy ben_elp_cache.g_cache_elpeoy_instor,
9749 p_inst_count out nocopy number) is
9750 --
9751 l_proc varchar2(72) := 'elpeoy_getcacdets';
9752 l_torrwnum pls_integer;
9753 l_insttorrw_num pls_integer;
9754 l_index pls_integer;
9755 --
9756 l_not_hash_found boolean;
9757 --
9758 begin
9759 --
9760 -- Flush the cache
9761 --
9762 if p_refresh_cache then
9763 --
9764 g_cache_elpeoy_lookup.delete;
9765 g_cache_elpeoy_inst.delete;
9766 --
9767 end if;
9768 --
9769 -- Populate the global cache
9770 --
9771 if g_cache_elpeoy_lookup.count = 0 then
9772 --
9773 -- Build the cache
9774 --
9775 ben_elp_cache.elpeoy_writecache
9776 (p_effective_date => p_effective_date,
9777 p_refresh_cache => p_refresh_cache);
9778 --
9779 end if;
9780 --
9781 -- Get the instance details
9782 --
9783 l_torrwnum := 0;
9784 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
9785 --
9786 -- Check if hashed value is already allocated
9787 --
9788 if g_cache_elpeoy_lookup.exists(l_index) then
9789 --
9790 -- If it does exist make sure its the right one
9791 --
9792 if g_cache_elpeoy_lookup(l_index).id <> p_eligy_prfl_id then
9793 --
9794 l_not_hash_found := false;
9795 --
9796 -- Loop until un-allocated has value is derived
9797 --
9798 while not l_not_hash_found loop
9799 --
9800 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
9801 --
9802 -- Check if the hash index exists, if not we can use it
9803 --
9804 -- Bug 13253435 when moved to next hash index checking whether that
9805 -- hash index 'id' is having value of p_eligy_prfl_id or not.
9806 -- If values are equal then existing from the loop
9807 if g_cache_elpeoy_lookup(l_index).id = p_eligy_prfl_id then
9808 l_not_hash_found := true;
9809 exit;
9810 end if;
9811 -- Bug 13253435
9812
9813 if not g_cache_elpeoy_lookup.exists(l_index) then
9814 --
9815 -- Lets store the hash value in the index
9816 --
9817 l_not_hash_found := true;
9818 exit;
9819 --
9820 else
9821 --
9822 l_not_hash_found := false;
9823 --
9824 end if;
9825 --
9826 end loop;
9827 --
9828 end if;
9829 --
9830 end if;
9831 --
9832 for l_insttorrw_num in g_cache_elpeoy_lookup(l_index).starttorele_num ..
9833 g_cache_elpeoy_lookup(l_index).endtorele_num loop
9837 --
9834 --
9835 p_inst_set(l_torrwnum) := g_cache_elpeoy_inst(l_insttorrw_num);
9836 l_torrwnum := l_torrwnum+1;
9838 end loop;
9839 --
9840 p_inst_count := l_torrwnum;
9841 --
9842 exception
9843 --
9844 when no_data_found then
9845 --
9846 p_inst_count := 0;
9847 --
9848 end elpeoy_getcacdets;
9849 --
9850 /************************************************/
9851 procedure elpetd_writecache
9852 (p_effective_date in date,
9853 p_refresh_cache in boolean default FALSE) is
9854 --
9855 l_proc varchar2(72) := 'elpetd_writecache';
9856 l_torrwnum pls_integer;
9857 l_prev_id number;
9858 l_id number;
9859 --
9860 cursor c_elpetd_look is
9861 select elp.eligy_prfl_id,
9862 elp.business_group_id
9863 from ben_eligy_prfl_f elp
9864 where p_effective_date
9865 between elp.effective_start_date
9866 and elp.effective_end_date
9867 and exists(select null
9868 from ben_elig_dpnt_othr_ptip_f etd
9869 where p_effective_date
9870 between etd.effective_start_date
9871 and etd.effective_end_date
9872 and etd.eligy_prfl_id = elp.eligy_prfl_id)
9873 order by elp.eligy_prfl_id;
9874 --
9875 cursor c_elpetd_inst is
9876 select etd.eligy_prfl_id,
9877 etd.ptip_id,
9878 --etd.only_pls_subj_cobra_flag,
9879 etd.excld_flag
9880 from ben_elig_dpnt_othr_ptip_f etd
9881 where p_effective_date
9882 between etd.effective_start_date
9883 and etd.effective_end_date
9884 order by etd.eligy_prfl_id,
9885 decode(etd.excld_flag,'Y',1,2),
9886 etd.ordr_num;
9887 --
9888 l_not_hash_found boolean;
9889 --
9890 begin
9891 --
9892 for objlook in c_elpetd_look loop
9893 --
9894 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
9895 --
9896 -- Check if hashed value is already allocated
9897 --
9898 if g_cache_elpetd_lookup.exists(l_id) then
9899 --
9900 l_not_hash_found := false;
9901 --
9902 -- Loop until un-allocated has value is derived
9903 --
9904 while not l_not_hash_found loop
9905 --
9906 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9907 --
9908 -- Check if the hash index exists, if not we can use it
9909 --
9910 if not g_cache_elpetd_lookup.exists(l_id) then
9911 --
9912 -- Lets store the hash value in the index
9913 --
9914 l_not_hash_found := true;
9915 exit;
9916 --
9917 else
9918 --
9919 l_not_hash_found := false;
9920 --
9921 end if;
9922 --
9923 end loop;
9924 --
9925 end if;
9926 --
9927 g_cache_elpetd_lookup(l_id).id := objlook.eligy_prfl_id;
9928 g_cache_elpetd_lookup(l_id).fk_id := objlook.business_group_id;
9929 --
9930 end loop;
9931 --
9932 l_torrwnum := 0;
9933 l_prev_id := -1;
9934 --
9935 for objinst in c_elpetd_inst loop
9936 --
9937 -- Populate the cache lookup details
9938 --
9939 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
9940 --
9941 -- Check if hashed value is already allocated
9942 --
9943 if g_cache_elpetd_lookup(l_id).id = objinst.eligy_prfl_id then
9944 --
9945 null;
9946 --
9947 else
9948 --
9949 loop
9950 --
9951 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
9952 --
9953 if g_cache_elpetd_lookup(l_id).id = objinst.eligy_prfl_id then
9954 --
9955 exit;
9956 --
9957 end if;
9958 --
9959 end loop;
9960 --
9961 end if;
9962 --
9963 -- Check for first row
9964 --
9965 if l_prev_id = -1 then
9966 --
9967 g_cache_elpetd_lookup(l_id).starttorele_num := l_torrwnum;
9968 --
9969 elsif l_id <> l_prev_id then
9970 --
9971 g_cache_elpetd_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9972 g_cache_elpetd_lookup(l_id).starttorele_num := l_torrwnum;
9973 --
9974 end if;
9975 --
9976 -- Populate the cache instance details
9977 --
9978 g_cache_elpetd_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
9979 g_cache_elpetd_inst(l_torrwnum).ptip_id := objinst.ptip_id;
9980 -- g_cache_elpetd_inst(l_torrwnum).only_pls_subj_cobra_flag :=
9981 -- objinst.only_pls_subj_cobra_flag;
9982 g_cache_elpetd_inst(l_torrwnum).excld_flag := objinst.excld_flag;
9983 --
9984 l_torrwnum := l_torrwnum+1;
9985 l_prev_id := l_id;
9986 --
9987 end loop;
9988 --
9989 g_cache_elpetd_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
9990 --
9991 end elpetd_writecache;
9992 --
9993 procedure elpetd_getcacdets
9994 (p_effective_date in date,
9995 p_business_group_id in number,
9996 p_eligy_prfl_id in number,
9997 p_refresh_cache in boolean default FALSE,
9998 p_inst_set out nocopy ben_elp_cache.g_cache_elpetd_instor,
9999 p_inst_count out nocopy number) is
10000 --
10001 l_proc varchar2(72) := 'elpetd_getcacdets';
10002 l_torrwnum pls_integer;
10003 l_insttorrw_num pls_integer;
10004 l_index pls_integer;
10005 --
10009 --
10006 l_not_hash_found boolean;
10007 --
10008 begin
10010 -- Flush the cache
10011 --
10012 if p_refresh_cache then
10013 --
10014 g_cache_elpetd_lookup.delete;
10015 g_cache_elpetd_inst.delete;
10016 --
10017 end if;
10018 --
10019 -- Populate the global cache
10020 --
10021 if g_cache_elpetd_lookup.count = 0 then
10022 --
10023 -- Build the cache
10024 --
10025 ben_elp_cache.elpetd_writecache
10026 (p_effective_date => p_effective_date,
10027 p_refresh_cache => p_refresh_cache);
10028 --
10029 end if;
10030 --
10031 -- Get the instance details
10032 --
10033 l_torrwnum := 0;
10034 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
10035 --
10036 -- Check if hashed value is already allocated
10037 --
10038 if g_cache_elpetd_lookup.exists(l_index) then
10039 --
10040 -- If it does exist make sure its the right one
10041 --
10042 if g_cache_elpetd_lookup(l_index).id <> p_eligy_prfl_id then
10043 --
10044 l_not_hash_found := false;
10045 --
10046 -- Loop until un-allocated has value is derived
10047 --
10048 while not l_not_hash_found loop
10052 --
10049 --
10050 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index)
10051 ;
10053 -- Check if the hash index exists, if not we can use it
10054 --
10055 -- Bug 13253435 when moved to next hash index checking whether that
10056 -- hash index 'id' is having value of p_eligy_prfl_id or not.
10057 -- If values are equal then existing from the loop
10058 if g_cache_elpetd_lookup(l_index).id = p_eligy_prfl_id then
10059 l_not_hash_found := true;
10060 exit;
10061 end if;
10062 -- Bug 13253435
10063
10064 if not g_cache_elpetd_lookup.exists(l_index) then
10065 --
10066 -- Lets store the hash value in the index
10067 --
10068 l_not_hash_found := true;
10069 exit;
10070 --
10071 else
10072 --
10073 l_not_hash_found := false;
10074 --
10075 end if;
10076 --
10077 end loop;
10078 --
10079 end if;
10080 --
10081 end if;
10082 --
10083 for l_insttorrw_num in g_cache_elpetd_lookup(l_index).starttorele_num ..
10084 g_cache_elpetd_lookup(l_index).endtorele_num loop
10085 --
10086 p_inst_set(l_torrwnum) := g_cache_elpetd_inst(l_insttorrw_num);
10087 l_torrwnum := l_torrwnum+1;
10088 --
10089 end loop;
10090 --
10091 p_inst_count := l_torrwnum;
10092 --
10093 exception
10094 --
10095 when no_data_found then
10096 --
10097 p_inst_count := 0;
10098 --
10099 end elpetd_getcacdets;
10100 --
10101 /************************************************/
10102 procedure elpeno_writecache
10103 (p_effective_date in date,
10104 p_refresh_cache in boolean default FALSE) is
10105 --
10106 l_proc varchar2(72) := 'elpeno_writecache';
10107 l_torrwnum pls_integer;
10108 l_prev_id number;
10109 l_id number;
10110 --
10111 cursor c_elpeno_look is
10112 select elp.eligy_prfl_id,
10113 elp.business_group_id
10114 from ben_eligy_prfl_f elp
10115 where p_effective_date
10116 between elp.effective_start_date
10117 and elp.effective_end_date
10118 and exists(select null
10119 from ben_elig_no_othr_cvg_prte_f eno
10120 where p_effective_date
10121 between eno.effective_start_date
10122 and eno.effective_end_date
10123 and eno.eligy_prfl_id = elp.eligy_prfl_id)
10124 order by elp.eligy_prfl_id;
10125 --
10126 cursor c_elpeno_inst is
10127 select eno.eligy_prfl_id,
10128 eno.coord_ben_no_cvg_flag
10129 from ben_elig_no_othr_cvg_prte_f eno
10130 where p_effective_date
10131 between eno.effective_start_date
10132 and eno.effective_end_date
10133 order by eno.eligy_prfl_id;
10134 --
10135 l_not_hash_found boolean;
10136 --
10137 begin
10138 --
10139 for objlook in c_elpeno_look loop
10140 --
10141 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
10142 --
10143 -- Check if hashed value is already allocated
10144 --
10145 if g_cache_elpeno_lookup.exists(l_id) then
10146 --
10150 --
10147 l_not_hash_found := false;
10148 --
10149 -- Loop until un-allocated has value is derived
10151 while not l_not_hash_found loop
10152 --
10153 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10154 --
10155 -- Check if the hash index exists, if not we can use it
10156 --
10157 if not g_cache_elpeno_lookup.exists(l_id) then
10158 --
10159 -- Lets store the hash value in the index
10160 --
10161 l_not_hash_found := true;
10162 exit;
10163 --
10164 else
10165 --
10166 l_not_hash_found := false;
10167 --
10168 end if;
10169 --
10170 end loop;
10171 --
10172 end if;
10173 --
10174 g_cache_elpeno_lookup(l_id).id := objlook.eligy_prfl_id;
10175 g_cache_elpeno_lookup(l_id).fk_id := objlook.business_group_id;
10176 --
10177 end loop;
10178 --
10179 l_torrwnum := 0;
10180 l_prev_id := -1;
10181 --
10182 for objinst in c_elpeno_inst loop
10183 --
10184 -- Populate the cache lookup details
10185 --
10186 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
10187 --
10188 -- Check if hashed value is already allocated
10189 --
10190 if g_cache_elpeno_lookup(l_id).id = objinst.eligy_prfl_id then
10191 --
10192 null;
10193 --
10194 else
10195 --
10196 loop
10197 --
10198 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10199 --
10200 if g_cache_elpeno_lookup(l_id).id = objinst.eligy_prfl_id then
10201 --
10202 exit;
10203 --
10204 end if;
10205 --
10206 end loop;
10207 --
10208 end if;
10209 --
10210 -- Check for first row
10211 --
10212 if l_prev_id = -1 then
10213 --
10214 g_cache_elpeno_lookup(l_id).starttorele_num := l_torrwnum;
10215 --
10216 elsif l_id <> l_prev_id then
10217 --
10218 g_cache_elpeno_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10219 g_cache_elpeno_lookup(l_id).starttorele_num := l_torrwnum;
10220 --
10221 end if;
10222 --
10223 -- Populate the cache instance details
10224 --
10225 g_cache_elpeno_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
10226 g_cache_elpeno_inst(l_torrwnum).coord_ben_no_cvg_flag :=
10227 objinst.coord_ben_no_cvg_flag;
10228 --
10229 l_torrwnum := l_torrwnum+1;
10230 l_prev_id := l_id;
10231 --
10232 end loop;
10233 --
10234 g_cache_elpeno_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10235 --
10236 end elpeno_writecache;
10237 --
10238 procedure elpeno_getcacdets
10239 (p_effective_date in date,
10240 p_business_group_id in number,
10241 p_eligy_prfl_id in number,
10242 p_refresh_cache in boolean default FALSE,
10243 p_inst_set out nocopy ben_elp_cache.g_cache_elpeno_instor,
10244 p_inst_count out nocopy number) is
10245 --
10246 l_proc varchar2(72) := 'elpeno_getcacdets';
10247 l_torrwnum pls_integer;
10248 l_insttorrw_num pls_integer;
10249 l_index pls_integer;
10250 --
10251 l_not_hash_found boolean;
10252 --
10253 begin
10254 --
10255 -- Flush the cache
10256 --
10257 if p_refresh_cache then
10258 --
10259 g_cache_elpeno_lookup.delete;
10260 g_cache_elpeno_inst.delete;
10261 --
10262 end if;
10263 --
10264 -- Populate the global cache
10265 --
10266 if g_cache_elpeno_lookup.count = 0 then
10267 --
10268 -- Build the cache
10269 --
10270 ben_elp_cache.elpeno_writecache
10271 (p_effective_date => p_effective_date,
10272 p_refresh_cache => p_refresh_cache);
10273 --
10274 end if;
10275 --
10276 -- Get the instance details
10277 --
10278 l_torrwnum := 0;
10279 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
10280 --
10281 -- Check if hashed value is already allocated
10282 --
10283 if g_cache_elpeno_lookup.exists(l_index) then
10284 --
10285 -- If it does exist make sure its the right one
10286 --
10287 if g_cache_elpeno_lookup(l_index).id <> p_eligy_prfl_id then
10288 --
10289 l_not_hash_found := false;
10290 --
10291 -- Loop until un-allocated has value is derived
10292 --
10293 while not l_not_hash_found loop
10294 --
10295 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
10296 --
10297 -- Check if the hash index exists, if not we can use it
10298 --
10299 -- Bug 13253435 when moved to next hash index checking whether that
10300 -- hash index 'id' is having value of p_eligy_prfl_id or not.
10301 -- If values are equal then existing from the loop
10302 if g_cache_elpeno_lookup(l_index).id = p_eligy_prfl_id then
10303 l_not_hash_found := true;
10304 exit;
10305 end if;
10306 -- Bug 13253435
10307
10308 if not g_cache_elpeno_lookup.exists(l_index) then
10309 --
10310 -- Lets store the hash value in the index
10311 --
10312 l_not_hash_found := true;
10313 exit;
10314 --
10315 else
10316 --
10317 l_not_hash_found := false;
10318 --
10322 --
10319 end if;
10320 --
10321 end loop;
10323 end if;
10324 --
10325 end if;
10326 --
10327 for l_insttorrw_num in g_cache_elpeno_lookup(l_index).starttorele_num ..
10328 g_cache_elpeno_lookup(l_index).endtorele_num loop
10329 --
10330 p_inst_set(l_torrwnum) := g_cache_elpeno_inst(l_insttorrw_num);
10331 l_torrwnum := l_torrwnum+1;
10332 --
10333 end loop;
10334 --
10335 p_inst_count := l_torrwnum;
10336 --
10337 exception
10338 --
10339 when no_data_found then
10340 --
10341 p_inst_count := 0;
10342 --
10343 end elpeno_getcacdets;
10344 --
10345 procedure elpeep_writecache
10346 (p_effective_date in date,
10347 p_refresh_cache in boolean default FALSE) is
10348 --
10349 l_proc varchar2(72) := 'elpeep_writecache';
10350 l_torrwnum pls_integer;
10351 l_prev_id number;
10352 l_id number;
10353 --
10354 cursor c_elpeep_look is
10355 select elp.eligy_prfl_id,
10356 elp.business_group_id
10357 from ben_eligy_prfl_f elp
10358 where p_effective_date
10359 between elp.effective_start_date
10360 and elp.effective_end_date
10361 and exists(select null
10362 from ben_elig_enrld_anthr_pl_f eep
10363 where p_effective_date
10364 between eep.effective_start_date
10365 and eep.effective_end_date
10366 and eep.eligy_prfl_id = elp.eligy_prfl_id)
10367 order by elp.eligy_prfl_id;
10368 --
10369 cursor c_elpeep_inst is
10370 select eep.eligy_prfl_id,
10371 eep.pl_id,
10372 eep.enrl_det_dt_cd,
10373 eep.excld_flag
10374 from ben_elig_enrld_anthr_pl_f eep
10375 where p_effective_date
10376 between eep.effective_start_date
10377 and eep.effective_end_date
10378 order by eep.eligy_prfl_id,
10379 decode(eep.excld_flag,'Y',1,2),
10380 eep.ordr_num;
10381 --
10382 l_not_hash_found boolean;
10383 --
10384 begin
10385 --
10386 for objlook in c_elpeep_look loop
10387 --
10388 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
10389 --
10390 -- Check if hashed value is already allocated
10391 --
10392 if g_cache_elpeep_lookup.exists(l_id) then
10393 --
10394 l_not_hash_found := false;
10395 --
10396 -- Loop until un-allocated has value is derived
10397 --
10398 while not l_not_hash_found loop
10399 --
10400 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10401 --
10402 -- Check if the hash index exists, if not we can use it
10403 --
10404 if not g_cache_elpeep_lookup.exists(l_id) then
10405 --
10406 -- Lets store the hash value in the index
10407 --
10408 l_not_hash_found := true;
10409 exit;
10410 --
10411 else
10412 --
10413 l_not_hash_found := false;
10414 --
10415 end if;
10416 --
10417 end loop;
10418 --
10419 end if;
10420 --
10421 g_cache_elpeep_lookup(l_id).id := objlook.eligy_prfl_id;
10422 g_cache_elpeep_lookup(l_id).fk_id := objlook.business_group_id;
10423 --
10424 end loop;
10425 --
10426 l_torrwnum := 0;
10427 l_prev_id := -1;
10428 --
10429 for objinst in c_elpeep_inst loop
10430 --
10431 -- Populate the cache lookup details
10432 --
10433 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
10434 --
10435 -- Check if hashed value is already allocated
10436 --
10437 if g_cache_elpeep_lookup(l_id).id = objinst.eligy_prfl_id then
10438 --
10439 null;
10440 --
10441 else
10442 --
10443 loop
10444 --
10445 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10446 --
10447 if g_cache_elpeep_lookup(l_id).id = objinst.eligy_prfl_id then
10448 --
10449 exit;
10450 --
10451 end if;
10452 --
10453 end loop;
10454 --
10455 end if;
10456 --
10457 -- Check for first row
10458 --
10459 if l_prev_id = -1 then
10460 --
10461 g_cache_elpeep_lookup(l_id).starttorele_num := l_torrwnum;
10462 --
10463 elsif l_id <> l_prev_id then
10464 --
10465 g_cache_elpeep_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10466 g_cache_elpeep_lookup(l_id).starttorele_num := l_torrwnum;
10467 --
10468 end if;
10469 --
10470 -- Populate the cache instance details
10471 --
10472 g_cache_elpeep_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
10473 g_cache_elpeep_inst(l_torrwnum).pl_id := objinst.pl_id;
10474 g_cache_elpeep_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
10475 g_cache_elpeep_inst(l_torrwnum).excld_flag := objinst.excld_flag;
10476 --
10477 l_torrwnum := l_torrwnum+1;
10478 l_prev_id := l_id;
10479 --
10480 end loop;
10481 --
10482 g_cache_elpeep_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10483 --
10484 end elpeep_writecache;
10485 --
10486 procedure elpeep_getcacdets
10487 (p_effective_date in date,
10491 p_inst_set out nocopy ben_elp_cache.g_cache_elpeep_instor,
10488 p_business_group_id in number,
10489 p_eligy_prfl_id in number,
10490 p_refresh_cache in boolean default FALSE,
10492 p_inst_count out nocopy number) is
10493 --
10494 l_proc varchar2(72) := 'elpeep_getcacdets';
10495 l_torrwnum pls_integer;
10496 l_insttorrw_num pls_integer;
10497 l_index pls_integer;
10498 --
10499 l_not_hash_found boolean;
10500 --
10501 begin
10502 --
10503 -- Flush the cache
10504 --
10505 if p_refresh_cache then
10506 --
10507 g_cache_elpeep_lookup.delete;
10508 g_cache_elpeep_inst.delete;
10509 --
10510 end if;
10511 --
10512 -- Populate the global cache
10513 --
10514 if g_cache_elpeep_lookup.count = 0 then
10515 --
10516 -- Build the cache
10517 --
10518 ben_elp_cache.elpeep_writecache
10519 (p_effective_date => p_effective_date,
10520 p_refresh_cache => p_refresh_cache);
10521 --
10522 end if;
10523 --
10524 -- Get the instance details
10525 --
10526 l_torrwnum := 0;
10527 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
10528 --
10529 -- Check if hashed value is already allocated
10530 --
10531 if g_cache_elpeep_lookup.exists(l_index) then
10532 --
10533 -- If it does exist make sure its the right one
10534 --
10535 if g_cache_elpeep_lookup(l_index).id <> p_eligy_prfl_id then
10536 --
10537 l_not_hash_found := false;
10538 --
10539 -- Loop until un-allocated has value is derived
10540 --
10541 while not l_not_hash_found loop
10542 --
10543 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
10544 --
10545 -- Check if the hash index exists, if not we can use it
10546 --
10547 -- Bug 13253435 when moved to next hash index checking whether that
10548 -- hash index 'id' is having value of p_eligy_prfl_id or not.
10549 -- If values are equal then existing from the loop
10550 if g_cache_elpeep_lookup(l_index).id = p_eligy_prfl_id then
10551 l_not_hash_found := true;
10552 exit;
10553 end if;
10554 -- Bug 13253435
10555
10556 if not g_cache_elpeep_lookup.exists(l_index) then
10557 --
10558 -- Lets store the hash value in the index
10559 --
10560 l_not_hash_found := true;
10561 exit;
10562 --
10563 else
10564 --
10565 l_not_hash_found := false;
10566 --
10567 end if;
10568 --
10569 end loop;
10570 --
10571 end if;
10572 --
10573 end if;
10574 --
10575 for l_insttorrw_num in g_cache_elpeep_lookup(l_index).starttorele_num ..
10576 g_cache_elpeep_lookup(l_index).endtorele_num loop
10577 --
10578 p_inst_set(l_torrwnum) := g_cache_elpeep_inst(l_insttorrw_num);
10579 l_torrwnum := l_torrwnum+1;
10580 --
10581 end loop;
10582 --
10583 p_inst_count := l_torrwnum;
10584 --
10585 exception
10586 --
10587 when no_data_found then
10588 --
10589 p_inst_count := 0;
10590 --
10591 end elpeep_getcacdets;
10592 --
10593 procedure elpeei_writecache
10594 (p_effective_date in date,
10595 p_refresh_cache in boolean default FALSE) is
10596 --
10597 l_proc varchar2(72) := 'elpeei_writecache';
10598 l_torrwnum pls_integer;
10599 l_prev_id number;
10600 l_id number;
10601 --
10602 cursor c_elpeei_look is
10603 select elp.eligy_prfl_id,
10604 elp.business_group_id
10605 from ben_eligy_prfl_f elp
10606 where p_effective_date
10607 between elp.effective_start_date
10608 and elp.effective_end_date
10609 and exists(select null
10610 from ben_elig_enrld_anthr_oipl_f eei
10611 where p_effective_date
10612 between eei.effective_start_date
10613 and eei.effective_end_date
10614 and eei.eligy_prfl_id = elp.eligy_prfl_id)
10615 order by elp.eligy_prfl_id;
10616 --
10617 cursor c_elpeei_inst is
10618 select eei.eligy_prfl_id,
10619 eei.oipl_id,
10620 eei.enrl_det_dt_cd,
10621 eei.excld_flag
10622 from ben_elig_enrld_anthr_oipl_f eei
10623 where p_effective_date
10624 between eei.effective_start_date
10625 and eei.effective_end_date
10626 order by eei.eligy_prfl_id,
10627 decode(eei.excld_flag,'Y',1,2),
10628 eei.ordr_num;
10629 --
10630 l_not_hash_found boolean;
10631 --
10632 begin
10633 --
10634 for objlook in c_elpeei_look loop
10635 --
10636 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
10637 --
10638 -- Check if hashed value is already allocated
10639 --
10640 if g_cache_elpeei_lookup.exists(l_id) then
10641 --
10642 l_not_hash_found := false;
10643 --
10644 -- Loop until un-allocated has value is derived
10645 --
10646 while not l_not_hash_found loop
10647 --
10648 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10649 --
10653 --
10650 -- Check if the hash index exists, if not we can use it
10651 --
10652 if not g_cache_elpeei_lookup.exists(l_id) then
10654 -- Lets store the hash value in the index
10655 --
10656 l_not_hash_found := true;
10657 exit;
10658 --
10659 else
10660 --
10661 l_not_hash_found := false;
10662 --
10663 end if;
10664 --
10665 end loop;
10666 --
10667 end if;
10668 --
10669 g_cache_elpeei_lookup(l_id).id := objlook.eligy_prfl_id;
10670 g_cache_elpeei_lookup(l_id).fk_id := objlook.business_group_id;
10671 --
10672 end loop;
10673 --
10674 l_torrwnum := 0;
10675 l_prev_id := -1;
10676 --
10677 for objinst in c_elpeei_inst loop
10678 --
10679 -- Populate the cache lookup details
10680 --
10681 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
10682 --
10683 -- Check if hashed value is already allocated
10684 --
10685 if g_cache_elpeei_lookup(l_id).id = objinst.eligy_prfl_id then
10686 --
10687 null;
10688 --
10689 else
10690 --
10691 loop
10692 --
10693 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10694 --
10695 if g_cache_elpeei_lookup(l_id).id = objinst.eligy_prfl_id then
10696 --
10697 exit;
10698 --
10699 end if;
10700 --
10701 end loop;
10702 --
10703 end if;
10704 --
10705 -- Check for first row
10706 --
10707 if l_prev_id = -1 then
10708 --
10709 g_cache_elpeei_lookup(l_id).starttorele_num := l_torrwnum;
10710 --
10711 elsif l_id <> l_prev_id then
10712 --
10713 g_cache_elpeei_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10714 g_cache_elpeei_lookup(l_id).starttorele_num := l_torrwnum;
10715 --
10716 end if;
10717 --
10718 -- Populate the cache instance details
10719 --
10720 g_cache_elpeei_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
10721 g_cache_elpeei_inst(l_torrwnum).oipl_id := objinst.oipl_id;
10722 g_cache_elpeei_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
10723 g_cache_elpeei_inst(l_torrwnum).excld_flag := objinst.excld_flag;
10724 --
10725 l_torrwnum := l_torrwnum+1;
10726 l_prev_id := l_id;
10727 --
10728 end loop;
10729 --
10730 g_cache_elpeei_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10731 --
10732 end elpeei_writecache;
10733 --
10734 procedure elpeei_getcacdets
10735 (p_effective_date in date,
10736 p_business_group_id in number,
10737 p_eligy_prfl_id in number,
10738 p_refresh_cache in boolean default FALSE,
10739 p_inst_set out nocopy ben_elp_cache.g_cache_elpeei_instor,
10740 p_inst_count out nocopy number) is
10741 --
10742 l_proc varchar2(72) := 'elpeei_getcacdets';
10743 l_torrwnum pls_integer;
10744 l_insttorrw_num pls_integer;
10745 l_index pls_integer;
10746 --
10747 l_not_hash_found boolean;
10748 --
10749 begin
10750 --
10751 -- Flush the cache
10752 --
10753 if p_refresh_cache then
10754 --
10755 g_cache_elpeei_lookup.delete;
10756 g_cache_elpeei_inst.delete;
10757 --
10758 end if;
10759 --
10760 -- Populate the global cache
10761 --
10762 if g_cache_elpeei_lookup.count = 0 then
10763 --
10764 -- Build the cache
10765 --
10766 ben_elp_cache.elpeei_writecache
10767 (p_effective_date => p_effective_date,
10768 p_refresh_cache => p_refresh_cache);
10769 --
10770 end if;
10771 --
10772 -- Get the instance details
10773 --
10774 l_torrwnum := 0;
10775 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
10776 --
10777 -- Check if hashed value is already allocated
10778 --
10779 if g_cache_elpeei_lookup.exists(l_index) then
10780 --
10781 -- If it does exist make sure its the right one
10782 --
10783 if g_cache_elpeei_lookup(l_index).id <> p_eligy_prfl_id then
10784 --
10785 l_not_hash_found := false;
10786 --
10787 -- Loop until un-allocated has value is derived
10788 --
10789 while not l_not_hash_found loop
10790 --
10791 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
10792 --
10793 -- Check if the hash index exists, if not we can use it
10794 --
10795 -- Bug 13253435 when moved to next hash index checking whether that
10796 -- hash index 'id' is having value of p_eligy_prfl_id or not.
10797 -- If values are equal then existing from the loop
10798 if g_cache_elpeei_lookup(l_index).id = p_eligy_prfl_id then
10799 l_not_hash_found := true;
10800 exit;
10801 end if;
10802 -- Bug 13253435
10803
10804 if not g_cache_elpeei_lookup.exists(l_index) then
10805 --
10806 -- Lets store the hash value in the index
10807 --
10808 l_not_hash_found := true;
10809 exit;
10810 --
10811 else
10812 --
10813 l_not_hash_found := false;
10814 --
10815 end if;
10816 --
10820 --
10817 end loop;
10818 --
10819 end if;
10821 end if;
10822 --
10823 for l_insttorrw_num in g_cache_elpeei_lookup(l_index).starttorele_num ..
10824 g_cache_elpeei_lookup(l_index).endtorele_num loop
10825 --
10826 p_inst_set(l_torrwnum) := g_cache_elpeei_inst(l_insttorrw_num);
10827 l_torrwnum := l_torrwnum+1;
10828 --
10829 end loop;
10830 --
10831 p_inst_count := l_torrwnum;
10832 --
10833 exception
10834 --
10835 when no_data_found then
10836 --
10837 p_inst_count := 0;
10838 --
10839 end elpeei_getcacdets;
10840 --
10841 procedure elpeeg_writecache
10842 (p_effective_date in date,
10843 p_refresh_cache in boolean default FALSE) is
10844 --
10845 l_proc varchar2(72) := 'elpeeg_writecache';
10846 l_torrwnum pls_integer;
10847 l_prev_id number;
10848 l_id number;
10849 --
10850 cursor c_elpeeg_look is
10851 select elp.eligy_prfl_id,
10852 elp.business_group_id
10853 from ben_eligy_prfl_f elp
10854 where p_effective_date
10855 between elp.effective_start_date
10856 and elp.effective_end_date
10857 and exists(select null
10858 from ben_elig_enrld_anthr_pgm_f eeg
10859 where p_effective_date
10860 between eeg.effective_start_date
10861 and eeg.effective_end_date
10862 and eeg.eligy_prfl_id = elp.eligy_prfl_id)
10863 order by elp.eligy_prfl_id;
10864 --
10865 cursor c_elpeeg_inst is
10866 select eeg.eligy_prfl_id,
10867 eeg.pgm_id,
10868 eeg.enrl_det_dt_cd,
10869 eeg.excld_flag
10870 from ben_elig_enrld_anthr_pgm_f eeg
10871 where p_effective_date
10872 between eeg.effective_start_date
10873 and eeg.effective_end_date
10874 order by eeg.eligy_prfl_id,
10875 decode(eeg.excld_flag,'Y',1,2),
10876 eeg.ordr_num;
10877 --
10878 l_not_hash_found boolean;
10879 --
10880 begin
10881 --
10882 for objlook in c_elpeeg_look loop
10883 --
10884 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
10885 --
10886 -- Check if hashed value is already allocated
10887 --
10888 if g_cache_elpeeg_lookup.exists(l_id) then
10889 --
10890 l_not_hash_found := false;
10891 --
10892 -- Loop until un-allocated has value is derived
10893 --
10894 while not l_not_hash_found loop
10895 --
10896 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10897 --
10898 -- Check if the hash index exists, if not we can use it
10899 --
10900 if not g_cache_elpeeg_lookup.exists(l_id) then
10901 --
10902 -- Lets store the hash value in the index
10903 --
10904 l_not_hash_found := true;
10905 exit;
10906 --
10907 else
10908 --
10909 l_not_hash_found := false;
10910 --
10911 end if;
10912 --
10913 end loop;
10914 --
10915 end if;
10916 --
10917 g_cache_elpeeg_lookup(l_id).id := objlook.eligy_prfl_id;
10918 g_cache_elpeeg_lookup(l_id).fk_id := objlook.business_group_id;
10919 --
10920 end loop;
10921 --
10922 l_torrwnum := 0;
10923 l_prev_id := -1;
10924 --
10925 for objinst in c_elpeeg_inst loop
10926 --
10927 -- Populate the cache lookup details
10928 --
10929 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
10930 --
10931 -- Check if hashed value is already allocated
10932 --
10933 if g_cache_elpeeg_lookup(l_id).id = objinst.eligy_prfl_id then
10934 --
10935 null;
10936 --
10937 else
10938 --
10939 loop
10940 --
10941 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
10942 --
10943 if g_cache_elpeeg_lookup(l_id).id = objinst.eligy_prfl_id then
10944 --
10945 exit;
10946 --
10947 end if;
10948 --
10949 end loop;
10950 --
10951 end if;
10952 --
10953 -- Check for first row
10954 --
10955 if l_prev_id = -1 then
10956 --
10957 g_cache_elpeeg_lookup(l_id).starttorele_num := l_torrwnum;
10958 --
10959 elsif l_id <> l_prev_id then
10960 --
10961 g_cache_elpeeg_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10962 g_cache_elpeeg_lookup(l_id).starttorele_num := l_torrwnum;
10963 --
10964 end if;
10965 --
10966 -- Populate the cache instance details
10967 --
10968 g_cache_elpeeg_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
10969 g_cache_elpeeg_inst(l_torrwnum).pgm_id := objinst.pgm_id;
10970 g_cache_elpeeg_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
10971 g_cache_elpeeg_inst(l_torrwnum).excld_flag := objinst.excld_flag;
10972 --
10973 l_torrwnum := l_torrwnum+1;
10974 l_prev_id := l_id;
10975 --
10976 end loop;
10977 --
10978 g_cache_elpeeg_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
10979 --
10980 end elpeeg_writecache;
10981 --
10982 procedure elpeeg_getcacdets
10983 (p_effective_date in date,
10984 p_business_group_id in number,
10985 p_eligy_prfl_id in number,
10986 p_refresh_cache in boolean default FALSE,
10990 l_proc varchar2(72) := 'elpeeg_getcacdets';
10987 p_inst_set out nocopy ben_elp_cache.g_cache_elpeeg_instor,
10988 p_inst_count out nocopy number) is
10989 --
10991 l_torrwnum pls_integer;
10992 l_insttorrw_num pls_integer;
10993 l_index pls_integer;
10994 --
10995 l_not_hash_found boolean;
10996 --
10997 begin
10998 --
10999 -- Flush the cache
11000 --
11001 if p_refresh_cache then
11002 --
11003 g_cache_elpeeg_lookup.delete;
11004 g_cache_elpeeg_inst.delete;
11005 --
11006 end if;
11007 --
11008 -- Populate the global cache
11009 --
11010 if g_cache_elpeeg_lookup.count = 0 then
11011 --
11012 -- Build the cache
11013 --
11014 ben_elp_cache.elpeeg_writecache
11015 (p_effective_date => p_effective_date,
11016 p_refresh_cache => p_refresh_cache);
11017 --
11018 end if;
11019 --
11020 -- Get the instance details
11021 --
11022 l_torrwnum := 0;
11023 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
11024 --
11025 -- Check if hashed value is already allocated
11026 --
11027 if g_cache_elpeeg_lookup.exists(l_index) then
11028 --
11029 -- If it does exist make sure its the right one
11030 --
11031 if g_cache_elpeeg_lookup(l_index).id <> p_eligy_prfl_id then
11032 --
11033 l_not_hash_found := false;
11034 --
11035 -- Loop until un-allocated has value is derived
11036 --
11037 while not l_not_hash_found loop
11038 --
11039 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
11040 --
11041 -- Check if the hash index exists, if not we can use it
11042 --
11043 -- Bug 13253435 when moved to next hash index checking whether that
11044 -- hash index 'id' is having value of p_eligy_prfl_id or not.
11045 -- If values are equal then existing from the loop
11046 if g_cache_elpeeg_lookup(l_index).id = p_eligy_prfl_id then
11047 l_not_hash_found := true;
11048 exit;
11049 end if;
11053 --
11050 -- Bug 13253435
11051
11052 if not g_cache_elpeeg_lookup.exists(l_index) then
11054 -- Lets store the hash value in the index
11055 --
11056 l_not_hash_found := true;
11057 exit;
11058 --
11059 else
11060 --
11061 l_not_hash_found := false;
11062 --
11063 end if;
11064 --
11065 end loop;
11066 --
11067 end if;
11068 --
11069 end if;
11070 --
11071 for l_insttorrw_num in g_cache_elpeeg_lookup(l_index).starttorele_num ..
11072 g_cache_elpeeg_lookup(l_index).endtorele_num loop
11073 --
11074 p_inst_set(l_torrwnum) := g_cache_elpeeg_inst(l_insttorrw_num);
11075 l_torrwnum := l_torrwnum+1;
11076 --
11077 end loop;
11078 --
11079 p_inst_count := l_torrwnum;
11080 --
11081 exception
11082 --
11083 when no_data_found then
11084 --
11085 p_inst_count := 0;
11086 --
11087 end elpeeg_getcacdets;
11088 --
11089 procedure elpedp_writecache
11090 (p_effective_date in date,
11091 p_refresh_cache in boolean default FALSE) is
11092 --
11093 l_proc varchar2(72) := 'elpedp_writecache';
11094 l_torrwnum pls_integer;
11095 l_prev_id number;
11096 l_id number;
11097 --
11098 cursor c_elpedp_look is
11099 select elp.eligy_prfl_id,
11100 elp.business_group_id
11101 from ben_eligy_prfl_f elp
11102 where p_effective_date
11103 between elp.effective_start_date
11104 and elp.effective_end_date
11105 and exists(select null
11106 from ben_elig_dpnt_cvrd_othr_pl_f edp
11107 where p_effective_date
11108 between edp.effective_start_date
11109 and edp.effective_end_date
11110 and edp.eligy_prfl_id = elp.eligy_prfl_id)
11111 order by elp.eligy_prfl_id;
11112 --
11113 cursor c_elpedp_inst is
11114 select edp.eligy_prfl_id,
11115 edp.pl_id,
11116 edp.cvg_det_dt_cd,
11117 edp.excld_flag
11118 from ben_elig_dpnt_cvrd_othr_pl_f edp
11119 where p_effective_date
11120 between edp.effective_start_date
11121 and edp.effective_end_date
11122 order by edp.eligy_prfl_id,
11123 decode(edp.excld_flag,'Y',1,2),
11124 edp.ordr_num;
11125 --
11129 --
11126 l_not_hash_found boolean;
11127 --
11128 begin
11130 for objlook in c_elpedp_look loop
11131 --
11132 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
11133 --
11134 -- Check if hashed value is already allocated
11135 --
11136 if g_cache_elpedp_lookup.exists(l_id) then
11137 --
11138 l_not_hash_found := false;
11139 --
11140 -- Loop until un-allocated has value is derived
11141 --
11142 while not l_not_hash_found loop
11143 --
11144 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11145 --
11146 -- Check if the hash index exists, if not we can use it
11147 --
11148 if not g_cache_elpedp_lookup.exists(l_id) then
11149 --
11150 -- Lets store the hash value in the index
11151 --
11152 l_not_hash_found := true;
11153 exit;
11154 --
11155 else
11156 --
11157 l_not_hash_found := false;
11158 --
11159 end if;
11160 --
11161 end loop;
11162 --
11163 end if;
11164 --
11165 g_cache_elpedp_lookup(l_id).id := objlook.eligy_prfl_id;
11166 g_cache_elpedp_lookup(l_id).fk_id := objlook.business_group_id;
11167 --
11168 end loop;
11169 --
11170 l_torrwnum := 0;
11171 l_prev_id := -1;
11172 --
11173 for objinst in c_elpedp_inst loop
11174 --
11175 -- Populate the cache lookup details
11176 --
11177 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
11178 --
11179 -- Check if hashed value is already allocated
11180 --
11181 if g_cache_elpedp_lookup(l_id).id = objinst.eligy_prfl_id then
11182 --
11183 null;
11184 --
11185 else
11186 --
11187 loop
11188 --
11189 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11190 --
11191 if g_cache_elpedp_lookup(l_id).id = objinst.eligy_prfl_id then
11192 --
11193 exit;
11194 --
11195 end if;
11196 --
11197 end loop;
11198 --
11199 end if;
11200 --
11201 -- Check for first row
11202 --
11203 if l_prev_id = -1 then
11204 --
11205 g_cache_elpedp_lookup(l_id).starttorele_num := l_torrwnum;
11206 --
11207 elsif l_id <> l_prev_id then
11208 --
11209 g_cache_elpedp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11210 g_cache_elpedp_lookup(l_id).starttorele_num := l_torrwnum;
11211 --
11212 end if;
11213 --
11214 -- Populate the cache instance details
11215 --
11216 g_cache_elpedp_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
11217 g_cache_elpedp_inst(l_torrwnum).pl_id := objinst.pl_id;
11218 g_cache_elpedp_inst(l_torrwnum).cvg_det_dt_cd := objinst.cvg_det_dt_cd;
11219 g_cache_elpedp_inst(l_torrwnum).excld_flag := objinst.excld_flag;
11220 --
11221 l_torrwnum := l_torrwnum+1;
11222 l_prev_id := l_id;
11223 --
11224 end loop;
11225 --
11226 g_cache_elpedp_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11227 --
11228 end elpedp_writecache;
11229 --
11230 procedure elpedp_getcacdets
11231 (p_effective_date in date,
11232 p_business_group_id in number,
11233 p_eligy_prfl_id in number,
11234 p_refresh_cache in boolean default FALSE,
11235 p_inst_set out nocopy ben_elp_cache.g_cache_elpedp_instor,
11236 p_inst_count out nocopy number) is
11237 --
11238 l_proc varchar2(72) := 'elpedp_getcacdets';
11239 l_torrwnum pls_integer;
11240 l_insttorrw_num pls_integer;
11241 l_index pls_integer;
11242 --
11243 l_not_hash_found boolean;
11244 --
11245 begin
11246 --
11247 -- Flush the cache
11248 --
11249 if p_refresh_cache then
11250 --
11251 g_cache_elpedp_lookup.delete;
11252 g_cache_elpedp_inst.delete;
11253 --
11254 end if;
11255 --
11256 -- Populate the global cache
11257 --
11258 if g_cache_elpedp_lookup.count = 0 then
11259 --
11260 -- Build the cache
11261 --
11262 ben_elp_cache.elpedp_writecache
11263 (p_effective_date => p_effective_date,
11264 p_refresh_cache => p_refresh_cache);
11265 --
11266 end if;
11267 --
11268 -- Get the instance details
11269 --
11270 l_torrwnum := 0;
11271 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
11272 --
11273 -- Check if hashed value is already allocated
11274 --
11275 if g_cache_elpedp_lookup.exists(l_index) then
11276 --
11277 -- If it does exist make sure its the right one
11278 --
11279 if g_cache_elpedp_lookup(l_index).id <> p_eligy_prfl_id then
11280 --
11281 l_not_hash_found := false;
11282 --
11283 -- Loop until un-allocated has value is derived
11284 --
11285 while not l_not_hash_found loop
11286 --
11287 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
11288 --
11289 -- Check if the hash index exists, if not we can use it
11290 --
11291 -- Bug 13253435 when moved to next hash index checking whether that
11292 -- hash index 'id' is having value of p_eligy_prfl_id or not.
11296 exit;
11293 -- If values are equal then existing from the loop
11294 if g_cache_elpedp_lookup(l_index).id = p_eligy_prfl_id then
11295 l_not_hash_found := true;
11297 end if;
11298 -- Bug 13253435
11299
11300 if not g_cache_elpedp_lookup.exists(l_index) then
11301 --
11302 -- Lets store the hash value in the index
11303 --
11304 l_not_hash_found := true;
11305 exit;
11306 --
11307 else
11308 --
11309 l_not_hash_found := false;
11310 --
11311 end if;
11312 --
11313 end loop;
11314 --
11315 end if;
11316 --
11317 end if;
11318 --
11319 for l_insttorrw_num in g_cache_elpedp_lookup(l_index).starttorele_num ..
11320 g_cache_elpedp_lookup(l_index).endtorele_num loop
11321 --
11322 p_inst_set(l_torrwnum) := g_cache_elpedp_inst(l_insttorrw_num);
11323 l_torrwnum := l_torrwnum+1;
11324 --
11325 end loop;
11326 --
11327 p_inst_count := l_torrwnum;
11328 --
11329 exception
11330 --
11331 when no_data_found then
11332 --
11333 p_inst_count := 0;
11334 --
11335 end elpedp_getcacdets;
11336 --
11337 procedure elpelv_writecache
11338 (p_effective_date in date,
11339 p_refresh_cache in boolean default FALSE) is
11340 --
11341 l_proc varchar2(72) := 'elpelv_writecache';
11342 l_torrwnum pls_integer;
11343 l_prev_id number;
11344 l_id number;
11345 --
11346 cursor c_elpelv_look is
11347 select elp.eligy_prfl_id,
11348 elp.business_group_id
11349 from ben_eligy_prfl_f elp
11350 where p_effective_date
11351 between elp.effective_start_date
11352 and elp.effective_end_date
11353 and exists(select null
11354 from ben_elig_lvg_rsn_prte_f elv
11355 where p_effective_date
11356 between elv.effective_start_date
11357 and elv.effective_end_date
11358 and elv.eligy_prfl_id = elp.eligy_prfl_id)
11359 order by elp.eligy_prfl_id;
11360 --
11361 cursor c_elpelv_inst is
11362 select elv.eligy_prfl_id,
11363 elv.elig_lvg_rsn_prte_id pk_id,
11364 'ELV' short_code,
11365 elv.lvg_rsn_cd,
11366 elv.excld_flag,
11367 elv.criteria_score,
11368 elv.criteria_weight
11369 from ben_elig_lvg_rsn_prte_f elv
11370 where p_effective_date
11371 between elv.effective_start_date
11372 and elv.effective_end_date
11373 order by elv.eligy_prfl_id,
11374 decode(elv.excld_flag,'Y',1,2),
11375 elv.ordr_num;
11376 --
11377 l_not_hash_found boolean;
11378 --
11379 begin
11380 --
11381 for objlook in c_elpelv_look loop
11382 --
11383 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
11384 --
11385 -- Check if hashed value is already allocated
11386 --
11387 if g_cache_elpelv_lookup.exists(l_id) then
11388 --
11389 l_not_hash_found := false;
11390 --
11391 -- Loop until un-allocated has value is derived
11392 --
11393 while not l_not_hash_found loop
11394 --
11395 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11396 --
11397 -- Check if the hash index exists, if not we can use it
11398 --
11399 if not g_cache_elpelv_lookup.exists(l_id) then
11400 --
11401 -- Lets store the hash value in the index
11402 --
11403 l_not_hash_found := true;
11404 exit;
11405 --
11406 else
11407 --
11408 l_not_hash_found := false;
11409 --
11410 end if;
11411 --
11412 end loop;
11413 --
11414 end if;
11415 --
11416 g_cache_elpelv_lookup(l_id).id := objlook.eligy_prfl_id;
11417 g_cache_elpelv_lookup(l_id).fk_id := objlook.business_group_id;
11418 --
11419 end loop;
11420 --
11421 l_torrwnum := 0;
11422 l_prev_id := -1;
11423 --
11424 for objinst in c_elpelv_inst loop
11425 --
11426 -- Populate the cache lookup details
11427 --
11428 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
11429 --
11430 -- Check if hashed value is already allocated
11431 --
11432 if g_cache_elpelv_lookup(l_id).id = objinst.eligy_prfl_id then
11433 --
11434 null;
11435 --
11436 else
11437 --
11438 loop
11439 --
11440 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11441 --
11442 if g_cache_elpelv_lookup(l_id).id = objinst.eligy_prfl_id then
11443 --
11444 exit;
11445 --
11446 end if;
11447 --
11448 end loop;
11449 --
11450 end if;
11451 --
11452 -- Check for first row
11453 --
11454 if l_prev_id = -1 then
11455 --
11456 g_cache_elpelv_lookup(l_id).starttorele_num := l_torrwnum;
11457 --
11458 elsif l_id <> l_prev_id then
11459 --
11460 g_cache_elpelv_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11464 --
11461 g_cache_elpelv_lookup(l_id).starttorele_num := l_torrwnum;
11462 --
11463 end if;
11465 -- Populate the cache instance details
11466 --
11467 g_cache_elpelv_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
11468 g_cache_elpelv_inst(l_torrwnum).pk_id := objinst.pk_id;
11469 g_cache_elpelv_inst(l_torrwnum).short_code := objinst.short_code;
11470 g_cache_elpelv_inst(l_torrwnum).criteria_score := objinst.criteria_score;
11471 g_cache_elpelv_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
11472 g_cache_elpelv_inst(l_torrwnum).lvg_rsn_cd := objinst.lvg_rsn_cd;
11473 g_cache_elpelv_inst(l_torrwnum).excld_flag := objinst.excld_flag;
11474 --
11475 l_torrwnum := l_torrwnum+1;
11476 l_prev_id := l_id;
11477 --
11478 end loop;
11479 --
11480 g_cache_elpelv_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11481 --
11482 end elpelv_writecache;
11483 --
11484 procedure elpelv_getcacdets
11485 (p_effective_date in date,
11486 p_business_group_id in number,
11487 p_eligy_prfl_id in number,
11488 p_refresh_cache in boolean default FALSE,
11489 p_inst_set out nocopy ben_elp_cache.g_cache_elpelv_instor,
11490 p_inst_count out nocopy number) is
11491 --
11492 l_proc varchar2(72) := 'elpelv_getcacdets';
11493 l_torrwnum pls_integer;
11494 l_insttorrw_num pls_integer;
11495 l_index pls_integer;
11496 --
11497 l_not_hash_found boolean;
11498 --
11499 begin
11500 --
11501 -- Flush the cache
11502 --
11503 if p_refresh_cache then
11504 --
11505 g_cache_elpelv_lookup.delete;
11506 g_cache_elpelv_inst.delete;
11507 --
11508 end if;
11509 --
11510 -- Populate the global cache
11511 --
11512 if g_cache_elpelv_lookup.count = 0 then
11513 --
11514 -- Build the cache
11515 --
11516 ben_elp_cache.elpelv_writecache
11517 (p_effective_date => p_effective_date,
11518 p_refresh_cache => p_refresh_cache);
11519 --
11520 end if;
11521 --
11522 -- Get the instance details
11523 --
11524 l_torrwnum := 0;
11525 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
11526 --
11527 -- Check if hashed value is already allocated
11528 --
11529 if g_cache_elpelv_lookup.exists(l_index) then
11530 --
11531 -- If it does exist make sure its the right one
11532 --
11533 if g_cache_elpelv_lookup(l_index).id <> p_eligy_prfl_id then
11534 --
11535 l_not_hash_found := false;
11536 --
11537 -- Loop until un-allocated has value is derived
11538 --
11539 while not l_not_hash_found loop
11540 --
11541 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
11542 --
11543 -- Check if the hash index exists, if not we can use it
11544 --
11545 -- Bug 13253435 when moved to next hash index checking whether that
11546 -- hash index 'id' is having value of p_eligy_prfl_id or not.
11547 -- If values are equal then existing from the loop
11548 if g_cache_elpelv_lookup(l_index).id = p_eligy_prfl_id then
11549 l_not_hash_found := true;
11550 exit;
11551 end if;
11552 -- Bug 13253435
11553
11554 if not g_cache_elpelv_lookup.exists(l_index) then
11555 --
11556 -- Lets store the hash value in the index
11557 --
11558 l_not_hash_found := true;
11559 exit;
11560 --
11561 else
11562 --
11563 l_not_hash_found := false;
11564 --
11565 end if;
11566 --
11567 end loop;
11568 --
11569 end if;
11570 --
11571 end if;
11572 --
11573 for l_insttorrw_num in g_cache_elpelv_lookup(l_index).starttorele_num ..
11574 g_cache_elpelv_lookup(l_index).endtorele_num loop
11575 --
11576 p_inst_set(l_torrwnum) := g_cache_elpelv_inst(l_insttorrw_num);
11577 l_torrwnum := l_torrwnum+1;
11578 --
11579 end loop;
11580 --
11581 p_inst_count := l_torrwnum;
11582 --
11583 exception
11584 --
11585 when no_data_found then
11586 --
11587 p_inst_count := 0;
11588 --
11589 end elpelv_getcacdets;
11590 --
11591 procedure elpeom_writecache
11592 (p_effective_date in date,
11593 p_refresh_cache in boolean default FALSE) is
11594 --
11595 l_proc varchar2(72) := 'elpeom_writecache';
11596 l_torrwnum pls_integer;
11597 l_prev_id number;
11598 l_id number;
11599 --
11600 cursor c_elpeom_look is
11601 select elp.eligy_prfl_id,
11602 elp.business_group_id
11603 from ben_eligy_prfl_f elp
11604 where p_effective_date
11605 between elp.effective_start_date
11606 and elp.effective_end_date
11607 and exists(select null
11608 from ben_elig_optd_mdcr_prte_f eom
11609 where p_effective_date
11610 between eom.effective_start_date
11611 and eom.effective_end_date
11612 and eom.eligy_prfl_id = elp.eligy_prfl_id)
11613 order by elp.eligy_prfl_id;
11614 --
11615 cursor c_elpeom_inst is
11616 select eom.eligy_prfl_id,
11617 eom.optd_mdcr_flag,
11618 eom.exlcd_flag
11619 from ben_elig_optd_mdcr_prte_f eom
11623 order by eom.eligy_prfl_id,
11620 where p_effective_date
11621 between eom.effective_start_date
11622 and eom.effective_end_date
11624 decode(eom.exlcd_flag,'Y',1,2);
11625 --
11626 l_not_hash_found boolean;
11627 --
11628 begin
11629 --
11630 for objlook in c_elpeom_look loop
11631 --
11632 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
11633 --
11634 -- Check if hashed value is already allocated
11635 --
11636 if g_cache_elpeom_lookup.exists(l_id) then
11637 --
11638 l_not_hash_found := false;
11639 --
11640 -- Loop until un-allocated has value is derived
11641 --
11642 while not l_not_hash_found loop
11643 --
11644 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11645 --
11646 -- Check if the hash index exists, if not we can use it
11647 --
11648 if not g_cache_elpeom_lookup.exists(l_id) then
11649 --
11650 -- Lets store the hash value in the index
11651 --
11652 l_not_hash_found := true;
11653 exit;
11654 --
11655 else
11656 --
11657 l_not_hash_found := false;
11658 --
11659 end if;
11660 --
11661 end loop;
11662 --
11663 end if;
11664 --
11665 g_cache_elpeom_lookup(l_id).id := objlook.eligy_prfl_id;
11666 g_cache_elpeom_lookup(l_id).fk_id := objlook.business_group_id;
11667 --
11668 end loop;
11669 --
11670 l_torrwnum := 0;
11671 l_prev_id := -1;
11672 --
11673 for objinst in c_elpeom_inst loop
11674 --
11675 -- Populate the cache lookup details
11676 --
11677 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
11678 --
11679 -- Check if hashed value is already allocated
11680 --
11681 if g_cache_elpeom_lookup(l_id).id = objinst.eligy_prfl_id then
11682 --
11683 null;
11684 --
11685 else
11686 --
11687 loop
11688 --
11689 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11690 --
11691 if g_cache_elpeom_lookup(l_id).id = objinst.eligy_prfl_id then
11692 --
11693 exit;
11694 --
11695 end if;
11696 --
11697 end loop;
11698 --
11699 end if;
11700 --
11701 -- Check for first row
11702 --
11703 if l_prev_id = -1 then
11704 --
11705 g_cache_elpeom_lookup(l_id).starttorele_num := l_torrwnum;
11706 --
11707 elsif l_id <> l_prev_id then
11708 --
11709 g_cache_elpeom_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11710 g_cache_elpeom_lookup(l_id).starttorele_num := l_torrwnum;
11711 --
11712 end if;
11713 --
11714 -- Populate the cache instance details
11715 --
11716 g_cache_elpeom_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
11717 g_cache_elpeom_inst(l_torrwnum).optd_mdcr_flag := objinst.optd_mdcr_flag;
11718 g_cache_elpeom_inst(l_torrwnum).excld_flag := objinst.exlcd_flag;
11719 --
11720 l_torrwnum := l_torrwnum+1;
11721 l_prev_id := l_id;
11722 --
11723 end loop;
11724 --
11725 g_cache_elpeom_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11726 --
11727 end elpeom_writecache;
11728 --
11729 procedure elpeom_getcacdets
11730 (p_effective_date in date,
11731 p_business_group_id in number,
11732 p_eligy_prfl_id in number,
11733 p_refresh_cache in boolean default FALSE,
11734 p_inst_set out nocopy ben_elp_cache.g_cache_elpeom_instor,
11735 p_inst_count out nocopy number) is
11736 --
11737 l_proc varchar2(72) := 'elpeom_getcacdets';
11738 l_torrwnum pls_integer;
11739 l_insttorrw_num pls_integer;
11740 l_index pls_integer;
11741 --
11742 l_not_hash_found boolean;
11743 --
11744 begin
11745 --
11746 -- Flush the cache
11747 --
11748 if p_refresh_cache then
11749 --
11750 g_cache_elpeom_lookup.delete;
11751 g_cache_elpeom_inst.delete;
11752 --
11753 end if;
11754 --
11755 -- Populate the global cache
11756 --
11757 if g_cache_elpeom_lookup.count = 0 then
11758 --
11759 -- Build the cache
11760 --
11761 ben_elp_cache.elpeom_writecache
11762 (p_effective_date => p_effective_date,
11763 p_refresh_cache => p_refresh_cache);
11764 --
11765 end if;
11766 --
11767 -- Get the instance details
11768 --
11769 l_torrwnum := 0;
11770 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
11771 --
11772 -- Check if hashed value is already allocated
11773 --
11774 if g_cache_elpeom_lookup.exists(l_index) then
11775 --
11776 -- If it does exist make sure its the right one
11777 --
11778 if g_cache_elpeom_lookup(l_index).id <> p_eligy_prfl_id then
11779 --
11780 l_not_hash_found := false;
11781 --
11782 -- Loop until un-allocated has value is derived
11783 --
11784 while not l_not_hash_found loop
11785 --
11786 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
11787 --
11788 -- Check if the hash index exists, if not we can use it
11789 --
11790 -- Bug 13253435 when moved to next hash index checking whether that
11791 -- hash index 'id' is having value of p_eligy_prfl_id or not.
11795 exit;
11792 -- If values are equal then existing from the loop
11793 if g_cache_elpeom_lookup(l_index).id = p_eligy_prfl_id then
11794 l_not_hash_found := true;
11796 end if;
11797 -- Bug 13253435
11798
11799 if not g_cache_elpeom_lookup.exists(l_index) then
11800 --
11801 -- Lets store the hash value in the index
11802 --
11803 l_not_hash_found := true;
11804 exit;
11805 --
11806 else
11807 --
11808 l_not_hash_found := false;
11809 --
11810 end if;
11811 --
11812 end loop;
11813 --
11814 end if;
11815 --
11816 end if;
11817 --
11818 for l_insttorrw_num in g_cache_elpeom_lookup(l_index).starttorele_num ..
11819 g_cache_elpeom_lookup(l_index).endtorele_num loop
11820 --
11821 p_inst_set(l_torrwnum) := g_cache_elpeom_inst(l_insttorrw_num);
11822 l_torrwnum := l_torrwnum+1;
11823 --
11824 end loop;
11825 --
11826 p_inst_count := l_torrwnum;
11827 --
11828 exception
11829 --
11830 when no_data_found then
11831 --
11832 p_inst_count := 0;
11833 --
11834 end elpeom_getcacdets;
11835 --
11836 procedure elpeai_writecache
11837 (p_effective_date in date,
11838 p_refresh_cache in boolean default FALSE) is
11839 --
11840 l_proc varchar2(72) := 'elpeai_writecache';
11841 l_torrwnum pls_integer;
11842 l_prev_id number;
11843 l_id number;
11844 --
11845 cursor c_elpeai_look is
11846 select elp.eligy_prfl_id,
11847 elp.business_group_id
11848 from ben_eligy_prfl_f elp
11849 where p_effective_date
11850 between elp.effective_start_date
11851 and elp.effective_end_date
11852 and exists(select null
11853 from ben_elig_enrld_anthr_plip_f eai
11854 where p_effective_date
11855 between eai.effective_start_date
11856 and eai.effective_end_date
11857 and eai.eligy_prfl_id = elp.eligy_prfl_id)
11858 order by elp.eligy_prfl_id;
11859 --
11860 cursor c_elpeai_inst is
11861 select eai.eligy_prfl_id,
11862 eai.enrl_det_dt_cd,
11863 eai.plip_id,
11864 eai.excld_flag
11865 from ben_elig_enrld_anthr_plip_f eai
11866 where p_effective_date
11867 between eai.effective_start_date
11868 and eai.effective_end_date
11869 order by eai.eligy_prfl_id,
11870 decode(eai.excld_flag,'Y',1,2);
11871 --
11872 l_not_hash_found boolean;
11873 --
11874 begin
11875 --
11876 for objlook in c_elpeai_look loop
11877 --
11878 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
11879 --
11880 -- Check if hashed value is already allocated
11881 --
11882 if g_cache_elpeai_lookup.exists(l_id) then
11883 --
11884 l_not_hash_found := false;
11885 --
11886 -- Loop until un-allocated has value is derived
11887 --
11888 while not l_not_hash_found loop
11889 --
11890 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11891 --
11892 -- Check if the hash index exists, if not we can use it
11893 --
11894 if not g_cache_elpeai_lookup.exists(l_id) then
11895 --
11896 -- Lets store the hash value in the index
11897 --
11898 l_not_hash_found := true;
11899 exit;
11900 --
11901 else
11902 --
11903 l_not_hash_found := false;
11904 --
11905 end if;
11906 --
11907 end loop;
11908 --
11909 end if;
11910 --
11911 g_cache_elpeai_lookup(l_id).id := objlook.eligy_prfl_id;
11912 g_cache_elpeai_lookup(l_id).fk_id := objlook.business_group_id;
11913 --
11914 end loop;
11915 --
11916 l_torrwnum := 0;
11917 l_prev_id := -1;
11918 --
11919 for objinst in c_elpeai_inst loop
11920 --
11921 -- Populate the cache lookup details
11922 --
11923 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
11924 --
11925 -- Check if hashed value is already allocated
11926 --
11927 if g_cache_elpeai_lookup(l_id).id = objinst.eligy_prfl_id then
11928 --
11929 null;
11930 --
11931 else
11932 --
11933 loop
11934 --
11935 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
11936 --
11937 if g_cache_elpeai_lookup(l_id).id = objinst.eligy_prfl_id then
11938 --
11939 exit;
11940 --
11941 end if;
11942 --
11943 end loop;
11944 --
11945 end if;
11946 --
11947 -- Check for first row
11948 --
11949 if l_prev_id = -1 then
11950 --
11951 g_cache_elpeai_lookup(l_id).starttorele_num := l_torrwnum;
11952 --
11953 elsif l_id <> l_prev_id then
11954 --
11955 g_cache_elpeai_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11956 g_cache_elpeai_lookup(l_id).starttorele_num := l_torrwnum;
11957 --
11958 end if;
11959 --
11960 -- Populate the cache instance details
11961 --
11962 g_cache_elpeai_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
11963 g_cache_elpeai_inst(l_torrwnum).excld_flag := objinst.excld_flag;
11967 l_torrwnum := l_torrwnum+1;
11964 g_cache_elpeai_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
11965 g_cache_elpeai_inst(l_torrwnum).plip_id := objinst.plip_id;
11966 --
11968 l_prev_id := l_id;
11969 --
11970 end loop;
11971 --
11972 g_cache_elpeai_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
11973 --
11974 end elpeai_writecache;
11975 --
11976 procedure elpeai_getcacdets
11977 (p_effective_date in date,
11978 p_business_group_id in number,
11979 p_eligy_prfl_id in number,
11980 p_refresh_cache in boolean default FALSE,
11981 p_inst_set out nocopy ben_elp_cache.g_cache_elpeai_instor,
11982 p_inst_count out nocopy number) is
11983 --
11984 l_proc varchar2(72) := 'elpeai_getcacdets';
11985 l_torrwnum pls_integer;
11986 l_insttorrw_num pls_integer;
11987 l_index pls_integer;
11988 --
11989 l_not_hash_found boolean;
11990 --
11991 begin
11992 --
11993 -- Flush the cache
11994 --
11995 if p_refresh_cache then
11996 --
11997 g_cache_elpeai_lookup.delete;
11998 g_cache_elpeai_inst.delete;
11999 --
12000 end if;
12001 --
12002 -- Populate the global cache
12003 --
12004 if g_cache_elpeai_lookup.count = 0 then
12005 --
12006 -- Build the cache
12007 --
12008 ben_elp_cache.elpeai_writecache
12009 (p_effective_date => p_effective_date,
12010 p_refresh_cache => p_refresh_cache);
12011 --
12012 end if;
12013 --
12014 -- Get the instance details
12015 --
12016 l_torrwnum := 0;
12017 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
12018 --
12019 -- Check if hashed value is already allocated
12020 --
12021 if g_cache_elpeai_lookup.exists(l_index) then
12022 --
12023 -- If it does exist make sure its the right one
12024 --
12025 if g_cache_elpeai_lookup(l_index).id <> p_eligy_prfl_id then
12026 --
12027 l_not_hash_found := false;
12028 --
12029 -- Loop until un-allocated has value is derived
12030 --
12031 while not l_not_hash_found loop
12032 --
12033 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
12034 --
12035 -- Check if the hash index exists, if not we can use it
12036 --
12037 -- Bug 13253435 when moved to next hash index checking whether that
12038 -- hash index 'id' is having value of p_eligy_prfl_id or not.
12039 -- If values are equal then existing from the loop
12040 if g_cache_elpeai_lookup(l_index).id = p_eligy_prfl_id then
12041 l_not_hash_found := true;
12042 exit;
12043 end if;
12044 -- Bug 13253435
12045
12046 if not g_cache_elpeai_lookup.exists(l_index) then
12047 --
12048 -- Lets store the hash value in the index
12049 --
12050 l_not_hash_found := true;
12051 exit;
12052 --
12053 else
12054 --
12058 --
12055 l_not_hash_found := false;
12056 --
12057 end if;
12059 end loop;
12060 --
12061 end if;
12062 --
12063 end if;
12064 --
12065 for l_insttorrw_num in g_cache_elpeai_lookup(l_index).starttorele_num ..
12066 g_cache_elpeai_lookup(l_index).endtorele_num loop
12067 --
12068 p_inst_set(l_torrwnum) := g_cache_elpeai_inst(l_insttorrw_num);
12069 l_torrwnum := l_torrwnum+1;
12070 --
12071 end loop;
12072 --
12073 p_inst_count := l_torrwnum;
12074 --
12075 exception
12076 --
12077 when no_data_found then
12078 --
12079 p_inst_count := 0;
12080 --
12081 end elpeai_getcacdets;
12082 --
12083 procedure elpedi_writecache
12084 (p_effective_date in date,
12085 p_refresh_cache in boolean default FALSE) is
12086 --
12087 l_proc varchar2(72) := 'elpedi_writecache';
12088 l_torrwnum pls_integer;
12089 l_prev_id number;
12090 l_id number;
12091 --
12092 cursor c_elpedi_look is
12093 select elp.eligy_prfl_id,
12094 elp.business_group_id
12095 from ben_eligy_prfl_f elp
12096 where p_effective_date
12097 between elp.effective_start_date
12098 and elp.effective_end_date
12099 and exists(select null
12100 from ben_elig_dpnt_cvrd_plip_f edi
12101 where p_effective_date
12102 between edi.effective_start_date
12103 and edi.effective_end_date
12104 and edi.eligy_prfl_id = elp.eligy_prfl_id)
12105 order by elp.eligy_prfl_id;
12106 --
12107 cursor c_elpedi_inst is
12108 select edi.eligy_prfl_id,
12109 edi.enrl_det_dt_cd,
12110 edi.plip_id,
12111 edi.excld_flag
12112 from ben_elig_dpnt_cvrd_plip_f edi
12113 where p_effective_date
12114 between edi.effective_start_date
12115 and edi.effective_end_date
12116 order by edi.eligy_prfl_id,
12120 --
12117 decode(edi.excld_flag,'Y',1,2);
12118 --
12119 l_not_hash_found boolean;
12121 begin
12122 --
12123 for objlook in c_elpedi_look loop
12124 --
12125 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
12126 --
12127 -- Check if hashed value is already allocated
12128 --
12129 if g_cache_elpedi_lookup.exists(l_id) then
12130 --
12131 l_not_hash_found := false;
12132 --
12133 -- Loop until un-allocated has value is derived
12134 --
12135 while not l_not_hash_found loop
12136 --
12137 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12138 --
12139 -- Check if the hash index exists, if not we can use it
12140 --
12141 if not g_cache_elpedi_lookup.exists(l_id) then
12142 --
12143 -- Lets store the hash value in the index
12144 --
12145 l_not_hash_found := true;
12146 exit;
12147 --
12148 else
12149 --
12150 l_not_hash_found := false;
12151 --
12152 end if;
12153 --
12154 end loop;
12155 --
12156 end if;
12157 --
12158 g_cache_elpedi_lookup(l_id).id := objlook.eligy_prfl_id;
12159 g_cache_elpedi_lookup(l_id).fk_id := objlook.business_group_id;
12160 --
12161 end loop;
12162 --
12163 l_torrwnum := 0;
12164 l_prev_id := -1;
12165 --
12166 for objinst in c_elpedi_inst loop
12167 --
12168 -- Populate the cache lookup details
12169 --
12170 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
12171 --
12172 -- Check if hashed value is already allocated
12173 --
12174 if g_cache_elpedi_lookup(l_id).id = objinst.eligy_prfl_id then
12175 --
12176 null;
12177 --
12178 else
12179 --
12180 loop
12181 --
12182 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12183 --
12184 if g_cache_elpedi_lookup(l_id).id = objinst.eligy_prfl_id then
12185 --
12186 exit;
12187 --
12188 end if;
12189 --
12190 end loop;
12191 --
12192 end if;
12193 --
12194 -- Check for first row
12195 --
12196 if l_prev_id = -1 then
12197 --
12198 g_cache_elpedi_lookup(l_id).starttorele_num := l_torrwnum;
12199 --
12200 elsif l_id <> l_prev_id then
12201 --
12202 g_cache_elpedi_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12203 g_cache_elpedi_lookup(l_id).starttorele_num := l_torrwnum;
12204 --
12205 end if;
12206 --
12207 -- Populate the cache instance details
12208 --
12209 g_cache_elpedi_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
12210 g_cache_elpedi_inst(l_torrwnum).excld_flag := objinst.excld_flag;
12211 g_cache_elpedi_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
12212 g_cache_elpedi_inst(l_torrwnum).plip_id := objinst.plip_id;
12213 --
12214 l_torrwnum := l_torrwnum+1;
12215 l_prev_id := l_id;
12216 --
12217 end loop;
12218 --
12219 g_cache_elpedi_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12220 --
12221 end elpedi_writecache;
12222 --
12223 procedure elpedi_getcacdets
12224 (p_effective_date in date,
12225 p_business_group_id in number,
12226 p_eligy_prfl_id in number,
12227 p_refresh_cache in boolean default FALSE,
12228 p_inst_set out nocopy ben_elp_cache.g_cache_elpedi_instor,
12229 p_inst_count out nocopy number) is
12230 --
12231 l_proc varchar2(72) := 'elpedi_getcacdets';
12232 l_torrwnum pls_integer;
12233 l_insttorrw_num pls_integer;
12234 l_index pls_integer;
12235 --
12236 l_not_hash_found boolean;
12237 --
12238 begin
12239 --
12240 -- Flush the cache
12241 --
12242 if p_refresh_cache then
12243 --
12244 g_cache_elpedi_lookup.delete;
12245 g_cache_elpedi_inst.delete;
12246 --
12247 end if;
12248 --
12249 -- Populate the global cache
12250 --
12251 if g_cache_elpedi_lookup.count = 0 then
12252 --
12253 -- Build the cache
12254 --
12255 ben_elp_cache.elpedi_writecache
12256 (p_effective_date => p_effective_date,
12257 p_refresh_cache => p_refresh_cache);
12258 --
12259 end if;
12260 --
12261 -- Get the instance details
12262 --
12263 l_torrwnum := 0;
12264 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
12265 --
12266 -- Check if hashed value is already allocated
12267 --
12268 if g_cache_elpedi_lookup.exists(l_index) then
12269 --
12270 -- If it does exist make sure its the right one
12271 --
12272 if g_cache_elpedi_lookup(l_index).id <> p_eligy_prfl_id then
12273 --
12274 l_not_hash_found := false;
12275 --
12276 -- Loop until un-allocated has value is derived
12277 --
12278 while not l_not_hash_found loop
12279 --
12280 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
12281 --
12282 -- Check if the hash index exists, if not we can use it
12283 --
12284 -- Bug 13253435 when moved to next hash index checking whether that
12288 l_not_hash_found := true;
12285 -- hash index 'id' is having value of p_eligy_prfl_id or not.
12286 -- If values are equal then existing from the loop
12287 if g_cache_elpedi_lookup(l_index).id = p_eligy_prfl_id then
12289 exit;
12290 end if;
12291 -- Bug 13253435
12292
12293 if not g_cache_elpedi_lookup.exists(l_index) then
12294 --
12295 -- Lets store the hash value in the index
12296 --
12297 l_not_hash_found := true;
12298 exit;
12299 --
12300 else
12301 --
12302 l_not_hash_found := false;
12303 --
12304 end if;
12305 --
12306 end loop;
12307 --
12308 end if;
12309 --
12310 end if;
12311 --
12312 for l_insttorrw_num in g_cache_elpedi_lookup(l_index).starttorele_num ..
12313 g_cache_elpedi_lookup(l_index).endtorele_num loop
12314 --
12315 p_inst_set(l_torrwnum) := g_cache_elpedi_inst(l_insttorrw_num);
12316 l_torrwnum := l_torrwnum+1;
12317 --
12318 end loop;
12319 --
12320 p_inst_count := l_torrwnum;
12321 --
12322 exception
12323 --
12324 when no_data_found then
12325 --
12326 p_inst_count := 0;
12327 --
12328 end elpedi_getcacdets;
12329 --
12330 procedure elpeet_writecache
12331 (p_effective_date in date,
12332 p_refresh_cache in boolean default FALSE) is
12333 --
12334 l_proc varchar2(72) := 'elpeet_writecache';
12335 l_torrwnum pls_integer;
12336 l_prev_id number;
12337 l_id number;
12338 --
12339 cursor c_elpeet_look is
12340 select elp.eligy_prfl_id,
12341 elp.business_group_id
12342 from ben_eligy_prfl_f elp
12343 where p_effective_date
12344 between elp.effective_start_date
12345 and elp.effective_end_date
12346 and exists(select null
12347 from ben_elig_enrld_anthr_ptip_f eet
12348 where p_effective_date
12349 between eet.effective_start_date
12350 and eet.effective_end_date
12351 and eet.eligy_prfl_id = elp.eligy_prfl_id)
12352 order by elp.eligy_prfl_id;
12353 --
12354 cursor c_elpeet_inst is
12355 select eet.eligy_prfl_id,
12356 eet.excld_flag,
12357 eet.enrl_det_dt_cd,
12358 eet.only_pls_subj_cobra_flag,
12359 eet.ptip_id
12360 from ben_elig_enrld_anthr_ptip_f eet
12361 where p_effective_date
12362 between eet.effective_start_date
12363 and eet.effective_end_date
12364 order by eet.eligy_prfl_id,
12365 decode(eet.excld_flag,'Y',1,2);
12366 --
12367 l_not_hash_found boolean;
12368 --
12369 begin
12370 --
12371 for objlook in c_elpeet_look loop
12372 --
12373 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
12374 --
12375 -- Check if hashed value is already allocated
12376 --
12377 if g_cache_elpeet_lookup.exists(l_id) then
12378 --
12379 l_not_hash_found := false;
12380 --
12381 -- Loop until un-allocated has value is derived
12382 --
12383 while not l_not_hash_found loop
12384 --
12385 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12386 --
12387 -- Check if the hash index exists, if not we can use it
12388 --
12389 if not g_cache_elpeet_lookup.exists(l_id) then
12390 --
12391 -- Lets store the hash value in the index
12392 --
12393 l_not_hash_found := true;
12394 exit;
12395 --
12396 else
12397 --
12398 l_not_hash_found := false;
12399 --
12400 end if;
12401 --
12402 end loop;
12403 --
12404 end if;
12405 --
12406 g_cache_elpeet_lookup(l_id).id := objlook.eligy_prfl_id;
12407 g_cache_elpeet_lookup(l_id).fk_id := objlook.business_group_id;
12408 --
12409 end loop;
12410 --
12411 l_torrwnum := 0;
12412 l_prev_id := -1;
12413 --
12414 for objinst in c_elpeet_inst loop
12415 --
12416 -- Populate the cache lookup details
12417 --
12418 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
12419 --
12420 -- Check if hashed value is already allocated
12421 --
12422 if g_cache_elpeet_lookup(l_id).id = objinst.eligy_prfl_id then
12423 --
12424 null;
12425 --
12426 else
12427 --
12428 loop
12429 --
12430 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12431 --
12432 if g_cache_elpeet_lookup(l_id).id = objinst.eligy_prfl_id then
12433 --
12434 exit;
12435 --
12436 end if;
12437 --
12438 end loop;
12439 --
12440 end if;
12441 --
12442 -- Check for first row
12443 --
12444 if l_prev_id = -1 then
12445 --
12446 g_cache_elpeet_lookup(l_id).starttorele_num := l_torrwnum;
12447 --
12448 elsif l_id <> l_prev_id then
12449 --
12450 g_cache_elpeet_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12451 g_cache_elpeet_lookup(l_id).starttorele_num := l_torrwnum;
12455 -- Populate the cache instance details
12452 --
12453 end if;
12454 --
12456 --
12457 g_cache_elpeet_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
12458 g_cache_elpeet_inst(l_torrwnum).excld_flag := objinst.excld_flag;
12459 g_cache_elpeet_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
12460 g_cache_elpeet_inst(l_torrwnum).only_pls_subj_cobra_flag := objinst.only_pls_subj_cobra_flag;
12461 g_cache_elpeet_inst(l_torrwnum).ptip_id := objinst.ptip_id;
12462 --
12463 l_torrwnum := l_torrwnum+1;
12464 l_prev_id := l_id;
12465 --
12466 end loop;
12467 --
12468 g_cache_elpeet_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12469 --
12470 end elpeet_writecache;
12471 --
12472 procedure elpeet_getcacdets
12473 (p_effective_date in date,
12474 p_business_group_id in number,
12475 p_eligy_prfl_id in number,
12476 p_refresh_cache in boolean default FALSE,
12477 p_inst_set out nocopy ben_elp_cache.g_cache_elpeet_instor,
12478 p_inst_count out nocopy number) is
12479 --
12480 l_proc varchar2(72) := 'elpeet_getcacdets';
12481 l_torrwnum pls_integer;
12482 l_insttorrw_num pls_integer;
12483 l_index pls_integer;
12484 --
12485 l_not_hash_found boolean;
12486 --
12487 begin
12488 --
12489 -- Flush the cache
12490 --
12491 if p_refresh_cache then
12492 --
12493 g_cache_elpeet_lookup.delete;
12494 g_cache_elpeet_inst.delete;
12495 --
12496 end if;
12497 --
12498 -- Populate the global cache
12499 --
12500 if g_cache_elpeet_lookup.count = 0 then
12501 --
12502 -- Build the cache
12503 --
12504 ben_elp_cache.elpeet_writecache
12505 (p_effective_date => p_effective_date,
12506 p_refresh_cache => p_refresh_cache);
12507 --
12508 end if;
12509 --
12510 -- Get the instance details
12511 --
12512 l_torrwnum := 0;
12513 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
12514 --
12515 -- Check if hashed value is already allocated
12516 --
12517 if g_cache_elpeet_lookup.exists(l_index) then
12518 --
12519 -- If it does exist make sure its the right one
12520 --
12521 if g_cache_elpeet_lookup(l_index).id <> p_eligy_prfl_id then
12522 --
12523 l_not_hash_found := false;
12524 --
12525 -- Loop until un-allocated has value is derived
12526 --
12527 while not l_not_hash_found loop
12528 --
12529 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
12530 --
12531 -- Check if the hash index exists, if not we can use it
12532 --
12533 -- Bug 13253435 when moved to next hash index checking whether that
12534 -- hash index 'id' is having value of p_eligy_prfl_id or not.
12535 -- If values are equal then existing from the loop
12536 if g_cache_elpeet_lookup(l_index).id = p_eligy_prfl_id then
12537 l_not_hash_found := true;
12538 exit;
12539 end if;
12540 -- Bug 13253435
12541
12542 if not g_cache_elpeet_lookup.exists(l_index) then
12543 --
12544 -- Lets store the hash value in the index
12545 --
12546 l_not_hash_found := true;
12547 exit;
12548 --
12549 else
12550 --
12551 l_not_hash_found := false;
12552 --
12553 end if;
12554 --
12555 end loop;
12556 --
12557 end if;
12558 --
12559 end if;
12560 --
12561 for l_insttorrw_num in g_cache_elpeet_lookup(l_index).starttorele_num ..
12562 g_cache_elpeet_lookup(l_index).endtorele_num loop
12563 --
12564 p_inst_set(l_torrwnum) := g_cache_elpeet_inst(l_insttorrw_num);
12565 l_torrwnum := l_torrwnum+1;
12566 --
12567 end loop;
12568 --
12569 p_inst_count := l_torrwnum;
12570 --
12571 exception
12572 --
12573 when no_data_found then
12574 --
12575 p_inst_count := 0;
12576 --
12577 end elpeet_getcacdets;
12578 --
12579 procedure elpedt_writecache
12580 (p_effective_date in date,
12581 p_refresh_cache in boolean default FALSE) is
12582 --
12583 l_proc varchar2(72) := 'elpedt_writecache';
12584 l_torrwnum pls_integer;
12585 l_prev_id number;
12586 l_id number;
12587 --
12588 cursor c_elpedt_look is
12589 select elp.eligy_prfl_id,
12590 elp.business_group_id
12591 from ben_eligy_prfl_f elp
12592 where p_effective_date
12593 between elp.effective_start_date
12594 and elp.effective_end_date
12595 and exists(select null
12596 from ben_elig_dpnt_cvrd_othr_ptip_f edt
12597 where p_effective_date
12598 between edt.effective_start_date
12599 and edt.effective_end_date
12600 and edt.eligy_prfl_id = elp.eligy_prfl_id)
12601 order by elp.eligy_prfl_id;
12602 --
12603 cursor c_elpedt_inst is
12604 select edt.eligy_prfl_id,
12605 edt.excld_flag,
12606 edt.enrl_det_dt_cd,
12607 edt.only_pls_subj_cobra_flag,
12608 edt.ptip_id
12609 from ben_elig_dpnt_cvrd_othr_ptip_f edt
12610 where p_effective_date
12611 between edt.effective_start_date
12612 and edt.effective_end_date
12613 order by edt.eligy_prfl_id,
12614 decode(edt.excld_flag,'Y',1,2);
12615 --
12616 l_not_hash_found boolean;
12617 --
12621 --
12618 begin
12619 --
12620 for objlook in c_elpedt_look loop
12622 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
12623 --
12624 -- Check if hashed value is already allocated
12625 --
12626 if g_cache_elpedt_lookup.exists(l_id) then
12627 --
12628 l_not_hash_found := false;
12629 --
12630 -- Loop until un-allocated has value is derived
12631 --
12632 while not l_not_hash_found loop
12633 --
12634 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12635 --
12636 -- Check if the hash index exists, if not we can use it
12637 --
12638 if not g_cache_elpedt_lookup.exists(l_id) then
12639 --
12640 -- Lets store the hash value in the index
12641 --
12642 l_not_hash_found := true;
12643 exit;
12644 --
12645 else
12646 --
12647 l_not_hash_found := false;
12648 --
12649 end if;
12650 --
12651 end loop;
12652 --
12653 end if;
12654 --
12655 g_cache_elpedt_lookup(l_id).id := objlook.eligy_prfl_id;
12656 g_cache_elpedt_lookup(l_id).fk_id := objlook.business_group_id;
12657 --
12658 end loop;
12659 --
12660 l_torrwnum := 0;
12661 l_prev_id := -1;
12662 --
12663 for objinst in c_elpedt_inst loop
12664 --
12665 -- Populate the cache lookup details
12666 --
12667 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
12668 --
12669 -- Check if hashed value is already allocated
12670 --
12671 if g_cache_elpedt_lookup(l_id).id = objinst.eligy_prfl_id then
12672 --
12673 null;
12674 --
12675 else
12676 --
12677 loop
12678 --
12679 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12680 --
12681 if g_cache_elpedt_lookup(l_id).id = objinst.eligy_prfl_id then
12682 --
12683 exit;
12684 --
12685 end if;
12686 --
12687 end loop;
12688 --
12689 end if;
12690 --
12691 -- Check for first row
12692 --
12693 if l_prev_id = -1 then
12694 --
12695 g_cache_elpedt_lookup(l_id).starttorele_num := l_torrwnum;
12696 --
12697 elsif l_id <> l_prev_id then
12698 --
12699 g_cache_elpedt_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12700 g_cache_elpedt_lookup(l_id).starttorele_num := l_torrwnum;
12701 --
12702 end if;
12703 --
12704 -- Populate the cache instance details
12705 --
12706 g_cache_elpedt_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
12707 g_cache_elpedt_inst(l_torrwnum).excld_flag := objinst.excld_flag;
12708 g_cache_elpedt_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
12709 g_cache_elpedt_inst(l_torrwnum).only_pls_subj_cobra_flag := objinst.only_pls_subj_cobra_flag;
12710 g_cache_elpedt_inst(l_torrwnum).ptip_id := objinst.ptip_id;
12711 --
12712 l_torrwnum := l_torrwnum+1;
12713 l_prev_id := l_id;
12714 --
12715 end loop;
12716 --
12717 g_cache_elpedt_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12718 --
12719 end elpedt_writecache;
12720 --
12721 procedure elpedt_getcacdets
12722 (p_effective_date in date,
12723 p_business_group_id in number,
12724 p_eligy_prfl_id in number,
12725 p_refresh_cache in boolean default FALSE,
12726 p_inst_set out nocopy ben_elp_cache.g_cache_elpedt_instor,
12727 p_inst_count out nocopy number) is
12728 --
12729 l_proc varchar2(72) := 'elpedt_getcacdets';
12730 l_torrwnum pls_integer;
12731 l_insttorrw_num pls_integer;
12732 l_index pls_integer;
12733 --
12734 l_not_hash_found boolean;
12735 --
12736 begin
12737 --
12738 -- Flush the cache
12739 --
12740 if p_refresh_cache then
12741 --
12742 g_cache_elpedt_lookup.delete;
12743 g_cache_elpedt_inst.delete;
12744 --
12745 end if;
12746 --
12747 -- Populate the global cache
12748 --
12749 if g_cache_elpedt_lookup.count = 0 then
12750 --
12751 -- Build the cache
12752 --
12753 ben_elp_cache.elpedt_writecache
12754 (p_effective_date => p_effective_date,
12755 p_refresh_cache => p_refresh_cache);
12756 --
12757 end if;
12758 --
12759 -- Get the instance details
12760 --
12761 l_torrwnum := 0;
12762 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
12763 --
12764 -- Check if hashed value is already allocated
12765 --
12766 if g_cache_elpedt_lookup.exists(l_index) then
12767 --
12768 -- If it does exist make sure its the right one
12769 --
12770 if g_cache_elpedt_lookup(l_index).id <> p_eligy_prfl_id then
12771 --
12772 l_not_hash_found := false;
12773 --
12774 -- Loop until un-allocated has value is derived
12775 --
12776 while not l_not_hash_found loop
12777 --
12778 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
12779 --
12780 -- Check if the hash index exists, if not we can use it
12781 --
12782 -- Bug 13253435 when moved to next hash index checking whether that
12783 -- hash index 'id' is having value of p_eligy_prfl_id or not.
12784 -- If values are equal then existing from the loop
12785 if g_cache_elpedt_lookup(l_index).id = p_eligy_prfl_id then
12789 -- Bug 13253435
12786 l_not_hash_found := true;
12787 exit;
12788 end if;
12790
12791 if not g_cache_elpedt_lookup.exists(l_index) then
12792 --
12793 -- Lets store the hash value in the index
12794 --
12795 l_not_hash_found := true;
12796 exit;
12797 --
12798 else
12799 --
12800 l_not_hash_found := false;
12801 --
12802 end if;
12803 --
12804 end loop;
12805 --
12806 end if;
12807 --
12808 end if;
12809 --
12810 for l_insttorrw_num in g_cache_elpedt_lookup(l_index).starttorele_num ..
12811 g_cache_elpedt_lookup(l_index).endtorele_num loop
12812 --
12813 p_inst_set(l_torrwnum) := g_cache_elpedt_inst(l_insttorrw_num);
12814 l_torrwnum := l_torrwnum+1;
12815 --
12816 end loop;
12817 --
12818 p_inst_count := l_torrwnum;
12819 --
12820 exception
12821 --
12822 when no_data_found then
12823 --
12824 p_inst_count := 0;
12825 --
12826 end elpedt_getcacdets;
12827 --
12828 procedure elpedg_writecache
12829 (p_effective_date in date,
12830 p_refresh_cache in boolean default FALSE) is
12831 --
12832 l_proc varchar2(72) := 'elpedg_writecache';
12833 l_torrwnum pls_integer;
12834 l_prev_id number;
12835 l_id number;
12836 --
12837 cursor c_elpedg_look is
12838 select elp.eligy_prfl_id,
12839 elp.business_group_id
12840 from ben_eligy_prfl_f elp
12841 where p_effective_date
12842 between elp.effective_start_date
12843 and elp.effective_end_date
12844 and exists(select null
12845 from ben_elig_dpnt_cvrd_othr_pgm_f edg
12846 where p_effective_date
12847 between edg.effective_start_date
12848 and edg.effective_end_date
12849 and edg.eligy_prfl_id = elp.eligy_prfl_id)
12850 order by elp.eligy_prfl_id;
12851 --
12852 cursor c_elpedg_inst is
12853 select edg.eligy_prfl_id,
12854 edg.excld_flag,
12855 edg.enrl_det_dt_cd,
12856 edg.pgm_id
12857 from ben_elig_dpnt_cvrd_othr_pgm_f edg
12858 where p_effective_date
12859 between edg.effective_start_date
12860 and edg.effective_end_date
12861 order by edg.eligy_prfl_id,
12862 decode(edg.excld_flag,'Y',1,2);
12863 --
12864 l_not_hash_found boolean;
12865 --
12866 begin
12867 --
12868 for objlook in c_elpedg_look loop
12869 --
12870 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
12871 --
12872 -- Check if hashed value is already allocated
12873 --
12874 if g_cache_elpedg_lookup.exists(l_id) then
12875 --
12876 l_not_hash_found := false;
12877 --
12878 -- Loop until un-allocated has value is derived
12879 --
12880 while not l_not_hash_found loop
12881 --
12882 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12883 --
12884 -- Check if the hash index exists, if not we can use it
12885 --
12886 if not g_cache_elpedg_lookup.exists(l_id) then
12887 --
12888 -- Lets store the hash value in the index
12889 --
12890 l_not_hash_found := true;
12891 exit;
12892 --
12893 else
12894 --
12895 l_not_hash_found := false;
12896 --
12897 end if;
12898 --
12899 end loop;
12900 --
12901 end if;
12902 --
12903 g_cache_elpedg_lookup(l_id).id := objlook.eligy_prfl_id;
12904 g_cache_elpedg_lookup(l_id).fk_id := objlook.business_group_id;
12905 --
12906 end loop;
12907 --
12908 l_torrwnum := 0;
12909 l_prev_id := -1;
12910 --
12911 for objinst in c_elpedg_inst loop
12912 --
12913 -- Populate the cache lookup details
12914 --
12915 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
12916 --
12917 -- Check if hashed value is already allocated
12918 --
12919 if g_cache_elpedg_lookup(l_id).id = objinst.eligy_prfl_id then
12920 --
12921 null;
12922 --
12923 else
12924 --
12925 loop
12926 --
12927 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
12928 --
12929 if g_cache_elpedg_lookup(l_id).id = objinst.eligy_prfl_id then
12930 --
12931 exit;
12932 --
12933 end if;
12934 --
12935 end loop;
12936 --
12937 end if;
12938 --
12939 -- Check for first row
12940 --
12941 if l_prev_id = -1 then
12942 --
12943 g_cache_elpedg_lookup(l_id).starttorele_num := l_torrwnum;
12944 --
12945 elsif l_id <> l_prev_id then
12946 --
12947 g_cache_elpedg_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12948 g_cache_elpedg_lookup(l_id).starttorele_num := l_torrwnum;
12949 --
12950 end if;
12951 --
12952 -- Populate the cache instance details
12953 --
12954 g_cache_elpedg_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
12955 g_cache_elpedg_inst(l_torrwnum).excld_flag := objinst.excld_flag;
12956 g_cache_elpedg_inst(l_torrwnum).enrl_det_dt_cd := objinst.enrl_det_dt_cd;
12957 g_cache_elpedg_inst(l_torrwnum).pgm_id := objinst.pgm_id;
12958 --
12962 end loop;
12959 l_torrwnum := l_torrwnum+1;
12960 l_prev_id := l_id;
12961 --
12963 --
12964 g_cache_elpedg_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
12965 --
12966 end elpedg_writecache;
12967 --
12968 procedure elpedg_getcacdets
12969 (p_effective_date in date,
12970 p_business_group_id in number,
12971 p_eligy_prfl_id in number,
12972 p_refresh_cache in boolean default FALSE,
12973 p_inst_set out nocopy ben_elp_cache.g_cache_elpedg_instor,
12974 p_inst_count out nocopy number) is
12975 --
12976 l_proc varchar2(72) := 'elpedg_getcacdets';
12977 l_torrwnum pls_integer;
12978 l_insttorrw_num pls_integer;
12979 l_index pls_integer;
12980 --
12981 l_not_hash_found boolean;
12982 --
12983 begin
12984 --
12985 -- Flush the cache
12986 --
12987 if p_refresh_cache then
12988 --
12989 g_cache_elpedg_lookup.delete;
12990 g_cache_elpedg_inst.delete;
12991 --
12992 end if;
12993 --
12994 -- Populate the global cache
12995 --
12996 if g_cache_elpedg_lookup.count = 0 then
12997 --
12998 -- Build the cache
12999 --
13000 ben_elp_cache.elpedg_writecache
13001 (p_effective_date => p_effective_date,
13002 p_refresh_cache => p_refresh_cache);
13003 --
13004 end if;
13005 --
13006 -- Get the instance details
13007 --
13008 l_torrwnum := 0;
13009 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
13010 --
13011 -- Check if hashed value is already allocated
13012 --
13013 if g_cache_elpedg_lookup.exists(l_index) then
13014 --
13015 -- If it does exist make sure its the right one
13016 --
13017 if g_cache_elpedg_lookup(l_index).id <> p_eligy_prfl_id then
13018 --
13019 l_not_hash_found := false;
13020 --
13021 -- Loop until un-allocated has value is derived
13022 --
13023 while not l_not_hash_found loop
13024 --
13025 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
13026 --
13027 -- Check if the hash index exists, if not we can use it
13028 --
13029 -- Bug 13253435 when moved to next hash index checking whether that
13030 -- hash index 'id' is having value of p_eligy_prfl_id or not.
13031 -- If values are equal then existing from the loop
13032 if g_cache_elpedg_lookup(l_index).id = p_eligy_prfl_id then
13033 l_not_hash_found := true;
13034 exit;
13035 end if;
13036 -- Bug 13253435
13037
13038 if not g_cache_elpedg_lookup.exists(l_index) then
13039 --
13040 -- Lets store the hash value in the index
13041 --
13042 l_not_hash_found := true;
13043 exit;
13044 --
13045 else
13046 --
13047 l_not_hash_found := false;
13048 --
13049 end if;
13050 --
13051 end loop;
13052 --
13053 end if;
13054 --
13055 end if;
13056 --
13057 for l_insttorrw_num in g_cache_elpedg_lookup(l_index).starttorele_num ..
13058 g_cache_elpedg_lookup(l_index).endtorele_num loop
13059 --
13060 p_inst_set(l_torrwnum) := g_cache_elpedg_inst(l_insttorrw_num);
13061 l_torrwnum := l_torrwnum+1;
13062 --
13063 end loop;
13064 --
13065 p_inst_count := l_torrwnum;
13066 --
13067 exception
13068 --
13069 when no_data_found then
13070 --
13071 p_inst_count := 0;
13072 --
13073 end elpedg_getcacdets;
13074 --
13075 procedure elpecq_writecache
13076 (p_effective_date in date,
13077 p_refresh_cache in boolean default FALSE) is
13078 --
13079 l_proc varchar2(72) := 'elpecq_writecache';
13080 l_torrwnum pls_integer;
13081 l_prev_id number;
13082 l_id number;
13083 --
13084 cursor c_elpecq_look is
13085 select elp.eligy_prfl_id,
13086 elp.business_group_id
13087 from ben_eligy_prfl_f elp
13088 where p_effective_date
13089 between elp.effective_start_date
13090 and elp.effective_end_date
13091 and exists(select null
13092 from ben_elig_cbr_quald_bnf_f ecq
13093 where p_effective_date
13094 between ecq.effective_start_date
13095 and ecq.effective_end_date
13096 and ecq.eligy_prfl_id = elp.eligy_prfl_id)
13097 order by elp.eligy_prfl_id;
13098 --
13099 cursor c_elpecq_inst is
13100 select ecq.eligy_prfl_id,
13101 ecq.elig_cbr_quald_bnf_id pk_id,
13102 'ECQ' short_code,
13103 ecq.quald_bnf_flag,
13104 ecq.pgm_id, -- lamc added 2 fields
13105 ecq.ptip_id,
13106 ecq.criteria_score,
13107 ecq.criteria_weight
13108 from ben_elig_cbr_quald_bnf_f ecq
13109 where p_effective_date
13110 between ecq.effective_start_date
13111 and ecq.effective_end_date
13112 order by ecq.eligy_prfl_id;
13113 --
13114 l_not_hash_found boolean;
13115 --
13116 begin
13117 --
13118 for objlook in c_elpecq_look loop
13119 --
13120 l_id := ben_hash_utility.get_hashed_index(p_id => objlook.eligy_prfl_id);
13121 --
13122 -- Check if hashed value is already allocated
13123 --
13124 if g_cache_elpecq_lookup.exists(l_id) then
13125 --
13126 l_not_hash_found := false;
13127 --
13128 -- Loop until un-allocated has value is derived
13132 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
13129 --
13130 while not l_not_hash_found loop
13131 --
13133 --
13134 -- Check if the hash index exists, if not we can use it
13135 --
13136 if not g_cache_elpecq_lookup.exists(l_id) then
13137 --
13138 -- Lets store the hash value in the index
13139 --
13140 l_not_hash_found := true;
13141 exit;
13142 --
13143 else
13144 --
13145 l_not_hash_found := false;
13146 --
13147 end if;
13148 --
13149 end loop;
13150 --
13151 end if;
13152 --
13153 g_cache_elpecq_lookup(l_id).id := objlook.eligy_prfl_id;
13154 g_cache_elpecq_lookup(l_id).fk_id := objlook.business_group_id;
13155 --
13156 end loop;
13157 --
13158 l_torrwnum := 0;
13159 l_prev_id := -1;
13160 --
13161 for objinst in c_elpecq_inst loop
13162 --
13163 -- Populate the cache lookup details
13164 --
13165 l_id := ben_hash_utility.get_hashed_index(p_id => objinst.eligy_prfl_id);
13166 --
13167 -- Check if hashed value is already allocated
13168 --
13169 if g_cache_elpecq_lookup(l_id).id = objinst.eligy_prfl_id then
13170 --
13171 null;
13172 --
13173 else
13174 --
13175 loop
13176 --
13177 l_id := ben_hash_utility.get_next_hash_index(p_hash_index => l_id);
13178 --
13179 if g_cache_elpecq_lookup(l_id).id = objinst.eligy_prfl_id then
13180 --
13181 exit;
13182 --
13183 end if;
13184 --
13185 end loop;
13186 --
13187 end if;
13188 --
13189 -- Check for first row
13190 --
13191 if l_prev_id = -1 then
13192 --
13193 g_cache_elpecq_lookup(l_id).starttorele_num := l_torrwnum;
13194 --
13195 elsif l_id <> l_prev_id then
13196 --
13197 g_cache_elpecq_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
13198 g_cache_elpecq_lookup(l_id).starttorele_num := l_torrwnum;
13199 --
13200 end if;
13201 --
13202 -- Populate the cache instance details
13203 --
13204 g_cache_elpecq_inst(l_torrwnum).eligy_prfl_id := objinst.eligy_prfl_id;
13205 g_cache_elpecq_inst(l_torrwnum).pk_id := objinst.pk_id;
13206 g_cache_elpecq_inst(l_torrwnum).short_code := objinst.short_code;
13207 g_cache_elpecq_inst(l_torrwnum).criteria_score := objinst.criteria_score;
13208 g_cache_elpecq_inst(l_torrwnum).criteria_weight := objinst.criteria_weight;
13209 g_cache_elpecq_inst(l_torrwnum).quald_bnf_flag := objinst.quald_bnf_flag;
13210 -- lamc added these 2 lines:
13211 g_cache_elpecq_inst(l_torrwnum).pgm_id := objinst.pgm_id;
13212 g_cache_elpecq_inst(l_torrwnum).ptip_id := objinst.ptip_id;
13213 --
13214 l_torrwnum := l_torrwnum+1;
13215 l_prev_id := l_id;
13216 --
13217 end loop;
13218 --
13219 g_cache_elpecq_lookup(l_prev_id).endtorele_num := l_torrwnum-1;
13220 --
13221 end elpecq_writecache;
13222 --
13223 procedure elpecq_getcacdets
13224 (p_effective_date in date,
13225 p_business_group_id in number,
13226 p_eligy_prfl_id in number,
13227 p_refresh_cache in boolean default FALSE,
13228 p_inst_set out nocopy ben_elp_cache.g_cache_elpecq_instor,
13229 p_inst_count out nocopy number) is
13230 --
13231 l_proc varchar2(72) := 'elpecq_getcacdets';
13232 l_torrwnum pls_integer;
13233 l_insttorrw_num pls_integer;
13234 l_index pls_integer;
13235 --
13236 l_not_hash_found boolean;
13237 --
13238 begin
13239 --
13240 -- Flush the cache
13241 --
13242 if p_refresh_cache then
13243 --
13244 g_cache_elpecq_lookup.delete;
13245 g_cache_elpecq_inst.delete;
13246 --
13247 end if;
13248 --
13249 -- Populate the global cache
13250 --
13251 if g_cache_elpecq_lookup.count = 0 then
13252 --
13253 -- Build the cache
13254 --
13255 ben_elp_cache.elpecq_writecache
13256 (p_effective_date => p_effective_date,
13257 p_refresh_cache => p_refresh_cache);
13258 --
13259 end if;
13260 --
13261 -- Get the instance details
13262 --
13263 l_torrwnum := 0;
13264 l_index := ben_hash_utility.get_hashed_index(p_id => p_eligy_prfl_id);
13265 --
13266 -- Check if hashed value is already allocated
13267 --
13268 if g_cache_elpecq_lookup.exists(l_index) then
13269 --
13270 -- If it does exist make sure its the right one
13271 --
13272 if g_cache_elpecq_lookup(l_index).id <> p_eligy_prfl_id then
13273 --
13274 l_not_hash_found := false;
13275 --
13276 -- Loop until un-allocated has value is derived
13277 --
13278 while not l_not_hash_found loop
13279 --
13280 l_index := ben_hash_utility.get_next_hash_index(p_hash_index => l_index);
13281 --
13282 -- Check if the hash index exists, if not we can use it
13283 --
13284 -- Bug 13253435 when moved to next hash index checking whether that
13285 -- hash index 'id' is having value of p_eligy_prfl_id or not.
13286 -- If values are equal then existing from the loop
13287 if g_cache_elpecq_lookup(l_index).id = p_eligy_prfl_id then
13288 l_not_hash_found := true;
13289 exit;
13290 end if;
13291 -- Bug 13253435
13292
13293 if not g_cache_elpecq_lookup.exists(l_index) then
13294 --
13298 exit;
13295 -- Lets store the hash value in the index
13296 --
13297 l_not_hash_found := true;
13299 --
13300 else
13301 --
13302 l_not_hash_found := false;
13303 --
13304 end if;
13305 --
13306 end loop;
13307 --
13308 end if;
13309 --
13310 end if;
13311 --
13312 for l_insttorrw_num in g_cache_elpecq_lookup(l_index).starttorele_num ..
13313 g_cache_elpecq_lookup(l_index).endtorele_num loop
13314 --
13315 p_inst_set(l_torrwnum) := g_cache_elpecq_inst(l_insttorrw_num);
13316 l_torrwnum := l_torrwnum+1;
13317 --
13318 end loop;
13319 --
13320 p_inst_count := l_torrwnum;
13321 --
13322 exception
13323 --
13324 when no_data_found then
13325 --
13326 p_inst_count := 0;
13327 --
13328 end elpecq_getcacdets;
13329 -- ---------------------------------------------------------------------
13330 -- eligibility profile - Disability
13331 -- ---------------------------------------------------------------------
13332 procedure elpeds_getdets
13333 (p_effective_date in date
13334 ,p_eligy_prfl_id in number
13335 --
13336 ,p_inst_set in out nocopy g_elp_cache
13337 )
13338 is
13339 --
13340 l_proc varchar2(72) := g_package||'.elpeds_getdets';
13341 --
13342 l_inst_set g_elp_cache := g_elp_cache();
13343 --
13344 l_elenum pls_integer;
13345 --
13346 cursor c_instance
13347 (c_eligy_prfl_id number
13348 ,c_effective_date date
13349 )
13350 is
13351 select tab.eligy_prfl_id,
13352 tab.elig_dsbld_prte_id pk_id,
13353 'EDB' short_code,
13354 tab.dsbld_cd,
13355 tab.excld_flag,
13356 tab.criteria_score,
13357 tab.criteria_weight
13358 from ben_elig_dsbld_prte_f tab
13359 where tab.eligy_prfl_id = c_eligy_prfl_id
13360 and c_effective_date
13361 between tab.effective_start_date and tab.effective_end_date
13362 order by tab.eligy_prfl_id,
13363 decode(tab.excld_flag,'Y',1,2);
13364 --
13365 begin
13366 --
13367 l_elenum := 1;
13368 --
13369 for instrow in c_instance
13370 (c_eligy_prfl_id => p_eligy_prfl_id
13371 ,c_effective_date => p_effective_date
13372 )
13373 loop
13374 --
13375 l_inst_set.extend(1);
13376 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13377 l_inst_set(l_elenum).pk_id := instrow.pk_id;
13378 l_inst_set(l_elenum).short_code := instrow.short_code;
13379 l_inst_set(l_elenum).criteria_score := instrow.criteria_score;
13380 l_inst_set(l_elenum).criteria_weight := instrow.criteria_weight;
13381 l_inst_set(l_elenum).v230_val := instrow.dsbld_cd;
13382 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13383 l_elenum := l_elenum+1;
13384 --
13385 end loop;
13386 --
13387 p_inst_set := l_inst_set;
13388 --
13389 exception
13390 --
13391 when no_data_found then
13392 --
13393 null;
13394 --
13395 end elpeds_getdets;
13396 --
13397 -- ---------------------------------------------------------------------
13398 -- eligibility profile - Tobacco use
13399 -- ---------------------------------------------------------------------
13400 procedure elpetu_getdets
13401 (p_effective_date in date
13402 ,p_eligy_prfl_id in number
13403 --
13404 ,p_inst_set in out nocopy g_elp_cache
13405 )
13406 is
13407 --
13408 l_proc varchar2(72) := g_package||'.elpetu_getdets';
13409 --
13410 l_inst_set g_elp_cache := g_elp_cache();
13411 --
13412 l_elenum pls_integer;
13413 --
13414 cursor c_instance
13415 (c_eligy_prfl_id number
13416 ,c_effective_date date
13417 )
13418 is
13419 select tab.eligy_prfl_id,
13420 tab.elig_tbco_use_prte_id pk_id,
13421 'ETU' short_code,
13422 tab.uses_tbco_flag,
13423 tab.excld_flag,
13424 tab.criteria_score,
13425 tab.criteria_weight
13426 from ben_elig_tbco_use_prte_f tab
13427 where tab.eligy_prfl_id = c_eligy_prfl_id
13428 and c_effective_date
13429 between tab.effective_start_date and tab.effective_end_date
13430 order by tab.eligy_prfl_id,
13431 decode(tab.excld_flag,'Y',1,2);
13432 --
13433 begin
13434 --
13435 l_elenum := 1;
13436 --
13437 for instrow in c_instance
13438 (c_eligy_prfl_id => p_eligy_prfl_id
13439 ,c_effective_date => p_effective_date
13440 )
13441 loop
13442 --
13443 l_inst_set.extend(1);
13444 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13445 l_inst_set(l_elenum).v230_val := instrow.uses_tbco_flag;
13446 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13447 --start 4446984
13448 l_inst_set(l_elenum).short_code := instrow.short_code;
13449 l_inst_set(l_elenum).pk_id := instrow.pk_id;
13450 l_inst_set(l_elenum).criteria_score := instrow.criteria_score;
13451 l_inst_set(l_elenum).criteria_weight := instrow.criteria_weight;
13452 --end 4446984
13453 l_elenum := l_elenum+1;
13454 --
13455 end loop;
13456 --
13457 p_inst_set := l_inst_set;
13458 --
13459 exception
13460 --
13464 --
13461 when no_data_found then
13462 --
13463 null;
13465 end elpetu_getdets;
13466 --
13467 -- ---------------------------------------------------------------------
13468 -- eligibility profile - Total coverage volume
13469 -- ---------------------------------------------------------------------
13470 --
13471 procedure elpetc_getdets
13472 (p_effective_date in date
13473 ,p_eligy_prfl_id in number
13474 --
13475 ,p_inst_set in out nocopy g_elp_cache ) is
13476 --
13477 l_proc varchar2(80) := g_package || '.elpetc_getdets';
13478 --
13479 l_inst_set g_elp_cache := g_elp_cache();
13480 --
13481 l_elenum pls_integer;
13482 --
13483 cursor c_instance
13484 (c_eligy_prfl_id number
13485 ,c_effective_date date ) is
13486 select etc.eligy_prfl_id
13487 , etc.mn_cvg_vol_amt
13488 , etc.mx_cvg_vol_amt
13489 , etc.no_mn_cvg_vol_amt_apls_flag
13490 , etc.no_mx_cvg_vol_amt_apls_flag
13491 from ben_elig_ttl_cvg_vol_prte_f etc
13492 where etc.eligy_prfl_id = c_eligy_prfl_id
13493 and c_effective_date
13494 between etc.effective_start_date and etc.effective_end_date
13495 order by etc.eligy_prfl_id;
13496 --
13497 begin
13498 --
13499 l_elenum := 1;
13500 --
13501 for instrow in c_instance
13502 (c_eligy_prfl_id => p_eligy_prfl_id
13503 ,c_effective_date => p_effective_date
13504 )
13505 loop
13506 --
13507 l_inst_set.extend(1);
13508 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13509 l_inst_set(l_elenum).num_val := instrow.mn_cvg_vol_amt;
13510 l_inst_set(l_elenum).num_val1 := instrow.mx_cvg_vol_amt;
13511 l_elenum := l_elenum+1;
13512 --
13513 end loop;
13514 --
13515 p_inst_set := l_inst_set;
13516 --
13517 exception
13518 --
13519 when no_data_found then
13520 --
13521 null ;
13522 --
13523 end;
13524 --
13525 -- ---------------------------------------------------------------------
13526 -- eligibility profile - Total participants
13527 -- ---------------------------------------------------------------------
13528 --
13529 procedure elpetp_getdets
13530 (p_effective_date in date
13531 ,p_eligy_prfl_id in number
13532 --
13533 ,p_inst_set in out nocopy g_elp_cache ) is
13534 --
13535 l_proc varchar2(80) := g_package || '.elpetp_getdets';
13536 --
13537 l_inst_set g_elp_cache := g_elp_cache();
13538 --
13539 l_elenum pls_integer;
13540 --
13541 cursor c_instance
13542 (c_eligy_prfl_id number
13543 ,c_effective_date date ) is
13544 select etp.eligy_prfl_id
13545 , etp.mn_prtt_num
13546 , etp.mx_prtt_num
13547 , etp.no_mn_prtt_num_apls_flag
13548 , etp.no_mx_prtt_num_apls_flag
13549 from ben_elig_ttl_prtt_prte_f etp
13550 where etp.eligy_prfl_id = c_eligy_prfl_id
13551 and c_effective_date
13552 between etp.effective_start_date and etp.effective_end_date
13553 order by etp.eligy_prfl_id;
13554 --
13555 begin
13556 --
13557 l_elenum := 1;
13558 --
13559 for instrow in c_instance
13560 (c_eligy_prfl_id => p_eligy_prfl_id
13561 ,c_effective_date => p_effective_date
13562 )
13563 loop
13564 --
13565 l_inst_set.extend(1);
13566 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13567 l_inst_set(l_elenum).num_val := instrow.mn_prtt_num;
13568 l_inst_set(l_elenum).num_val1 := instrow.mx_prtt_num;
13569 l_elenum := l_elenum+1;
13570 --
13571 end loop;
13572 --
13573 p_inst_set := l_inst_set;
13574 --
13575 exception
13576 --
13577 when no_data_found then
13578 --
13579 null ;
13580 --
13581 end;
13582 --
13583 -- ---------------------------------------------------------------------
13584 -- eligibility profile - Participation in another plan
13585 -- ---------------------------------------------------------------------
13586 --
13587 procedure elpeop_getdets
13588 (p_effective_date in date
13589 ,p_eligy_prfl_id in number
13590 --
13591 ,p_inst_set in out nocopy g_elp_cache
13592 )
13593 is
13594 --
13595 l_proc varchar2(72) := g_package||'.elpeop_getdets';
13596 --
13597 l_inst_set g_elp_cache := g_elp_cache();
13598 --
13599 l_elenum pls_integer;
13600 --
13601 cursor c_instance
13602 (c_eligy_prfl_id number
13603 ,c_effective_date date
13604 )
13605 is
13606 select tab.eligy_prfl_id,
13607 tab.pl_id,
13608 tab.excld_flag
13609 from ben_elig_anthr_pl_prte_f tab
13610 where tab.eligy_prfl_id = c_eligy_prfl_id
13611 and c_effective_date
13612 between tab.effective_start_date and tab.effective_end_date
13613 order by tab.eligy_prfl_id,
13614 decode(tab.excld_flag,'Y',1,2);
13615 --
13616 begin
13617 --
13618 l_elenum := 1;
13619 --
13620 for instrow in c_instance
13621 (c_eligy_prfl_id => p_eligy_prfl_id
13622 ,c_effective_date => p_effective_date
13623 )
13624 loop
13625 --
13626 l_inst_set.extend(1);
13627 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13631 --
13628 l_inst_set(l_elenum).num_val := instrow.pl_id;
13629 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13630 l_elenum := l_elenum+1;
13632 end loop;
13633 --
13634 p_inst_set := l_inst_set;
13635 --
13636 exception
13637 --
13638 when no_data_found then
13639 --
13640 null;
13641 --
13642 end elpeop_getdets;
13643 --
13644 -- ---------------------------------------------------------------------
13645 -- eligibility profile - Health Coverage Selected
13646 -- ---------------------------------------------------------------------
13647 --
13648 procedure elpehc_getdets
13649 (p_effective_date in date
13650 ,p_eligy_prfl_id in number
13651 --
13652 ,p_inst_set in out nocopy g_elp_cache
13653 )
13654 is
13655 --
13656 l_proc varchar2(72) := g_package||'.elpehc_getdets';
13657 --
13658 l_inst_set g_elp_cache := g_elp_cache();
13659 --
13660 l_elenum pls_integer;
13661 --
13662 cursor c_instance
13663 (c_eligy_prfl_id number
13664 ,c_effective_date date
13665 )
13666 is
13667 select tab.eligy_prfl_id,
13668 tab.pl_typ_opt_typ_id,
13669 tab.oipl_id,
13670 tab.excld_flag
13671 from ben_elig_hlth_cvg_prte_f tab
13672 where tab.eligy_prfl_id = c_eligy_prfl_id
13673 and c_effective_date
13674 between tab.effective_start_date and tab.effective_end_date
13675 order by tab.eligy_prfl_id,
13676 decode(tab.excld_flag,'Y',1,2);
13677 --
13678 begin
13679 --
13680 l_elenum := 1;
13681 --
13682 for instrow in c_instance
13683 (c_eligy_prfl_id => p_eligy_prfl_id
13684 ,c_effective_date => p_effective_date
13685 )
13686 loop
13687 --
13688 l_inst_set.extend(1);
13689 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13690 l_inst_set(l_elenum).num_val := instrow.pl_typ_opt_typ_id;
13691 l_inst_set(l_elenum).num_val1 := instrow.oipl_id;
13692 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13693 l_elenum := l_elenum+1;
13694 --
13695 end loop;
13696 --
13697 p_inst_set := l_inst_set;
13698 --
13699 exception
13700 --
13701 when no_data_found then
13702 --
13703 null;
13704 --
13705 end elpehc_getdets;
13706 --
13707 -- ---------------------------------------------------------------------
13708 -- eligibility profile - Competency
13709 -- ---------------------------------------------------------------------
13710 --
13711 procedure elpecy_getdets
13712 (p_effective_date in date
13713 ,p_eligy_prfl_id in number
13714 --
13715 ,p_inst_set in out nocopy g_elp_cache
13716 )
13717 is
13718 --
13719 l_proc varchar2(72) := g_package||'.elpecy_getdets';
13720 --
13721 l_inst_set g_elp_cache := g_elp_cache();
13722 --
13723 l_elenum pls_integer;
13724 --
13725 cursor c_instance
13726 (c_eligy_prfl_id number
13727 ,c_effective_date date
13728 )
13729 is
13730 select tab.eligy_prfl_id,
13731 tab.elig_comptncy_prte_id pk_id,
13732 'ECY' short_code,
13733 tab.competence_id,
13734 tab.rating_level_id,
13735 tab.excld_flag,
13736 tab.criteria_score,
13737 tab.criteria_weight
13738 from ben_elig_comptncy_prte_f tab
13739 where tab.eligy_prfl_id = c_eligy_prfl_id
13740 and c_effective_date
13741 between tab.effective_start_date and tab.effective_end_date
13742 order by tab.eligy_prfl_id,
13743 decode(tab.excld_flag,'Y',1,2);
13744 --
13745 begin
13746 --
13747 l_elenum := 1;
13748 --
13749 for instrow in c_instance
13750 (c_eligy_prfl_id => p_eligy_prfl_id
13751 ,c_effective_date => p_effective_date
13752 )
13753 loop
13754 --
13755 l_inst_set.extend(1);
13756 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13757 l_inst_set(l_elenum).num_val := instrow.competence_id;
13758 l_inst_set(l_elenum).num_val1 := instrow.rating_level_id;
13759 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13760 --start 4446984
13761 l_inst_set(l_elenum).short_code := instrow.short_code;
13762 l_inst_set(l_elenum).pk_id := instrow.pk_id;
13763 l_inst_set(l_elenum).criteria_score := instrow.criteria_score;
13764 l_inst_set(l_elenum).criteria_weight := instrow.criteria_weight;
13765 --end 4446984
13766 l_elenum := l_elenum+1;
13767 --
13768 end loop;
13769 --
13770 p_inst_set := l_inst_set;
13771 --
13772 exception
13773 --
13774 when no_data_found then
13775 --
13776 null;
13777 --
13778 end elpecy_getdets;
13779 --
13780 -- ---------------------------------------------------------------------
13781 -- eligibility profile - Quartile in Grade
13782 -- ---------------------------------------------------------------------
13783 --
13784 procedure elpeqg_getdets
13785 (p_effective_date in date
13786 ,p_eligy_prfl_id in number
13787 --
13788 ,p_inst_set in out nocopy g_elp_cache
13789 ) is
13790 --
13791 l_proc varchar2(72) := g_package||'.elpeqg_getdets';
13792 --
13793 l_inst_set g_elp_cache := g_elp_cache();
13794 --
13795 l_elenum pls_integer;
13796 --
13797 cursor c_instance
13798 (c_eligy_prfl_id number
13799 ,c_effective_date date
13800 )
13801 is
13802 select tab.eligy_prfl_id,
13806 tab.excld_flag,
13803 tab.elig_qua_in_gr_prte_id pk_id,
13804 'EQG' short_code,
13805 tab.quar_in_grade_cd,
13807 tab.criteria_score,
13808 tab.criteria_weight
13809 from ben_elig_qua_in_gr_prte_f tab
13810 where tab.eligy_prfl_id = c_eligy_prfl_id
13811 and c_effective_date
13812 between tab.effective_start_date and tab.effective_end_date
13813 order by tab.eligy_prfl_id,
13814 decode(tab.excld_flag,'Y',1,2);
13815 --
13816 begin
13817 --
13818 l_elenum := 1;
13819 --
13820 for instrow in c_instance
13821 (c_eligy_prfl_id => p_eligy_prfl_id
13822 ,c_effective_date => p_effective_date
13823 )
13824 loop
13825 --
13826 l_inst_set.extend(1);
13827 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13828 l_inst_set(l_elenum).v230_val := instrow.quar_in_grade_cd;
13829 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13830 l_elenum := l_elenum+1;
13831 --
13832 end loop;
13833 --
13834 p_inst_set := l_inst_set;
13835 --
13836 exception
13837 --
13838 when no_data_found then
13839 --
13840 null;
13841 --
13842 end elpeqg_getdets;
13843 --
13844 -- ---------------------------------------------------------------------
13845 -- eligibility profile - Performance Rating
13846 -- ---------------------------------------------------------------------
13847 --
13848 procedure elpepr_getdets
13849 (p_effective_date in date
13850 ,p_eligy_prfl_id in number
13851 --
13852 ,p_inst_set in out nocopy g_elp_cache
13853 ) is
13854
13855 --
13856 l_proc varchar2(72) := g_package||'.elpepr_getdets';
13857 --
13858 l_inst_set g_elp_cache := g_elp_cache();
13859 --
13860 l_elenum pls_integer;
13861 --
13862 cursor c_instance
13863 (c_eligy_prfl_id number
13864 ,c_effective_date date
13865 )
13866 is
13867 select tab.eligy_prfl_id,
13868 tab.elig_perf_rtng_prte_id pk_id,
13869 'ERG' short_code,
13870 tab.perf_rtng_cd,
13871 tab.event_type,
13872 tab.excld_flag,
13873 tab.criteria_score,
13874 tab.criteria_weight
13875 from ben_elig_perf_rtng_prte_f tab
13876 where tab.eligy_prfl_id = c_eligy_prfl_id
13877 and c_effective_date
13878 between tab.effective_start_date and tab.effective_end_date
13879 order by tab.eligy_prfl_id,
13880 decode(tab.excld_flag,'Y',1,2);
13881 --
13882 begin
13883 --
13884 l_elenum := 1;
13885 --
13886 for instrow in c_instance
13887 (c_eligy_prfl_id => p_eligy_prfl_id
13888 ,c_effective_date => p_effective_date
13889 )
13890 loop
13891 --
13892 l_inst_set.extend(1);
13893 l_inst_set(l_elenum).eligy_prfl_id := instrow.eligy_prfl_id;
13894 l_inst_set(l_elenum).v230_val := instrow.perf_rtng_cd;
13895 l_inst_set(l_elenum).v230_val1 := instrow.event_type;
13896 l_inst_set(l_elenum).excld_flag := instrow.excld_flag;
13897 l_elenum := l_elenum+1;
13898 --
13899 end loop;
13900 --
13901 p_inst_set := l_inst_set;
13902 --
13903 exception
13904 --
13905 when no_data_found then
13906 --
13907 null;
13908 --
13909 end elpepr_getdets;
13910 --
13911 procedure clear_down_cache
13912 is
13913 --
13914 --
13915 begin
13916 --
13917 -- On demand cache structures
13918 --
13919 g_copcep_odlookup.delete;
13920 g_copcep_odinst.delete;
13921 g_copcep_odcached := 0;
13922 g_copcep_nxelenum := null;
13923 --
13924 -- Clear down all cache structures
13925 --
13926 g_cobcep_lookup.delete;
13927 g_cobcep_inst.delete;
13928 g_cobcep_cached := FALSE;
13929 --
13930 g_elpept_lookup.delete;
13931 g_elpept_inst.delete;
13932 g_elpees_lookup.delete;
13933 g_elpees_inst.delete;
13934 g_elpesa_lookup.delete;
13935 g_elpesa_inst.delete;
13936 g_elpehs_lookup.delete;
13937 g_elpehs_inst.delete;
13938 g_elpels_lookup.delete;
13939 g_elpels_inst.delete;
13940 g_elpecp_lookup.delete;
13941 g_elpecp_inst.delete;
13942 --
13943 -- Old
13944 --
13945 g_cache_elpept_lookup.delete;
13946 g_cache_elpept_inst.delete;
13947 g_cache_elpepg_lookup.delete;
13948 g_cache_elpepg_inst.delete;
13949 g_cache_elpees_lookup.delete;
13950 g_cache_elpees_inst.delete;
13951 g_cache_elpels_lookup.delete;
13952 g_cache_elpels_inst.delete;
13953 g_cache_elpecp_lookup.delete;
13954 g_cache_elpecp_inst.delete;
13955 g_cache_elpewl_lookup.delete;
13956 g_cache_elpewl_inst.delete;
13957 g_cache_elpeou_lookup.delete;
13958 g_cache_elpeou_inst.delete;
13959 g_cache_elpehs_lookup.delete;
13960 g_cache_elpehs_inst.delete;
13961 g_cache_elpefp_lookup.delete;
13962 g_cache_elpefp_inst.delete;
13963 g_cache_elpesh_lookup.delete;
13964 g_cache_elpesh_inst.delete;
13965 g_cache_elpecl_lookup.delete;
13966 g_cache_elpecl_inst.delete;
13967 g_cache_elpehw_lookup.delete;
13968 g_cache_elpehw_inst.delete;
13969 g_cache_elpepf_lookup.delete;
13970 g_cache_elpepf_inst.delete;
13971 g_cache_elpegr_lookup.delete;
13972 g_cache_elpegr_inst.delete;
13973 g_cache_elpejp_lookup.delete;
13974 g_cache_elpejp_inst.delete;
13975 g_cache_elpepb_lookup.delete;
13976 g_cache_elpepb_inst.delete;
13977 g_cache_elpepy_lookup.delete;
13978 g_cache_elpepy_inst.delete;
13982 g_cache_elpelu_inst.delete;
13979 g_cache_elpebu_lookup.delete;
13980 g_cache_elpebu_inst.delete;
13981 g_cache_elpelu_lookup.delete;
13983 g_cache_elpelr_lookup.delete;
13984 g_cache_elpelr_inst.delete;
13985 g_cache_elpeap_lookup.delete;
13986 g_cache_elpeap_inst.delete;
13987 g_cache_elpepz_lookup.delete;
13988 g_cache_elpepz_inst.delete;
13989 g_cache_elpebn_lookup.delete;
13990 g_cache_elpebn_inst.delete;
13991 g_cache_elpeln_lookup.delete;
13992 g_cache_elpeln_inst.delete;
13993 g_cache_elpepp_lookup.delete;
13994 g_cache_elpepp_inst.delete;
13995 g_cache_elpesa_lookup.delete;
13996 g_cache_elpesa_inst.delete;
13997 g_cache_elpeoy_lookup.delete;
13998 g_cache_elpeoy_inst.delete;
13999 g_cache_elpetd_lookup.delete;
14000 g_cache_elpetd_inst.delete;
14001 g_cache_elpeno_lookup.delete;
14002 g_cache_elpeno_inst.delete;
14003 g_cache_elpeep_lookup.delete;
14004 g_cache_elpeep_inst.delete;
14005 g_cache_elpeei_lookup.delete;
14006 g_cache_elpeei_inst.delete;
14007 g_cache_elpeeg_lookup.delete;
14008 g_cache_elpeeg_inst.delete;
14009 g_cache_elpedp_lookup.delete;
14010 g_cache_elpedp_inst.delete;
14011 g_cache_elpelv_lookup.delete;
14012 g_cache_elpelv_inst.delete;
14013 g_cache_elpeom_lookup.delete;
14014 g_cache_elpeom_inst.delete;
14015 g_cache_elpeai_lookup.delete;
14016 g_cache_elpeai_inst.delete;
14017 g_cache_elpedi_lookup.delete;
14018 g_cache_elpedi_inst.delete;
14019 g_cache_elpeet_lookup.delete;
14020 g_cache_elpeet_inst.delete;
14021 g_cache_elpedt_lookup.delete;
14022 g_cache_elpedt_inst.delete;
14023 g_cache_elpedg_lookup.delete;
14024 g_cache_elpedg_inst.delete;
14025 g_cache_elpecq_lookup.delete;
14026 g_cache_elpecq_inst.delete;
14027 --
14028 -- Grab back memory
14029 --
14030 begin
14031 --
14032 dbms_session.free_unused_user_memory;
14033 --
14034 end;
14035 --
14036 end clear_down_cache;
14037 --
14038 end ben_elp_cache;
14039 --