DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_HIERARCHY_ELEMENT

Source


4  * Generated for API: HR_HIERARCHY_ELEMENT_API.CREATE_HIERARCHY_ELEMENT
1 package body hrdpp_CREATE_HIERARCHY_ELEMENT as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2012/11/27 04:11:57
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
70 p_batch_line_id,
67 (user_key_id, batch_line_id,user_key_value,unique_key_id)
68 values
69 (hr_pump_batch_line_user_keys_s.nextval,
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_DATE_FROM in date
84 ,P_VIEW_ALL_ORGS in varchar2
85 ,P_END_OF_TIME in date
86 ,P_HR_INSTALLED in varchar2
87 ,P_PA_INSTALLED in varchar2
88 ,P_POS_CONTROL_ENABLED_FLAG in varchar2
89 ,P_WARNING_RAISED in varchar2
90 ,P_PARENT_ORGANIZATION_NAME in varchar2
91 ,P_LANGUAGE_CODE in varchar2
92 ,P_ORG_STR_VERSION_USER_KEY in varchar2
93 ,P_CHILD_ORGANIZATION_NAME in varchar2
94 ,P_SECURITY_PROFILE_NAME in varchar2) is
95 blid number := p_data_pump_batch_line_id;
96 begin
97 if blid is not null then
98 delete from hr_pump_batch_lines where batch_line_id = blid;
99 delete from hr_pump_batch_exceptions
100 where source_type = 'BATCH_LINE' and source_id = blid;
101 end if;
102 insert into hr_pump_batch_lines
103 (batch_id
104 ,batch_line_id
105 ,business_group_name
106 ,api_module_id
107 ,line_status
108 ,user_sequence
109 ,link_value
110 ,pval001
111 ,pval002
112 ,pval003
113 ,pval004
114 ,pval005
115 ,pval006
116 ,pval007
117 ,pval008
118 ,pval011
119 ,pval012
120 ,pval013
121 ,pval014
122 ,pval015)
123 values
124 (p_batch_id
125 ,nvl(blid,hr_pump_batch_lines_s.nextval)
126 ,p_data_pump_business_grp_name
127 ,1615
128 ,'U'
129 ,p_user_sequence
130 ,p_link_value
131 ,dc(P_EFFECTIVE_DATE)
132 ,dc(P_DATE_FROM)
133 ,P_VIEW_ALL_ORGS
134 ,dc(P_END_OF_TIME)
135 ,P_HR_INSTALLED
136 ,P_PA_INSTALLED
137 ,P_POS_CONTROL_ENABLED_FLAG
138 ,P_WARNING_RAISED
139 ,P_PARENT_ORGANIZATION_NAME
140 ,P_LANGUAGE_CODE
141 ,P_ORG_STR_VERSION_USER_KEY
142 ,P_CHILD_ORGANIZATION_NAME
143 ,P_SECURITY_PROFILE_NAME);
144 end insert_batch_lines;
145 --
146 procedure call
147 (p_business_group_id in number,
148 p_batch_line_id     in number) is
149 cursor cr is
150 select l.rowid myrowid,
151 decode(l.pval001,cn,dn,d(l.pval001)) p1,
152 decode(l.pval002,cn,dn,d(l.pval002)) p2,
153 decode(l.pval003,cn,vn,l.pval003) p3,
154 decode(l.pval004,cn,dn,d(l.pval004)) p4,
155 decode(l.pval005,cn,vn,l.pval005) p5,
156 decode(l.pval006,cn,vn,l.pval006) p6,
157 decode(l.pval007,cn,vn,l.pval007) p7,
158 decode(l.pval008,cn,vn,l.pval008) p8,
159 l.pval009 p9,
160 l.pval010 p10,
161 decode(l.pval011,cn,vn,l.pval011) p11,
162 decode(l.pval012,cn,vn,l.pval012) p12,
163 decode(l.pval013,cn,vn,l.pval013) p13,
164 decode(l.pval014,cn,vn,l.pval014) p14,
165 decode(l.pval015,cn,vn,l.pval015) p15
166 from hr_pump_batch_lines l
167 where l.batch_line_id = p_batch_line_id;
168 --
169 c cr%rowtype;
170 l_validate boolean := false;
171 L_ORGANIZATION_ID_PARENT number;
172 L_ORG_STRUCTURE_VERSION_ID number;
173 L_ORGANIZATION_ID_CHILD number;
174 L_SECURITY_PROFILE_ID number;
175 --
176 begin
177 hr_data_pump.entry('call');
178 open cr;
179 fetch cr into c;
180 if cr%notfound then
181 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
182 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
183 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
184 hr_utility.set_message_token('VALUE',p_batch_line_id);
185 hr_utility.raise_error;
186 end if;
187 --
188 if c.p11 is null or
189 c.p1 is null or
190 c.p12 is null then
191 L_ORGANIZATION_ID_PARENT:=nn;
192 else
193 L_ORGANIZATION_ID_PARENT := 
194 hr_pump_get.GET_PARENT_ORGANIZATION_ID
195 (P_PARENT_ORGANIZATION_NAME => c.p11
196 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
197 ,P_EFFECTIVE_DATE => c.p1
198 ,P_LANGUAGE_CODE => c.p12);
199 end if;
200 --
201 if c.p13 is null then
202 L_ORG_STRUCTURE_VERSION_ID:=nn;
203 else
204 L_ORG_STRUCTURE_VERSION_ID := 
205 hr_pump_get.GET_ORG_STR_VERSION_ID
206 (P_ORG_STR_VERSION_USER_KEY => c.p13);
207 end if;
208 --
209 if c.p14 is null or
210 c.p1 is null or
211 c.p12 is null then
212 L_ORGANIZATION_ID_CHILD:=nn;
213 else
214 L_ORGANIZATION_ID_CHILD := 
215 hr_pump_get.GET_CHILD_ORGANIZATION_ID
216 (P_CHILD_ORGANIZATION_NAME => c.p14
217 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
218 ,P_EFFECTIVE_DATE => c.p1
222 L_SECURITY_PROFILE_ID := 
219 ,P_LANGUAGE_CODE => c.p12);
220 end if;
221 --
223 hr_pump_get.GET_SECURITY_PROFILE_ID
224 (P_DATA_PUMP_ALWAYS_CALL => null
225 ,P_SECURITY_PROFILE_NAME => c.p15
226 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID);
227 --
228 hr_data_pump.api_trc_on;
229 HR_HIERARCHY_ELEMENT_API.CREATE_HIERARCHY_ELEMENT
230 (p_validate => l_validate
231 ,P_ORGANIZATION_ID_PARENT => L_ORGANIZATION_ID_PARENT
232 ,P_ORG_STRUCTURE_VERSION_ID => L_ORG_STRUCTURE_VERSION_ID
233 ,P_ORGANIZATION_ID_CHILD => L_ORGANIZATION_ID_CHILD
234 ,p_business_group_id => p_business_group_id
235 ,P_EFFECTIVE_DATE => c.p1
236 ,P_DATE_FROM => c.p2
237 ,P_SECURITY_PROFILE_ID => L_SECURITY_PROFILE_ID
238 ,P_VIEW_ALL_ORGS => c.p3
239 ,P_END_OF_TIME => c.p4
240 ,P_HR_INSTALLED => c.p5
241 ,P_PA_INSTALLED => c.p6
242 ,P_POS_CONTROL_ENABLED_FLAG => c.p7
243 ,P_WARNING_RAISED => c.p8
244 ,P_ORG_STRUCTURE_ELEMENT_ID => c.p9
245 ,P_OBJECT_VERSION_NUMBER => c.p10);
246 hr_data_pump.api_trc_off;
247 
248 --
249 update hr_pump_batch_lines l set
250 l.pval008 = decode(c.p8,null,cn,c.p8),
251 l.pval009 = decode(c.p9,null,cn,c.p9),
252 l.pval010 = decode(c.p10,null,cn,c.p10)
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_HIERARCHY_ELEMENT;