DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_DELETE_PERSON

Source


1 package body hrdpp_DELETE_PERSON as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2013/08/13 18:08:14
4  * Generated for API: HR_PERSON_API.DELETE_PERSON
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_PERFORM_PREDEL_VALIDATION in boolean default null
84 ,P_PERSON_USER_KEY in varchar2) is
85 blid number := p_data_pump_batch_line_id;
86  L_PERFORM_PREDEL_VALIDATION varchar2(5);
87 begin
88 if P_PERFORM_PREDEL_VALIDATION is null then
89  L_PERFORM_PREDEL_VALIDATION := null;
90 elsif P_PERFORM_PREDEL_VALIDATION then
91  L_PERFORM_PREDEL_VALIDATION := 'TRUE';
92 else 
93  L_PERFORM_PREDEL_VALIDATION := 'FALSE';
94 end if;
95 if blid is not null then
96 delete from hr_pump_batch_lines where batch_line_id = blid;
97 delete from hr_pump_batch_exceptions
98 where source_type = 'BATCH_LINE' and source_id = blid;
99 end if;
100 insert into hr_pump_batch_lines
101 (batch_id
102 ,batch_line_id
103 ,business_group_name
104 ,api_module_id
105 ,line_status
106 ,user_sequence
107 ,link_value
108 ,pval001
109 ,pval002
110 ,pval004)
111 values
112 (p_batch_id
113 ,nvl(blid,hr_pump_batch_lines_s.nextval)
114 ,p_data_pump_business_grp_name
115 ,3691
116 ,'U'
117 ,p_user_sequence
118 ,p_link_value
119 ,dc(P_EFFECTIVE_DATE)
120 ,L_PERFORM_PREDEL_VALIDATION
121 ,P_PERSON_USER_KEY);
122 end insert_batch_lines;
123 --
124 procedure call
125 (p_business_group_id in number,
126 p_batch_line_id     in number) is
127 cursor cr is
128 select l.rowid myrowid,
129 decode(l.pval001,cn,dn,d(l.pval001)) p1,
130 decode(l.pval002,cn,vn,vn,null,l.pval002) p2,
131 l.pval002 d2,
132 l.pval003 p3,
133 decode(l.pval004,cn,vn,l.pval004) p4
134 from hr_pump_batch_lines l
135 where l.batch_line_id = p_batch_line_id;
136 --
137 c cr%rowtype;
138 l_validate boolean := false;
139 L_PERFORM_PREDEL_VALIDATION boolean;
140 L_PERSON_ID number;
141 --
142 begin
143 hr_data_pump.entry('call');
144 open cr;
145 fetch cr into c;
146 if cr%notfound then
147 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
148 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
149 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
150 hr_utility.set_message_token('VALUE',p_batch_line_id);
151 hr_utility.raise_error;
152 end if;
153 --
154 if upper(c.p2) = 'TRUE' then
155 L_PERFORM_PREDEL_VALIDATION := true;
156 elsif upper(c.p2) = 'FALSE' then
157 L_PERFORM_PREDEL_VALIDATION := false;
158 elsif c.p2 is not null then
159 hr_utility.set_message(800,'HR_50327_DP_TYPE_ERR');
160 hr_utility.set_message_token('TYPE','BOOLEAN');
161 hr_utility.set_message_token('PARAMETER','P_PERFORM_PREDEL_VALIDATION');
162 hr_utility.set_message_token('VALUE',c.p2);
163 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
164 hr_utility.raise_error;
165 end if;
166 --
167 if c.p4 is null then
168 L_PERSON_ID:=nn;
169 else
170 L_PERSON_ID := 
171 hr_pump_get.get_person_id
172 (P_PERSON_USER_KEY => c.p4);
173 end if;
174 --
175 hr_data_pump.api_trc_on;
176 HR_PERSON_API.DELETE_PERSON
177 (p_validate => l_validate
178 ,P_EFFECTIVE_DATE => c.p1
179 ,P_PERSON_ID => L_PERSON_ID
180 ,P_PERFORM_PREDEL_VALIDATION => L_PERFORM_PREDEL_VALIDATION
181 ,P_PERSON_ORG_MANAGER_WARNING => c.p3);
182 hr_data_pump.api_trc_off;
183 
184 --
185 update hr_pump_batch_lines l set
186 l.pval003 = decode(c.p3,null,cn,c.p3)
187 where l.rowid = c.myrowid;
188 --
189 close cr;
190 --
191 hr_data_pump.exit('call');
192 exception
193  when hr_multi_message.error_message_exist then
194    if cr%isopen then
195     close cr;
196    end if;
197    hr_pump_utils.set_multi_msg_error_flag(true);
198  when others then
199  if cr%isopen then
200   close cr;
201  end if;
202  raise;
203 end call;
204 end hrdpp_DELETE_PERSON;