DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_UPDATE_ORG_STRUCTURE_VER

Source


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