DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_DELETE_PRTT_RT_VAL

Source


1 package body hrdpp_DELETE_PRTT_RT_VAL as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2012/11/27 04:11:42
4  * Generated for API: ben_prtt_rt_val_api.DELETE_PRTT_RT_VAL
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_PRTT_RT_VAL_USER_KEY in varchar2
84 ,P_ENRT_RT_USER_KEY in varchar2 default null
85 ,P_PERSON_USER_KEY in varchar2) is
86 blid number := p_data_pump_batch_line_id;
87 begin
88 if blid is not null then
89 delete from hr_pump_batch_lines where batch_line_id = blid;
90 delete from hr_pump_batch_exceptions
91 where source_type = 'BATCH_LINE' and source_id = blid;
92 end if;
93 insert into hr_pump_batch_lines
94 (batch_id
95 ,batch_line_id
96 ,business_group_name
97 ,api_module_id
98 ,line_status
99 ,user_sequence
100 ,link_value
101 ,pval001
102 ,pval002
103 ,pval003
104 ,pval004)
105 values
106 (p_batch_id
107 ,nvl(blid,hr_pump_batch_lines_s.nextval)
108 ,p_data_pump_business_grp_name
109 ,707
110 ,'U'
111 ,p_user_sequence
112 ,p_link_value
113 ,dc(P_EFFECTIVE_DATE)
114 ,P_PRTT_RT_VAL_USER_KEY
115 ,P_ENRT_RT_USER_KEY
116 ,P_PERSON_USER_KEY);
117 end insert_batch_lines;
118 --
119 procedure call
120 (p_business_group_id in number,
121 p_batch_line_id     in number) is
122 cursor cr is
123 select l.rowid myrowid,
124 decode(l.pval001,cn,dn,d(l.pval001)) p1,
125 decode(l.pval002,cn,vn,l.pval002) p2,
126 decode(l.pval003,cn,vn,vn,vn,l.pval003) p3,
127 l.pval003 d3,
128 decode(l.pval004,cn,vn,l.pval004) p4
129 from hr_pump_batch_lines l
130 where l.batch_line_id = p_batch_line_id;
131 --
132 c cr%rowtype;
133 l_validate boolean := false;
134 L_PRTT_RT_VAL_ID number;
135 L_ENRT_RT_ID number;
136 L_PERSON_ID number;
137 L_OBJECT_VERSION_NUMBER number;
138 --
139 begin
140 hr_data_pump.entry('call');
141 open cr;
142 fetch cr into c;
143 if cr%notfound then
144 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
145 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
146 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
147 hr_utility.set_message_token('VALUE',p_batch_line_id);
148 hr_utility.raise_error;
149 end if;
150 --
151 if c.p2 is null then
152 L_PRTT_RT_VAL_ID:=nn;
153 else
154 L_PRTT_RT_VAL_ID := 
155 hr_pump_get.get_prtt_rt_val_id
156 (P_PRTT_RT_VAL_USER_KEY => c.p2);
157 end if;
158 --
159 if c.d3=cn then
160 L_ENRT_RT_ID:=nn;
161 elsif c.d3 is null then 
162 L_ENRT_RT_ID:=nh;
163 else
164 L_ENRT_RT_ID := 
165 hr_pump_get.get_enrt_rt_id
166 (P_ENRT_RT_USER_KEY => c.p3);
167 end if;
168 --
169 if c.p4 is null then
170 L_PERSON_ID:=nn;
171 else
172 L_PERSON_ID := 
173 hr_pump_get.get_person_id
174 (P_PERSON_USER_KEY => c.p4);
175 end if;
176 --
177 if c.p2 is null then
178 L_OBJECT_VERSION_NUMBER:=nn;
179 else
180 L_OBJECT_VERSION_NUMBER := 
181 hr_pump_get.GET_PRTT_RT_VAL_OVN
182 (P_PRTT_RT_VAL_USER_KEY => c.p2);
183 end if;
184 --
185 hr_data_pump.api_trc_on;
186 ben_prtt_rt_val_api.DELETE_PRTT_RT_VAL
187 (p_validate => l_validate
188 ,P_PRTT_RT_VAL_ID => L_PRTT_RT_VAL_ID
189 ,P_ENRT_RT_ID => L_ENRT_RT_ID
190 ,P_PERSON_ID => L_PERSON_ID
191 ,p_business_group_id => p_business_group_id
192 ,P_OBJECT_VERSION_NUMBER => L_OBJECT_VERSION_NUMBER
193 ,P_EFFECTIVE_DATE => c.p1);
194 hr_data_pump.api_trc_off;
195 
196 --
197 
198 --
199 close cr;
200 --
201 hr_data_pump.exit('call');
202 exception
203  when hr_multi_message.error_message_exist then
204    if cr%isopen then
205     close cr;
206    end if;
207    hr_pump_utils.set_multi_msg_error_flag(true);
208  when others then
209  if cr%isopen then
210   close cr;
211  end if;
212  raise;
213 end call;
214 end hrdpp_DELETE_PRTT_RT_VAL;