DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_BALANCE_TYPE

Source


1 package body hrdpp_CREATE_BALANCE_TYPE as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2007/01/03 23:01:46
4  * Generated for API: PER_BF_BALANCE_TYPES_API.CREATE_BALANCE_TYPE
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_DISPLAYED_NAME in varchar2
83 ,P_INTERNAL_NAME in varchar2
84 ,P_UOM in varchar2 default null
85 ,P_CURRENCY in varchar2 default null
86 ,P_CATEGORY in varchar2 default null
87 ,P_DATE_FROM in date default null
88 ,P_DATE_TO in date default null
89 ,P_EFFECTIVE_DATE in date
90 ,P_REPORTING_NAME in varchar2 default null) 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 ,pval003
107 ,pval004
108 ,pval005
109 ,pval006
110 ,pval007
111 ,pval008
112 ,pval009
113 ,pval010
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 ,1625
120 ,'U'
121 ,p_user_sequence
122 ,p_link_value
123 ,P_DISPLAYED_NAME
124 ,P_INTERNAL_NAME
125 ,P_UOM
126 ,P_CURRENCY
127 ,P_CATEGORY
128 ,dc(P_DATE_FROM)
129 ,dc(P_DATE_TO)
130 ,dc(P_EFFECTIVE_DATE)
131 ,P_REPORTING_NAME);
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 l.pval001 p1,
140 l.pval002 p2,
141 decode(l.pval003,cn,vn,l.pval003) p3,
142 decode(l.pval004,cn,vn,l.pval004) p4,
143 decode(l.pval005,cn,vn,vn,vn,l.pval005) p5,
144 l.pval005 d5,
145 decode(l.pval006,cn,vn,vn,vn,l.pval006) p6,
146 l.pval006 d6,
147 decode(l.pval007,cn,vn,vn,vn,l.pval007) p7,
148 l.pval007 d7,
149 decode(l.pval008,cn,dn,vn,dn,d(l.pval008)) p8,
150 l.pval008 d8,
151 decode(l.pval009,cn,dn,vn,dn,d(l.pval009)) p9,
152 l.pval009 d9,
153 decode(l.pval010,cn,dn,d(l.pval010)) p10,
154 decode(l.pval011,cn,vn,vn,vn,l.pval011) p11,
155 l.pval011 d11
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_INPUT_VALUE_ID number;
162 --
163 begin
164 hr_data_pump.entry('call');
165 open cr;
166 fetch cr into c;
167 if cr%notfound then
168 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
169 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
170 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
171 hr_utility.set_message_token('VALUE',p_batch_line_id);
172 hr_utility.raise_error;
173 end if;
174 --
175 if c.p11 is null or
176 c.p10 is null then
177 L_INPUT_VALUE_ID:=nn;
178 else
179 L_INPUT_VALUE_ID := 
180 PER_BF_GEN_DATA_PUMP.get_input_value_id
181 (P_REPORTING_NAME => c.p11
182 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
183 ,P_EFFECTIVE_DATE => c.p10);
184 end if;
185 --
186 hr_data_pump.api_trc_on;
187 PER_BF_BALANCE_TYPES_API.CREATE_BALANCE_TYPE
188 (P_BALANCE_TYPE_ID => c.p1
189 ,P_OBJECT_VERSION_NUMBER => c.p2
190 ,P_INPUT_VALUE_ID => L_INPUT_VALUE_ID
191 ,p_business_group_id => p_business_group_id
192 ,P_DISPLAYED_NAME => c.p3
193 ,P_INTERNAL_NAME => c.p4
194 ,P_UOM => c.p5
195 ,P_CURRENCY => c.p6
196 ,P_CATEGORY => c.p7
197 ,P_DATE_FROM => c.p8
198 ,P_DATE_TO => c.p9
199 ,p_validate => l_validate
200 ,P_EFFECTIVE_DATE => c.p10);
201 hr_data_pump.api_trc_off;
202 
203 --
204 update hr_pump_batch_lines l set
205 l.pval001 = decode(c.p1,null,cn,c.p1),
206 l.pval002 = decode(c.p2,null,cn,c.p2)
207 where l.rowid = c.myrowid;
208 --
209 close cr;
210 --
211 hr_data_pump.exit('call');
212 exception
213  when hr_multi_message.error_message_exist then
214    if cr%isopen then
215     close cr;
216    end if;
217    hr_pump_utils.set_multi_msg_error_flag(true);
218  when others then
219  if cr%isopen then
220   close cr;
221  end if;
222  raise;
223 end call;
224 end hrdpp_CREATE_BALANCE_TYPE;