DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_USER_COLUMN

Source


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