1 package body hr_leg_rule as
2 /* $Header: pylegrle.pkb 115.1 99/07/17 06:15:33 porting ship $ */
3 --
4 -- these two variables cache the independent_time_periods flag
5 last_tested_business_group_id number;
6 last_found_flag varchar2(240);
7 --
8 function get_independent_periods
9 (l_business_group_id in number)
10 return varchar2 is
11 begin
12 /*
13 For efficiency (since the value is likely to be the same
14 for any given installation) we "cache" the flag's value
15 against business_group_id.
16 */
17 if hr_leg_rule.last_tested_business_group_id is null or
18 hr_leg_rule.last_tested_business_group_id <> l_business_group_id then
19 --
20 -- we need to fetch the value
21 begin
22 select LR.rule_mode
23 into hr_leg_rule.last_found_flag
24 from pay_legislation_rules LR
25 where LR.rule_type = 'I'
26 and LR.legislation_code =
27 (select BG.legislation_code
28 from per_business_groups BG
29 where BG.business_group_id = l_business_group_id);
30 exception
31 -- if there is no rule, we set a default (independent periods).
32 when no_data_found then hr_leg_rule.last_found_flag := 'Y';
33 end;
34 --
35 hr_leg_rule.last_tested_business_group_id := l_business_group_id;
36 end if;
37 return hr_leg_rule.last_found_flag;
38 --
39 end get_independent_periods;
40 --
41 -- Initialisation Section
42 -- ----------------------
43 --
44 begin
45 hr_leg_rule.last_tested_business_group_id := null;
46 --
47 end hr_leg_rule;