DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_USER_ROW

Source


1 package body hrdpp_CREATE_USER_ROW as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2007/01/03 23:01:54
4  * Generated for API: PAY_USER_ROW_API.CREATE_USER_ROW
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_ROW_LOW_RANGE_OR_NAME in varchar2
84 ,P_DISPLAY_SEQUENCE in number
85 ,P_LEGISLATION_CODE in varchar2 default null
86 ,P_DISABLE_RANGE_OVERLAP_CHECK in boolean default null
87 ,P_DISABLE_UNITS_CHECK in boolean default null
88 ,P_ROW_HIGH_RANGE in varchar2 default null
89 ,P_USER_ROW_USER_KEY in varchar2
90 ,P_USER_TABLE_USER_KEY in varchar2) is
91 blid number := p_data_pump_batch_line_id;
92  L_DISABLE_RANGE_OVERLAP_CHECK varchar2(5);
93  L_DISABLE_UNITS_CHECK varchar2(5);
94 begin
95 if P_DISABLE_RANGE_OVERLAP_CHECK is null then
96  L_DISABLE_RANGE_OVERLAP_CHECK := null;
97 elsif P_DISABLE_RANGE_OVERLAP_CHECK then
98  L_DISABLE_RANGE_OVERLAP_CHECK := 'TRUE';
99 else 
100  L_DISABLE_RANGE_OVERLAP_CHECK := 'FALSE';
101 end if;
102 if P_DISABLE_UNITS_CHECK is null then
103  L_DISABLE_UNITS_CHECK := null;
104 elsif P_DISABLE_UNITS_CHECK then
105  L_DISABLE_UNITS_CHECK := 'TRUE';
106 else 
107  L_DISABLE_UNITS_CHECK := 'FALSE';
108 end if;
109 if blid is not null then
110 delete from hr_pump_batch_lines where batch_line_id = blid;
111 delete from hr_pump_batch_exceptions
112 where source_type = 'BATCH_LINE' and source_id = blid;
113 end if;
114 insert into hr_pump_batch_lines
115 (batch_id
116 ,batch_line_id
117 ,business_group_name
118 ,api_module_id
119 ,line_status
120 ,user_sequence
121 ,link_value
122 ,pval001
123 ,pval002
124 ,pval003
125 ,pval004
126 ,pval005
127 ,pval006
128 ,pval007
129 ,pval008
130 ,pval012)
131 values
132 (p_batch_id
133 ,nvl(blid,hr_pump_batch_lines_s.nextval)
134 ,p_data_pump_business_grp_name
135 ,3037
136 ,'U'
137 ,p_user_sequence
138 ,p_link_value
139 ,dc(P_EFFECTIVE_DATE)
140 ,P_ROW_LOW_RANGE_OR_NAME
141 ,P_DISPLAY_SEQUENCE
142 ,P_LEGISLATION_CODE
143 ,L_DISABLE_RANGE_OVERLAP_CHECK
144 ,L_DISABLE_UNITS_CHECK
145 ,P_ROW_HIGH_RANGE
146 ,P_USER_ROW_USER_KEY
147 ,P_USER_TABLE_USER_KEY);
148 end insert_batch_lines;
149 --
150 procedure call
151 (p_business_group_id in number,
152 p_batch_line_id     in number) is
153 cursor cr is
154 select l.rowid myrowid,
155 decode(l.pval001,cn,dn,d(l.pval001)) p1,
156 decode(l.pval002,cn,vn,l.pval002) p2,
157 decode(l.pval003,cn,nn,n(l.pval003)) p3,
158 decode(l.pval004,cn,vn,vn,vn,l.pval004) p4,
159 l.pval004 d4,
160 decode(l.pval005,cn,vn,vn,'FALSE',l.pval005) p5,
161 l.pval005 d5,
162 decode(l.pval006,cn,vn,vn,'FALSE',l.pval006) p6,
163 l.pval006 d6,
164 decode(l.pval007,cn,vn,vn,vn,l.pval007) p7,
165 l.pval007 d7,
166 l.pval008 p8,
167 l.pval009 p9,
168 decode(l.pval010,cn,dn,d(l.pval010)) p10,
169 decode(l.pval011,cn,dn,d(l.pval011)) p11,
170 decode(l.pval012,cn,vn,l.pval012) p12
171 from hr_pump_batch_lines l
172 where l.batch_line_id = p_batch_line_id;
173 --
174 c cr%rowtype;
175 l_validate boolean := false;
176 L_DISABLE_RANGE_OVERLAP_CHECK boolean;
177 L_DISABLE_UNITS_CHECK boolean;
178 L_USER_ROW_ID number;
179 L_USER_TABLE_ID number;
180 --
181 begin
182 hr_data_pump.entry('call');
183 open cr;
184 fetch cr into c;
185 if cr%notfound then
186 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
187 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
188 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
189 hr_utility.set_message_token('VALUE',p_batch_line_id);
190 hr_utility.raise_error;
191 end if;
192 --
193 if upper(c.p5) = 'TRUE' then
194 L_DISABLE_RANGE_OVERLAP_CHECK := true;
195 elsif upper(c.p5) = 'FALSE' then
196 L_DISABLE_RANGE_OVERLAP_CHECK := false;
197 elsif c.d5 is not null then
198 hr_utility.set_message(800,'HR_50327_DP_TYPE_ERR');
199 hr_utility.set_message_token('TYPE','BOOLEAN');
200 hr_utility.set_message_token('PARAMETER','P_DISABLE_RANGE_OVERLAP_CHECK');
201 hr_utility.set_message_token('VALUE',c.p5);
202 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
203 hr_utility.raise_error;
204 end if;
205 --
206 if upper(c.p6) = 'TRUE' then
207 L_DISABLE_UNITS_CHECK := true;
208 elsif upper(c.p6) = 'FALSE' then
209 L_DISABLE_UNITS_CHECK := false;
210 elsif c.d6 is not null then
211 hr_utility.set_message(800,'HR_50327_DP_TYPE_ERR');
212 hr_utility.set_message_token('TYPE','BOOLEAN');
213 hr_utility.set_message_token('PARAMETER','P_DISABLE_UNITS_CHECK');
214 hr_utility.set_message_token('VALUE',c.p6);
215 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
216 hr_utility.raise_error;
217 end if;
218 --
219 if c.p12 is null then
220 L_USER_TABLE_ID:=nn;
221 else
222 L_USER_TABLE_ID := 
223 PAY_USER_TABLE_DATA_PUMP.get_user_table_id
224 (P_USER_TABLE_USER_KEY => c.p12);
225 end if;
226 --
227 hr_data_pump.api_trc_on;
228 PAY_USER_ROW_API.CREATE_USER_ROW
229 (p_validate => l_validate
230 ,P_EFFECTIVE_DATE => c.p1
231 ,P_USER_TABLE_ID => L_USER_TABLE_ID
232 ,P_ROW_LOW_RANGE_OR_NAME => c.p2
233 ,P_DISPLAY_SEQUENCE => c.p3
234 ,p_business_group_id => p_business_group_id
235 ,P_LEGISLATION_CODE => c.p4
236 ,P_DISABLE_RANGE_OVERLAP_CHECK => L_DISABLE_RANGE_OVERLAP_CHECK
237 ,P_DISABLE_UNITS_CHECK => L_DISABLE_UNITS_CHECK
238 ,P_ROW_HIGH_RANGE => c.p7
239 ,P_USER_ROW_ID => L_USER_ROW_ID
240 ,P_OBJECT_VERSION_NUMBER => c.p9
241 ,P_EFFECTIVE_START_DATE => c.p10
242 ,P_EFFECTIVE_END_DATE => c.p11);
243 hr_data_pump.api_trc_off;
244 --
245 iuk(p_batch_line_id,c.p8,L_USER_ROW_ID);
246 --
247 update hr_pump_batch_lines l set
248 l.pval003 = decode(c.p3,null,cn,c.p3),
249 l.pval008 = decode(c.p8,null,cn,c.p8),
250 l.pval009 = decode(c.p9,null,cn,c.p9),
251 l.pval010 = decode(c.p10,null,cn,dc(c.p10)),
252 l.pval011 = decode(c.p11,null,cn,dc(c.p11))
253 where l.rowid = c.myrowid;
254 --
255 close cr;
256 --
257 hr_data_pump.exit('call');
258 exception
259  when hr_multi_message.error_message_exist then
260    if cr%isopen then
261     close cr;
262    end if;
263    hr_pump_utils.set_multi_msg_error_flag(true);
264  when others then
265  if cr%isopen then
266   close cr;
267  end if;
268  raise;
269 end call;
270 end hrdpp_CREATE_USER_ROW;