DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_PIL_CACHE

Source


1 package body ben_pil_cache as
2 /* $Header: benpilch.pkb 115.2 2003/02/12 12:07:38 rpgupta noship $ */
3 --
4 /*
5 +==============================================================================+
6 |			 Copyright (c) 1997 Oracle Corporation		       |
7 |			    Redwood Shores, California, USA		       |
8 |				All rights reserved.			       |
9 +==============================================================================+
10 --
11 History
12   Version    Date	Author	   Comments
13   ---------  ---------	---------- --------------------------------------------
14   115.0      17-Aug-01	mhoyes     Created.
15   115.1      26-Nov-01	mhoyes     - dbdrv lines.
16   -----------------------------------------------------------------------------
17 */
18 --
19 -- Globals.
20 --
21 g_package varchar2(50) := 'ben_pil_cache.';
22 --
23 -- 0 - Always refresh
24 -- 1 - Initialise cache
25 -- 2 - Cache hit
26 --
27 g_pil_cached     pls_integer := 0;
28 --
29 g_pil_current    g_pil_inst_row;
30 --
31 procedure PIL_GetPILDets
32   (p_per_in_ler_id in     number
33   ,p_inst_row      in out NOCOPY g_pil_inst_row
34   )
35 is
36   --
37   cursor c_instance
38     (c_pil_id number
39     )
40   is
41     select pil.per_in_ler_id,
42            pil.ntfn_dt
43     from  ben_per_in_ler pil
44     where pil.per_in_ler_id = c_pil_id;
45   --
46   l_reset g_pil_inst_row;
47   --
48 begin
49   --
50   -- Check for already cached or a change in current PIL ID
51   --
52   if nvl(g_pil_current.per_in_ler_id,-9999) <> p_per_in_ler_id
53     or g_pil_cached < 2
54   then
55     --
56     open c_instance
57       (c_pil_id => p_per_in_ler_id
58       );
59     fetch c_instance into g_pil_current;
60     if c_instance%notfound then
61       --
62       g_pil_current := l_reset;
63       --
64     end if;
65     close c_instance;
66     --
67     if g_pil_cached = 1
68     then
69       --
70       g_pil_cached := 2;
71       --
72     end if;
73     --
74   end if;
75   --
76   p_inst_row := g_pil_current;
77   --
78 end PIL_GetPILDets;
79 --
80 procedure clear_down_cache
81 is
82 
83   l_reset g_pil_inst_row;
84 
85 begin
86   --
87   g_pil_current := l_reset;
88   g_pil_cached  := 1;
89   --
90 end clear_down_cache;
91 --
92 end ben_pil_cache;