DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_MASS_MOVES_PKG

Source


1 package body PER_MASS_MOVES_PKG as
2 /* $Header: pemmv01t.pkb 115.0 99/07/18 14:02:06 porting ship $ */
3 --
4 --
5 procedure insert_row
6                   (p_business_group_id in number,
7                    p_effective_date in date,
8                    p_new_organization_id in number,
9                    p_source_organization_id in number,
10                    p_reason in varchar2,
11                    p_status in varchar2,
12                    p_mass_move_id out number,
13                    p_row_id out varchar2)
14   is
15 
16   l_mass_move_id number(15);
17   l_row_id varchar2(18) ;
18 
19   cursor c1 is
20     select per_mass_moves_s.nextval
21        from sys.dual;
22 
23   cursor c is
24      select rowid
25      from per_mass_moves
26      where mass_move_id = l_mass_move_id;
27 
28   begin
29     open c1;
30     fetch c1 into l_mass_move_id;
31     if (C1%NOTFOUND) then
32        CLOSE C1;
33        hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
34        hr_utility.set_message_token('PROCEDURE','per_mass_moves_pkg.insert_rows');
35        hr_utility.set_message_token('STEP','1');
36     end if;
37       close c1;
38 
39 
40     insert into per_mass_moves
41       (mass_move_id,
42        business_group_id,
43        effective_date,
44        new_organization_id,
45        old_organization_id,
46        reason,
47        status)
48      values
49        (l_mass_move_id,
50         p_business_group_id,
51         p_effective_date,
52         p_new_organization_id,
53         p_source_organization_id,
54         p_reason,
55         p_status);
56     open c;
57     fetch c into l_row_id;
58     if (c%notfound) then
59        close c;
60        hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
61        hr_utility.set_message_token('PROCEDURE','per_mass_moves_pkg.insert_rows');
62        hr_utility.set_message_token('STEP','2');
63     end if;
64     close c;
65     p_mass_move_id := l_mass_move_id;
66     p_row_id := l_row_id;
67 
68   exception
69     when others then
70         null;
71   end insert_row;
72 --
73 --
74   procedure update_row
75                   (p_mass_move_id in number,
76                    p_effective_date in date,
77                    p_new_organization_id in number,
78                    p_source_organization_id in number,
79                    p_reason in varchar2,
80                    p_row_id in varchar2)
81    is
82 
83   begin
84       update per_mass_moves
85        set effective_date = p_effective_date,
86        new_organization_id = p_new_organization_id,
87        old_organization_id = p_source_organization_id,
88        reason = p_reason
89        where rowid = p_row_id;
90          if (sql%notfound) then
91            raise no_data_found;
92          end if;
93      end update_row;
94 --
95 --
96  procedure delete_row
97              (p_mass_move_id in number,
98               p_row_id in varchar2)
99   is
100 
101    begin
102      delete from per_mass_moves
103       where rowid = p_row_id;
104      if sql%notfound then
105        raise no_data_found;
106      end if;
107   end delete_row;
108 --
109 --
110  procedure lock_row
111                   (p_mass_move_id in number,
112                    p_business_group_id in number,
113                    p_effective_date in date,
114                    p_new_organization_id in number,
115                    p_source_organization_id in number,
116                    p_reason in varchar2,
117                    p_status in varchar2,
118                    p_row_id in varchar2)
119    is
120 
121     counter number;
122     cursor c is
123       select *
124         from per_mass_moves
125        where mass_move_id = p_mass_move_id
126          for update of status nowait;
127     recinfo c%rowtype;
128 
129  begin
130     counter := 0;
131     loop
132       begin
133         counter := counter + 1;
134         open c;
135         fetch c into recinfo;
136         if (c%notfound) then
137           close c;
138           hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
139           hr_utility.set_message_token('PROCEDURE','per_mass_moves_pkg.lock_rows');
140           hr_utility.set_message_token('STEP','1');
141           hr_utility.raise_error;
142         end if;
143         close c;
144         if  (
145              (recinfo.mass_move_id = p_mass_move_id)
146             AND
147               (recinfo.effective_date = p_effective_date)
148             AND
149               (recinfo.new_organization_id = p_new_organization_id)
150             AND
151               (recinfo.old_organization_id = p_source_organization_id)
152             AND
153               (recinfo.business_group_id = p_business_group_id)
154             AND(
155                 (recinfo.reason = p_reason)
156                  OR (    (recinfo.reason is null)
157                    AND (p_reason is null)))
158             AND(
159                 (recinfo.status = p_status)
160                  OR (    (recinfo.status is null)
161                    AND (p_status is null)))
162             ) then
163             return;
164         else
165           hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
166           hr_utility.set_message_token('PROCEDURE','per_mass_moves_pkg.lock_rows');
167           hr_utility.set_message_token('STEP','2');
168           hr_utility.raise_error;
169         end if;
170       exception
171         when app_exceptions.record_lock_exception then
172           hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
173           hr_utility.set_message_token('PROCEDURE','per_mass_moves_pkg.lock_rows');
174           hr_utility.set_message_token('STEP','3');
175           hr_utility.raise_error;
176       end;
177     end loop;
178   end lock_row ;
179 
180 end per_mass_moves_pkg ;
181