DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_HIRE_INTO_JOB

Source


1 package body hrdpp_HIRE_INTO_JOB as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2012/11/27 04:11:55
4  * Generated for API: HR_EMPLOYEE_API.HIRE_INTO_JOB
5  */
6 --
10 c_sot constant date := to_date('01010001','DDMMYYYY');
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;
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_OBJECT_VERSION_NUMBER in number
84 ,P_EMPLOYEE_NUMBER in varchar2
85 ,P_DATETRACK_UPDATE_MODE in varchar2 default null
86 ,P_NATIONAL_IDENTIFIER in varchar2 default null
87 ,P_PER_INFORMATION7 in varchar2 default null
88 ,P_ASSIGNMENT_USER_KEY in varchar2
89 ,P_PERSON_USER_KEY in varchar2
90 ,P_USER_PERSON_TYPE in varchar2 default null
91 ,P_LANGUAGE_CODE in varchar2 default null) is
92 blid number := p_data_pump_batch_line_id;
93 begin
94 if blid is not null then
95 delete from hr_pump_batch_lines where batch_line_id = blid;
96 delete from hr_pump_batch_exceptions
97 where source_type = 'BATCH_LINE' and source_id = blid;
98 end if;
99 insert into hr_pump_batch_lines
100 (batch_id
101 ,batch_line_id
102 ,business_group_name
103 ,api_module_id
104 ,line_status
105 ,user_sequence
106 ,link_value
107 ,pval001
108 ,pval002
109 ,pval003
110 ,pval004
111 ,pval005
112 ,pval006
113 ,pval007
114 ,pval012
115 ,pval013
116 ,pval014)
117 values
118 (p_batch_id
119 ,nvl(blid,hr_pump_batch_lines_s.nextval)
120 ,p_data_pump_business_grp_name
121 ,1205
122 ,'U'
123 ,p_user_sequence
124 ,p_link_value
125 ,dc(P_EFFECTIVE_DATE)
126 ,P_OBJECT_VERSION_NUMBER
127 ,P_EMPLOYEE_NUMBER
128 ,P_DATETRACK_UPDATE_MODE
129 ,P_NATIONAL_IDENTIFIER
130 ,P_PER_INFORMATION7
131 ,P_ASSIGNMENT_USER_KEY
132 ,P_PERSON_USER_KEY
133 ,P_USER_PERSON_TYPE
134 ,P_LANGUAGE_CODE);
135 end insert_batch_lines;
136 --
137 procedure call
138 (p_business_group_id in number,
139 p_batch_line_id     in number) is
140 cursor cr is
141 select l.rowid myrowid,
142 decode(l.pval001,cn,dn,d(l.pval001)) p1,
143 decode(l.pval002,cn,nn,n(l.pval002)) p2,
144 decode(l.pval003,cn,vn,l.pval003) p3,
145 decode(l.pval004,cn,vn,vn,vh,l.pval004) p4,
146 l.pval004 d4,
147 decode(l.pval005,cn,vn,vn,vh,l.pval005) p5,
148 l.pval005 d5,
149 decode(l.pval006,cn,vn,vn,vh,l.pval006) p6,
150 l.pval006 d6,
151 l.pval007 p7,
152 decode(l.pval008,cn,dn,d(l.pval008)) p8,
153 decode(l.pval009,cn,dn,d(l.pval009)) p9,
154 l.pval010 p10,
155 l.pval011 p11,
156 decode(l.pval012,cn,vn,l.pval012) p12,
157 decode(l.pval013,cn,vn,vn,vh,l.pval013) p13,
158 l.pval013 d13,
159 decode(l.pval014,cn,vn,vn,vh,l.pval014) p14,
160 l.pval014 d14
161 from hr_pump_batch_lines l
162 where l.batch_line_id = p_batch_line_id;
163 --
164 c cr%rowtype;
165 l_validate boolean := false;
166 L_ASSIGNMENT_ID number;
167 L_ASSIGN_PAYROLL_WARNING boolean;
168 L_ORIG_HIRE_WARNING boolean;
169 L_PERSON_ID number;
170 L_PERSON_TYPE_ID number;
171 --
172 begin
173 hr_data_pump.entry('call');
174 open cr;
175 fetch cr into c;
176 if cr%notfound then
177 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
178 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
179 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
180 hr_utility.set_message_token('VALUE',p_batch_line_id);
181 hr_utility.raise_error;
182 end if;
183 --
187 L_PERSON_ID := 
184 if c.p12 is null then
185 L_PERSON_ID:=nn;
186 else
188 hr_pump_get.get_person_id
189 (P_PERSON_USER_KEY => c.p12);
190 end if;
191 --
192 if c.d13=cn or
193 c.d14=cn then
194 L_PERSON_TYPE_ID:=nn;
195 elsif c.d13 is null or
196 c.d14 is null then 
197 L_PERSON_TYPE_ID:=nh;
198 else
199 L_PERSON_TYPE_ID := 
200 hr_pump_get.get_person_type_id
201 (P_USER_PERSON_TYPE => c.p13
202 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
203 ,P_LANGUAGE_CODE => c.p14);
204 end if;
205 --
206 hr_data_pump.api_trc_on;
207 HR_EMPLOYEE_API.HIRE_INTO_JOB
208 (p_validate => l_validate
209 ,P_EFFECTIVE_DATE => c.p1
210 ,P_PERSON_ID => L_PERSON_ID
211 ,P_OBJECT_VERSION_NUMBER => c.p2
212 ,P_EMPLOYEE_NUMBER => c.p3
213 ,P_DATETRACK_UPDATE_MODE => c.p4
214 ,P_PERSON_TYPE_ID => L_PERSON_TYPE_ID
215 ,P_NATIONAL_IDENTIFIER => c.p5
216 ,P_PER_INFORMATION7 => c.p6
217 ,P_ASSIGNMENT_ID => L_ASSIGNMENT_ID
218 ,P_EFFECTIVE_START_DATE => c.p8
219 ,P_EFFECTIVE_END_DATE => c.p9
223 --
220 ,P_ASSIGN_PAYROLL_WARNING => L_ASSIGN_PAYROLL_WARNING
221 ,P_ORIG_HIRE_WARNING => L_ORIG_HIRE_WARNING);
222 hr_data_pump.api_trc_off;
224 iuk(p_batch_line_id,c.p7,L_ASSIGNMENT_ID);
225 --
226 if L_ASSIGN_PAYROLL_WARNING then
227 c.p10 := 'TRUE';
228 else
229 c.p10 := 'FALSE';
230 end if;
231 --
232 if L_ORIG_HIRE_WARNING then
233 c.p11 := 'TRUE';
234 else
235 c.p11 := 'FALSE';
236 end if;
237 --
238 update hr_pump_batch_lines l set
239 l.pval002 = decode(c.p2,null,cn,c.p2),
240 l.pval003 = decode(c.p3,null,cn,c.p3),
241 l.pval007 = decode(c.p7,null,cn,c.p7),
242 l.pval008 = decode(c.p8,null,cn,dc(c.p8)),
243 l.pval009 = decode(c.p9,null,cn,dc(c.p9)),
244 l.pval010 = decode(c.p10,null,cn,c.p10),
245 l.pval011 = decode(c.p11,null,cn,c.p11)
246 where l.rowid = c.myrowid;
247 --
248 close cr;
249 --
250 hr_data_pump.exit('call');
251 exception
252  when hr_multi_message.error_message_exist then
253    if cr%isopen then
254     close cr;
255    end if;
256    hr_pump_utils.set_multi_msg_error_flag(true);
257  when others then
258  if cr%isopen then
259   close cr;
260  end if;
261  raise;
262 end call;
263 end hrdpp_HIRE_INTO_JOB;