DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_DELETE_PLAN_BENEFICIARY

Source


1 package body hrdpp_DELETE_PLAN_BENEFICIARY as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2007/01/04 02:01:54
4  * Generated for API: ben_plan_beneficiary_api.DELETE_PLAN_BENEFICIARY
5  */
6 --
7 dh constant date := hr_api.g_date;
8 nh constant number := hr_api.g_number;
9 vh constant varchar2(64) := hr_api.g_varchar2;
10 c_sot constant date := to_date('01010001','DDMMYYYY');
11 cn constant varchar2(32) := '<NULL>';
12 dn constant date := null;
13 nn constant number := null;
14 vn constant varchar2(1) := null;
15 --
16 function dc(p in date) return varchar2 is
17 begin
18 if p<c_sot then
19  if p<>trunc(p) then
20   return to_char(p,'SYYYY/MM/DD HH24:MI:SS');
21  end if;
22  return to_char(p,'SYYYY/MM/DD');
23 elsif p<>trunc(p) then
24  return to_char(p,'YYYY/MM/DD HH24:MI:SS');
25 end if;
26 return to_char(p,'YYYY/MM/DD');
27 end dc;
28 function d(p in varchar2) return date is
29 begin
30 if length(p)=10 then
31 return to_date(p,'YYYY/MM/DD');
32 elsif length(p)=19 then
33 return to_date(p,'YYYY/MM/DD HH24:MI:SS');
34 elsif length(p)=11 then
35 return to_date(p,'SYYYY/MM/DD');
36 elsif length(p)=20 then
37 return to_date(p,'SYYYY/MM/DD HH24:MI:SS');
38 end if;
39 -- Try default format as last resort.
40 return to_date(p,'YYYY/MM/DD');
41 end d;
42 function n(p in varchar2) return number is
43 begin
44 return to_number(p);
45 end n;
46 function dd(p in date,i in varchar2)
47 return varchar2 is
48 begin
49 if upper(i) = 'N' then return dc(p);
50 else return cn; end if;
51 end dd;
52 function nd(p in number,i in varchar2)
53 return varchar2 is
54 begin
55 if upper(i) = 'N' then return to_char(p);
56 else return cn; end if;
57 end nd;
58 --
59 procedure iuk
60 (p_batch_line_id  in number,
61 p_user_key_value in varchar2,
62 p_unique_key_id  in number)
63 is
64 begin
65 hr_data_pump.entry('ins_user_key');
66 insert into hr_pump_batch_line_user_keys
67 (user_key_id, batch_line_id,user_key_value,unique_key_id)
68 values
69 (hr_pump_batch_line_user_keys_s.nextval,
70 p_batch_line_id,
71 p_user_key_value,
72 p_unique_key_id);
73 hr_data_pump.exit('ins_user_key');
74 end iuk;
75 --
76 procedure insert_batch_lines
77 (p_batch_id      in number
78 ,p_data_pump_batch_line_id in number default null
79 ,p_data_pump_business_grp_name in varchar2 default null
80 ,p_user_sequence in number default null
81 ,p_link_value    in number default null
82 ,P_EFFECTIVE_DATE in date
83 ,P_DATETRACK_MODE in varchar2
84 ,P_MULTI_ROW_ACTN in boolean default null
85 ,P_PL_BNF_USER_KEY in varchar2) is
86 blid number := p_data_pump_batch_line_id;
87  L_MULTI_ROW_ACTN varchar2(5);
88 begin
89 if P_MULTI_ROW_ACTN is null then
90  L_MULTI_ROW_ACTN := null;
91 elsif P_MULTI_ROW_ACTN then
92  L_MULTI_ROW_ACTN := 'TRUE';
93 else 
94  L_MULTI_ROW_ACTN := 'FALSE';
95 end if;
96 if blid is not null then
97 delete from hr_pump_batch_lines where batch_line_id = blid;
98 delete from hr_pump_batch_exceptions
99 where source_type = 'BATCH_LINE' and source_id = blid;
100 end if;
101 insert into hr_pump_batch_lines
102 (batch_id
103 ,batch_line_id
104 ,business_group_name
105 ,api_module_id
106 ,line_status
107 ,user_sequence
108 ,link_value
109 ,pval003
110 ,pval004
111 ,pval005
112 ,pval006)
113 values
114 (p_batch_id
115 ,nvl(blid,hr_pump_batch_lines_s.nextval)
116 ,p_data_pump_business_grp_name
117 ,570
118 ,'U'
119 ,p_user_sequence
120 ,p_link_value
121 ,dc(P_EFFECTIVE_DATE)
122 ,P_DATETRACK_MODE
123 ,L_MULTI_ROW_ACTN
124 ,P_PL_BNF_USER_KEY);
125 end insert_batch_lines;
126 --
127 procedure call
128 (p_business_group_id in number,
129 p_batch_line_id     in number) is
130 cursor cr is
131 select l.rowid myrowid,
132 decode(l.pval001,cn,dn,d(l.pval001)) p1,
133 decode(l.pval002,cn,dn,d(l.pval002)) p2,
134 decode(l.pval003,cn,dn,d(l.pval003)) p3,
135 decode(l.pval004,cn,vn,l.pval004) p4,
136 decode(l.pval005,cn,vn,vn,null,l.pval005) p5,
137 l.pval005 d5,
138 decode(l.pval006,cn,vn,l.pval006) p6
139 from hr_pump_batch_lines l
140 where l.batch_line_id = p_batch_line_id;
141 --
142 c cr%rowtype;
143 l_validate boolean := false;
144 L_MULTI_ROW_ACTN boolean;
145 L_PL_BNF_ID number;
146 L_OBJECT_VERSION_NUMBER number;
147 --
148 begin
149 hr_data_pump.entry('call');
150 open cr;
151 fetch cr into c;
152 if cr%notfound then
153 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
154 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
155 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
156 hr_utility.set_message_token('VALUE',p_batch_line_id);
157 hr_utility.raise_error;
158 end if;
159 --
160 if upper(c.p5) = 'TRUE' then
161 L_MULTI_ROW_ACTN := true;
162 elsif upper(c.p5) = 'FALSE' then
163 L_MULTI_ROW_ACTN := false;
164 elsif c.p5 is not null then
165 hr_utility.set_message(800,'HR_50327_DP_TYPE_ERR');
166 hr_utility.set_message_token('TYPE','BOOLEAN');
167 hr_utility.set_message_token('PARAMETER','P_MULTI_ROW_ACTN');
168 hr_utility.set_message_token('VALUE',c.p5);
169 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
170 hr_utility.raise_error;
171 end if;
172 --
173 if c.p6 is null then
174 L_PL_BNF_ID:=nn;
175 else
176 L_PL_BNF_ID := 
177 hr_pump_get.get_pl_bnf_id
178 (P_PL_BNF_USER_KEY => c.p6);
179 end if;
180 --
181 if c.p6 is null or
182 c.p3 is null then
183 L_OBJECT_VERSION_NUMBER:=nn;
184 else
185 L_OBJECT_VERSION_NUMBER := 
186 hr_pump_get.GET_PL_BNF_OVN
187 (P_PL_BNF_USER_KEY => c.p6
188 ,P_EFFECTIVE_DATE => c.p3);
189 end if;
190 --
191 hr_data_pump.api_trc_on;
192 ben_plan_beneficiary_api.DELETE_PLAN_BENEFICIARY
193 (p_validate => l_validate
194 ,P_PL_BNF_ID => L_PL_BNF_ID
195 ,P_EFFECTIVE_START_DATE => c.p1
196 ,P_EFFECTIVE_END_DATE => c.p2
197 ,P_OBJECT_VERSION_NUMBER => L_OBJECT_VERSION_NUMBER
198 ,p_business_group_id => p_business_group_id
199 ,P_EFFECTIVE_DATE => c.p3
200 ,P_DATETRACK_MODE => c.p4
201 ,P_MULTI_ROW_ACTN => L_MULTI_ROW_ACTN);
202 hr_data_pump.api_trc_off;
203 
204 --
205 update hr_pump_batch_lines l set
206 l.pval001 = decode(c.p1,null,cn,dc(c.p1)),
207 l.pval002 = decode(c.p2,null,cn,dc(c.p2))
208 where l.rowid = c.myrowid;
209 --
210 close cr;
211 --
212 hr_data_pump.exit('call');
213 exception
214  when hr_multi_message.error_message_exist then
215    if cr%isopen then
216     close cr;
217    end if;
218    hr_pump_utils.set_multi_msg_error_flag(true);
219  when others then
220  if cr%isopen then
221   close cr;
222  end if;
223  raise;
224 end call;
225 end hrdpp_DELETE_PLAN_BENEFICIARY;