DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SEED_SOE_PKG

Source


1 PACKAGE BODY pay_seed_soe_pkg AS
2 /* $Header: paysesoe.pkb 120.0 2005/05/29 02:42 appldev noship $ */
3 
4 PROCEDURE update_profile(
5                        errbuf                   out NOCOPY varchar2
6                       ,retcode                  out NOCOPY varchar2
7                       ,p_business_group_id      in  varchar2
8                       ,p_action                 in  varchar2) IS
9 
10     cursor get_legislation_code is
11     select legislation_code
12     from   per_business_groups
13     where  business_group_id = p_business_group_id;
14 
15     cursor get_profile(p_leg_code IN varchar2)  is
16     select decode(rule_mode,'Y','ENABLE','DISABLE')
17     from   pay_legislative_field_info
18     where  legislation_code = p_leg_code
19     and    field_name = 'ONLINE_SOE'
20     and    rule_type  = 'DISPLAY';
21 
22     l_leg_code      varchar2(50);
23     l_rule_mode     varchar2(50);
24 
25 BEGIN
26       OPEN  get_legislation_code;
27       FETCH get_legislation_code into l_leg_code;
28       CLOSE get_legislation_code;
29 
30       OPEN  get_profile(l_leg_code);
31       FETCH get_profile into l_rule_mode;
32 
33       IF get_profile%FOUND THEN
34          IF l_rule_mode <> p_action THEN
35             update pay_legislative_field_info
36             set    rule_mode = decode(p_action,'ENABLE','Y','N')
37             where  legislation_code = l_leg_code
38             and    field_name = 'ONLINE_SOE'
39             and    rule_type  = 'DISPLAY';
40          END IF;
41       ELSE
42          insert into pay_legislative_field_info(field_name, legislation_code,rule_type,rule_mode)
43          select 'ONLINE_SOE',
44                 l_leg_code,
45                 'DISPLAY',
46                 decode(p_action,'ENABLE','Y','N')
47          from   dual;
48 
49       END IF;
50 
51       CLOSE get_profile;
52 
53 END update_profile;
54 
55 END;