DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_ORG_STRUCTURE_VER

Source


1 package body hrdpp_CREATE_ORG_STRUCTURE_VER as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2007/01/03 23:01:46
4  * Generated for API: PER_ORG_STRUCTURE_VERSION_API.CREATE_ORG_STRUCTURE_VERSION
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_DATE_FROM in date
84 ,P_VERSION_NUMBER in number
85 ,P_COPY_STRUCTURE_VERSION_ID in number default null
86 ,P_DATE_TO in date default null
87 ,P_PROGRAM_UPDATE_DATE in date default null
88 ,P_TOPNODE_POS_CTRL_ENABLED_FLA in varchar2 default null
89 ,P_ORG_STR_VERSION_USER_KEY in varchar2
90 ,P_ORG_STRUCTURE_USER_KEY in varchar2) is
91 blid number := p_data_pump_batch_line_id;
92 begin
93 if blid is not null then
94 delete from hr_pump_batch_lines where batch_line_id = blid;
95 delete from hr_pump_batch_exceptions
96 where source_type = 'BATCH_LINE' and source_id = blid;
97 end if;
98 insert into hr_pump_batch_lines
99 (batch_id
100 ,batch_line_id
101 ,business_group_name
102 ,api_module_id
103 ,line_status
104 ,user_sequence
105 ,link_value
106 ,pval001
107 ,pval002
108 ,pval003
109 ,pval004
110 ,pval005
111 ,pval006
112 ,pval007
113 ,pval008
114 ,pval011)
115 values
116 (p_batch_id
117 ,nvl(blid,hr_pump_batch_lines_s.nextval)
118 ,p_data_pump_business_grp_name
119 ,2255
120 ,'U'
121 ,p_user_sequence
122 ,p_link_value
123 ,dc(P_EFFECTIVE_DATE)
124 ,dc(P_DATE_FROM)
125 ,P_VERSION_NUMBER
126 ,P_COPY_STRUCTURE_VERSION_ID
127 ,dc(P_DATE_TO)
128 ,dc(P_PROGRAM_UPDATE_DATE)
129 ,P_TOPNODE_POS_CTRL_ENABLED_FLA
130 ,P_ORG_STR_VERSION_USER_KEY
131 ,P_ORG_STRUCTURE_USER_KEY);
132 end insert_batch_lines;
133 --
134 procedure call
135 (p_business_group_id in number,
136 p_batch_line_id     in number) is
137 cursor cr is
138 select l.rowid myrowid,
139 decode(l.pval001,cn,dn,d(l.pval001)) p1,
140 decode(l.pval002,cn,dn,d(l.pval002)) p2,
141 decode(l.pval003,cn,nn,n(l.pval003)) p3,
142 decode(l.pval004,cn,nn,vn,nn,n(l.pval004)) p4,
143 l.pval004 d4,
144 decode(l.pval005,cn,dn,vn,dn,d(l.pval005)) p5,
145 l.pval005 d5,
146 decode(l.pval006,cn,dn,vn,dn,d(l.pval006)) p6,
147 l.pval006 d6,
148 decode(l.pval007,cn,vn,vn,vn,l.pval007) p7,
149 l.pval007 d7,
150 l.pval008 p8,
151 l.pval009 p9,
152 l.pval010 p10,
153 decode(l.pval011,cn,vn,l.pval011) p11
154 from hr_pump_batch_lines l
155 where l.batch_line_id = p_batch_line_id;
156 --
157 c cr%rowtype;
158 l_validate boolean := false;
159 L_ORG_STRUCTURE_VERSION_ID number;
160 L_GAP_WARNING boolean;
161 L_ORGANIZATION_STRUCTURE_ID number;
162 L_REQUEST_ID number;
163 L_PROGRAM_APPLICATION_ID number;
164 L_PROGRAM_ID number;
165 --
166 begin
167 hr_data_pump.entry('call');
168 open cr;
169 fetch cr into c;
170 if cr%notfound then
171 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
172 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
173 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
174 hr_utility.set_message_token('VALUE',p_batch_line_id);
175 hr_utility.raise_error;
176 end if;
177 --
178 if c.p11 is null then
179 L_ORGANIZATION_STRUCTURE_ID:=nn;
180 else
181 L_ORGANIZATION_STRUCTURE_ID := 
182 hr_pump_get.GET_ORG_STRUCTURE_ID
183 (P_ORG_STRUCTURE_USER_KEY => c.p11);
184 end if;
185 --
186 L_REQUEST_ID := 
187 hr_pump_get.get_request_id;
188 --
189 L_PROGRAM_APPLICATION_ID := 
190 hr_pump_get.get_program_application_id;
191 --
192 L_PROGRAM_ID := 
193 hr_pump_get.get_program_id;
194 --
195 hr_data_pump.api_trc_on;
196 PER_ORG_STRUCTURE_VERSION_API.CREATE_ORG_STRUCTURE_VERSION
197 (p_validate => l_validate
198 ,P_EFFECTIVE_DATE => c.p1
199 ,P_ORGANIZATION_STRUCTURE_ID => L_ORGANIZATION_STRUCTURE_ID
200 ,P_DATE_FROM => c.p2
201 ,P_VERSION_NUMBER => c.p3
202 ,P_COPY_STRUCTURE_VERSION_ID => c.p4
203 ,P_DATE_TO => c.p5
204 ,P_REQUEST_ID => L_REQUEST_ID
205 ,P_PROGRAM_APPLICATION_ID => L_PROGRAM_APPLICATION_ID
206 ,P_PROGRAM_ID => L_PROGRAM_ID
207 ,P_PROGRAM_UPDATE_DATE => c.p6
208 ,P_TOPNODE_POS_CTRL_ENABLED_FLA => c.p7
209 ,P_ORG_STRUCTURE_VERSION_ID => L_ORG_STRUCTURE_VERSION_ID
210 ,P_OBJECT_VERSION_NUMBER => c.p9
211 ,P_GAP_WARNING => L_GAP_WARNING);
212 hr_data_pump.api_trc_off;
213 --
214 iuk(p_batch_line_id,c.p8,L_ORG_STRUCTURE_VERSION_ID);
215 --
216 if L_GAP_WARNING then
217 c.p10 := 'TRUE';
218 else
219 c.p10 := 'FALSE';
220 end if;
221 --
222 update hr_pump_batch_lines l set
223 l.pval008 = decode(c.p8,null,cn,c.p8),
224 l.pval009 = decode(c.p9,null,cn,c.p9),
225 l.pval010 = decode(c.p10,null,cn,c.p10)
226 where l.rowid = c.myrowid;
227 --
228 close cr;
229 --
230 hr_data_pump.exit('call');
231 exception
232  when hr_multi_message.error_message_exist then
233    if cr%isopen then
234     close cr;
235    end if;
236    hr_pump_utils.set_multi_msg_error_flag(true);
237  when others then
238  if cr%isopen then
239   close cr;
240  end if;
241  raise;
242 end call;
243 end hrdpp_CREATE_ORG_STRUCTURE_VER;