DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_USER_ACCT

Source


1 package body hrdpp_CREATE_USER_ACCT as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2012/11/27 04:11:12
4  * Generated for API: HR_USER_ACCT_API.CREATE_USER_ACCT
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_PER_EFFECTIVE_START_DATE in date default null
83 ,P_PER_EFFECTIVE_END_DATE in date default null
84 ,P_ASSIGNMENT_ID in number default null
85 ,P_ASG_EFFECTIVE_START_DATE in date default null
86 ,P_ASG_EFFECTIVE_END_DATE in date default null
87 ,P_DATE_FROM in date default null
88 ,P_DATE_TO in date default null
89 ,P_HIRE_DATE in date default null
90 ,P_ORG_STRUCTURE_ID in number default null
91 ,P_ORG_STRUCTURE_VERS_ID in number default null
92 ,P_PARENT_ORG_ID in number default null
93 ,P_SINGLE_ORG_ID in number default null
94 ,P_RUN_TYPE in varchar2 default null
95 ,P_PERSON_USER_KEY in varchar2) is
96 blid number := p_data_pump_batch_line_id;
97 begin
98 if blid is not null then
99 delete from hr_pump_batch_lines where batch_line_id = blid;
100 delete from hr_pump_batch_exceptions
101 where source_type = 'BATCH_LINE' and source_id = blid;
102 end if;
103 insert into hr_pump_batch_lines
104 (batch_id
105 ,batch_line_id
106 ,business_group_name
107 ,api_module_id
108 ,line_status
109 ,user_sequence
110 ,link_value
111 ,pval001
112 ,pval002
113 ,pval003
114 ,pval004
115 ,pval005
116 ,pval006
117 ,pval007
118 ,pval008
119 ,pval009
120 ,pval010
121 ,pval011
122 ,pval012
123 ,pval013
124 ,pval015)
125 values
126 (p_batch_id
127 ,nvl(blid,hr_pump_batch_lines_s.nextval)
128 ,p_data_pump_business_grp_name
129 ,1594
130 ,'U'
131 ,p_user_sequence
132 ,p_link_value
133 ,dc(P_PER_EFFECTIVE_START_DATE)
134 ,dc(P_PER_EFFECTIVE_END_DATE)
135 ,P_ASSIGNMENT_ID
136 ,dc(P_ASG_EFFECTIVE_START_DATE)
137 ,dc(P_ASG_EFFECTIVE_END_DATE)
138 ,dc(P_DATE_FROM)
139 ,dc(P_DATE_TO)
140 ,dc(P_HIRE_DATE)
141 ,P_ORG_STRUCTURE_ID
142 ,P_ORG_STRUCTURE_VERS_ID
143 ,P_PARENT_ORG_ID
144 ,P_SINGLE_ORG_ID
145 ,P_RUN_TYPE
146 ,P_PERSON_USER_KEY);
147 end insert_batch_lines;
148 --
149 procedure call
150 (p_business_group_id in number,
151 p_batch_line_id     in number) is
152 cursor cr is
153 select l.rowid myrowid,
154 decode(l.pval001,cn,dn,vn,dn,d(l.pval001)) p1,
155 l.pval001 d1,
156 decode(l.pval002,cn,dn,vn,dn,d(l.pval002)) p2,
157 l.pval002 d2,
158 decode(l.pval003,cn,nn,vn,nn,n(l.pval003)) p3,
159 l.pval003 d3,
160 decode(l.pval004,cn,dn,vn,dn,d(l.pval004)) p4,
161 l.pval004 d4,
162 decode(l.pval005,cn,dn,vn,dn,d(l.pval005)) p5,
163 l.pval005 d5,
164 decode(l.pval006,cn,dn,vn,dn,d(l.pval006)) p6,
165 l.pval006 d6,
166 decode(l.pval007,cn,dn,vn,dn,d(l.pval007)) p7,
167 l.pval007 d7,
168 decode(l.pval008,cn,dn,vn,dn,d(l.pval008)) p8,
169 l.pval008 d8,
170 decode(l.pval009,cn,nn,vn,nn,n(l.pval009)) p9,
171 l.pval009 d9,
172 decode(l.pval010,cn,nn,vn,nn,n(l.pval010)) p10,
173 l.pval010 d10,
174 decode(l.pval011,cn,nn,vn,nn,n(l.pval011)) p11,
175 l.pval011 d11,
176 decode(l.pval012,cn,nn,vn,nn,n(l.pval012)) p12,
177 l.pval012 d12,
178 decode(l.pval013,cn,vn,vn,vn,
179  hr_pump_get.gl(l.pval013,'HR_EMP_EXTRACT_RUN_TYPE',dn,vn)) p13,
180 l.pval013 d13,
181 l.pval014 p14,
182 decode(l.pval015,cn,vn,l.pval015) p15
183 from hr_pump_batch_lines l
184 where l.batch_line_id = p_batch_line_id;
185 --
186 c cr%rowtype;
187 l_validate boolean := false;
188 L_PERSON_ID number;
189 --
190 begin
191 hr_data_pump.entry('call');
192 open cr;
193 fetch cr into c;
194 if cr%notfound then
195 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
196 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
197 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
198 hr_utility.set_message_token('VALUE',p_batch_line_id);
199 hr_utility.raise_error;
200 end if;
201 --
202 if c.p15 is null then
203 L_PERSON_ID:=nn;
204 else
205 L_PERSON_ID := 
206 hr_pump_get.GET_PERSON_ID
207 (P_PERSON_USER_KEY => c.p15);
208 end if;
209 --
210 hr_data_pump.api_trc_on;
211 HR_USER_ACCT_API.CREATE_USER_ACCT
212 (p_validate => l_validate
213 ,P_PERSON_ID => L_PERSON_ID
214 ,P_PER_EFFECTIVE_START_DATE => c.p1
215 ,P_PER_EFFECTIVE_END_DATE => c.p2
216 ,P_ASSIGNMENT_ID => c.p3
217 ,P_ASG_EFFECTIVE_START_DATE => c.p4
218 ,P_ASG_EFFECTIVE_END_DATE => c.p5
219 ,p_business_group_id => p_business_group_id
220 ,P_DATE_FROM => c.p6
221 ,P_DATE_TO => c.p7
222 ,P_HIRE_DATE => c.p8
223 ,P_ORG_STRUCTURE_ID => c.p9
224 ,P_ORG_STRUCTURE_VERS_ID => c.p10
225 ,P_PARENT_ORG_ID => c.p11
226 ,P_SINGLE_ORG_ID => c.p12
227 ,P_RUN_TYPE => c.p13
228 ,P_USER_ID => c.p14);
229 hr_data_pump.api_trc_off;
230 
231 --
232 update hr_pump_batch_lines l set
233 l.pval014 = decode(c.p14,null,cn,c.p14)
234 where l.rowid = c.myrowid;
235 --
236 close cr;
237 --
238 hr_data_pump.exit('call');
239 exception
240  when hr_multi_message.error_message_exist then
241    if cr%isopen then
242     close cr;
243    end if;
244    hr_pump_utils.set_multi_msg_error_flag(true);
245  when others then
246  if cr%isopen then
247   close cr;
248  end if;
249  raise;
250 end call;
251 end hrdpp_CREATE_USER_ACCT;