DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_UPDATE_JOB_GROUP

Source


1 package body hrdpp_UPDATE_JOB_GROUP as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2009/03/30 04:03:09
4  * Generated for API: PER_JOB_GROUP_API.UPDATE_JOB_GROUP
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_LEGISLATION_CODE in varchar2 default null
84 ,P_INTERNAL_NAME in varchar2
85 ,P_DISPLAYED_NAME in varchar2
86 ,P_ID_FLEX_NUM in number
87 ,P_MASTER_FLAG in varchar2 default null
88 ,P_JOB_GROUP_USER_KEY in varchar2) is
89 blid number := p_data_pump_batch_line_id;
90 begin
91 if blid is not null then
92 delete from hr_pump_batch_lines where batch_line_id = blid;
93 delete from hr_pump_batch_exceptions
94 where source_type = 'BATCH_LINE' and source_id = blid;
95 end if;
96 insert into hr_pump_batch_lines
97 (batch_id
98 ,batch_line_id
99 ,business_group_name
100 ,api_module_id
101 ,line_status
102 ,user_sequence
103 ,link_value
104 ,pval001
105 ,pval002
106 ,pval003
107 ,pval004
108 ,pval005
109 ,pval006
110 ,pval007)
111 values
112 (p_batch_id
113 ,nvl(blid,hr_pump_batch_lines_s.nextval)
114 ,p_data_pump_business_grp_name
115 ,1592
116 ,'U'
117 ,p_user_sequence
118 ,p_link_value
119 ,dc(P_EFFECTIVE_DATE)
120 ,P_LEGISLATION_CODE
121 ,P_INTERNAL_NAME
122 ,P_DISPLAYED_NAME
123 ,P_ID_FLEX_NUM
124 ,P_MASTER_FLAG
125 ,P_JOB_GROUP_USER_KEY);
126 end insert_batch_lines;
127 --
128 procedure call
129 (p_business_group_id in number,
130 p_batch_line_id     in number) is
131 cursor cr is
132 select l.rowid myrowid,
133 decode(l.pval001,cn,dn,d(l.pval001)) p1,
134 decode(l.pval002,cn,vn,vn,vh,l.pval002) p2,
135 l.pval002 d2,
136 decode(l.pval003,cn,vn,l.pval003) p3,
137 decode(l.pval004,cn,vn,l.pval004) p4,
138 decode(l.pval005,cn,nn,n(l.pval005)) p5,
139 decode(l.pval006,cn,vn,vn,vh,
140  hr_pump_get.gl(l.pval006,'YES_NO',d(l.pval001),vn)) p6,
141 l.pval006 d6,
142 decode(l.pval007,cn,vn,l.pval007) p7
143 from hr_pump_batch_lines l
144 where l.batch_line_id = p_batch_line_id;
145 --
146 c cr%rowtype;
147 l_validate boolean := false;
148 L_JOB_GROUP_ID number;
149 L_OBJECT_VERSION_NUMBER number;
150 --
151 begin
152 hr_data_pump.entry('call');
153 open cr;
154 fetch cr into c;
155 if cr%notfound then
156 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
157 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
158 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
159 hr_utility.set_message_token('VALUE',p_batch_line_id);
160 hr_utility.raise_error;
161 end if;
162 --
163 if c.p7 is null then
164 L_JOB_GROUP_ID:=nn;
165 else
166 L_JOB_GROUP_ID := 
167 hr_pump_get.get_job_group_id
168 (P_JOB_GROUP_USER_KEY => c.p7);
169 end if;
170 --
171 if c.p7 is null then
172 L_OBJECT_VERSION_NUMBER:=nn;
173 else
174 L_OBJECT_VERSION_NUMBER := 
175 hr_pump_get.GET_JGR_OVN
176 (P_JOB_GROUP_USER_KEY => c.p7);
177 end if;
178 --
179 hr_data_pump.api_trc_on;
180 PER_JOB_GROUP_API.UPDATE_JOB_GROUP
181 (p_validate => l_validate
182 ,P_EFFECTIVE_DATE => c.p1
183 ,P_JOB_GROUP_ID => L_JOB_GROUP_ID
184 ,p_business_group_id => p_business_group_id
185 ,P_LEGISLATION_CODE => c.p2
186 ,P_INTERNAL_NAME => c.p3
187 ,P_DISPLAYED_NAME => c.p4
188 ,P_ID_FLEX_NUM => c.p5
189 ,P_MASTER_FLAG => c.p6
190 ,P_OBJECT_VERSION_NUMBER => L_OBJECT_VERSION_NUMBER);
191 hr_data_pump.api_trc_off;
192 
193 --
194 
195 --
196 close cr;
197 --
198 hr_data_pump.exit('call');
199 exception
200  when hr_multi_message.error_message_exist then
201    if cr%isopen then
202     close cr;
203    end if;
204    hr_pump_utils.set_multi_msg_error_flag(true);
205  when others then
206  if cr%isopen then
207   close cr;
208  end if;
209  raise;
210 end call;
211 end hrdpp_UPDATE_JOB_GROUP;