[Home] [Help]
PACKAGE BODY: APPS.BEN_XCL_SHD
Source
1 Package Body ben_xcl_shd as
2 /* $Header: bexclrhi.pkb 115.7 2002/12/24 21:28:21 rpillay ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xcl_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 l_proc varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18 hr_utility.set_location('Entering:'||l_proc, 5);
19 --
20 Return (nvl(g_api_dml, false));
21 --
22 hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31 l_proc varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34 hr_utility.set_location('Entering:'||l_proc, 5);
35 --
36 If (p_constraint_name = 'BEN_EXT_CHG_EVT_LOG_PK') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 Else
42 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45 hr_utility.raise_error;
46 End If;
47 --
48 hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (
56 p_ext_chg_evt_log_id in number,
57 p_object_version_number in number
58 ) Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 ext_chg_evt_log_id,
66 chg_evt_cd,
67 chg_eff_dt,
68 chg_user_id,
69 prmtr_01,
70 prmtr_02,
71 prmtr_03,
72 prmtr_04,
73 prmtr_05,
74 prmtr_06,
75 prmtr_07,
76 prmtr_08,
77 prmtr_09,
78 prmtr_10,
79 person_id,
80 business_group_id,
81 object_version_number,
82 chg_actl_dt,
83 new_val1,
84 new_val2,
85 new_val3,
86 new_val4,
87 new_val5,
88 new_val6,
89 old_val1,
90 old_val2,
91 old_val3,
92 old_val4,
93 old_val5,
94 old_val6
95 from ben_ext_chg_evt_log
96 where ext_chg_evt_log_id = p_ext_chg_evt_log_id;
97 --
98 l_proc varchar2(72) := g_package||'api_updating';
99 l_fct_ret boolean;
100 --
101 Begin
102 hr_utility.set_location('Entering:'||l_proc, 5);
103 --
104 If (
105 p_ext_chg_evt_log_id is null and
106 p_object_version_number is null
107 ) Then
108 --
109 -- One of the primary key arguments is null therefore we must
110 -- set the returning function value to false
111 --
112 l_fct_ret := false;
113 Else
114 If (
115 p_ext_chg_evt_log_id = g_old_rec.ext_chg_evt_log_id and
116 p_object_version_number = g_old_rec.object_version_number
117 ) Then
118 hr_utility.set_location(l_proc, 10);
119 --
120 -- The g_old_rec is current therefore we must
121 -- set the returning function to true
122 --
123 l_fct_ret := true;
124 Else
125 --
126 -- Select the current row into g_old_rec
127 --
128 Open C_Sel1;
129 Fetch C_Sel1 Into g_old_rec;
130 If C_Sel1%notfound Then
131 Close C_Sel1;
132 --
133 -- The primary key is invalid therefore we must error
134 --
135 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
136 hr_utility.raise_error;
137 End If;
138 Close C_Sel1;
139 If (p_object_version_number <> g_old_rec.object_version_number) Then
140 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
141 hr_utility.raise_error;
142 End If;
143 hr_utility.set_location(l_proc, 15);
144 l_fct_ret := true;
145 End If;
146 End If;
147 hr_utility.set_location(' Leaving:'||l_proc, 20);
148 Return (l_fct_ret);
149 --
150 End api_updating;
151 --
152 -- ----------------------------------------------------------------------------
153 -- |---------------------------------< lck >----------------------------------|
154 -- ----------------------------------------------------------------------------
155 Procedure lck
156 (
157 p_ext_chg_evt_log_id in number,
158 p_object_version_number in number
159 ) is
160 --
161 -- Cursor selects the 'current' row from the HR Schema
162 --
163 Cursor C_Sel1 is
164 select
165 ext_chg_evt_log_id,
166 chg_evt_cd,
167 chg_eff_dt,
168 chg_user_id,
169 prmtr_01,
170 prmtr_02,
171 prmtr_03,
172 prmtr_04,
173 prmtr_05,
174 prmtr_06,
175 prmtr_07,
176 prmtr_08,
177 prmtr_09,
178 prmtr_10,
179 person_id,
180 business_group_id,
181 object_version_number,
182 chg_actl_dt,
183 new_val1,
184 new_val2,
185 new_val3,
186 new_val4,
187 new_val5,
188 new_val6,
189 old_val1,
190 old_val2,
191 old_val3,
192 old_val4,
193 old_val5,
194 old_val6
195 from ben_ext_chg_evt_log
196 where ext_chg_evt_log_id = p_ext_chg_evt_log_id
197 for update nowait;
198 --
199 l_proc varchar2(72) := g_package||'lck';
200 --
201 Begin
202 hr_utility.set_location('Entering:'||l_proc, 5);
203 --
204 -- Add any mandatory argument checking here:
205 -- Example:
206 -- hr_api.mandatory_arg_error
207 -- (p_api_name => l_proc,
208 -- p_argument => 'object_version_number',
209 -- p_argument_value => p_object_version_number);
210 --
211 Open C_Sel1;
212 Fetch C_Sel1 Into g_old_rec;
213 If C_Sel1%notfound then
214 Close C_Sel1;
215 --
216 -- The primary key is invalid therefore we must error
217 --
218 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
219 hr_utility.raise_error;
220 End If;
221 Close C_Sel1;
222 If (p_object_version_number <> g_old_rec.object_version_number) Then
223 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
224 hr_utility.raise_error;
225 End If;
226 --
227 hr_utility.set_location(' Leaving:'||l_proc, 10);
228 --
229 -- We need to trap the ORA LOCK exception
230 --
231 Exception
232 When HR_Api.Object_Locked then
233 --
234 -- The object is locked therefore we need to supply a meaningful
235 -- error message.
236 --
237 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
238 hr_utility.set_message_token('TABLE_NAME', 'ben_ext_chg_evt_log');
239 hr_utility.raise_error;
240 End lck;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |-----------------------------< convert_args >-----------------------------|
244 -- ----------------------------------------------------------------------------
245 Function convert_args
246 (
247 p_ext_chg_evt_log_id in number,
248 p_chg_evt_cd in varchar2,
249 p_chg_eff_dt in date,
250 p_chg_user_id in number,
251 p_prmtr_01 in varchar2,
252 p_prmtr_02 in varchar2,
253 p_prmtr_03 in varchar2,
254 p_prmtr_04 in varchar2,
255 p_prmtr_05 in varchar2,
256 p_prmtr_06 in varchar2,
257 p_prmtr_07 in varchar2,
258 p_prmtr_08 in varchar2,
259 p_prmtr_09 in varchar2,
260 p_prmtr_10 in varchar2,
261 p_person_id in number,
262 p_business_group_id in number,
263 p_object_version_number in number,
264 p_chg_actl_dt in date,
265 p_new_val1 in varchar2,
266 p_new_val2 in varchar2,
267 p_new_val3 in varchar2,
268 p_new_val4 in varchar2,
269 p_new_val5 in varchar2,
270 p_new_val6 in varchar2,
271 p_old_val1 in varchar2,
272 p_old_val2 in varchar2,
273 p_old_val3 in varchar2,
274 p_old_val4 in varchar2,
275 p_old_val5 in varchar2,
276 p_old_val6 in varchar2
277 )
278 Return g_rec_type is
279 --
280 l_rec g_rec_type;
281 l_proc varchar2(72) := g_package||'convert_args';
282 --
283 Begin
284 --
285 hr_utility.set_location('Entering:'||l_proc, 5);
286 --
287 -- Convert arguments into local l_rec structure.
288 --
289 l_rec.ext_chg_evt_log_id := p_ext_chg_evt_log_id;
290 l_rec.chg_evt_cd := p_chg_evt_cd;
291 l_rec.chg_eff_dt := p_chg_eff_dt;
292 l_rec.chg_user_id := p_chg_user_id;
293 l_rec.prmtr_01 := p_prmtr_01;
294 l_rec.prmtr_02 := p_prmtr_02;
295 l_rec.prmtr_03 := p_prmtr_03;
296 l_rec.prmtr_04 := p_prmtr_04;
297 l_rec.prmtr_05 := p_prmtr_05;
298 l_rec.prmtr_06 := p_prmtr_06;
299 l_rec.prmtr_07 := p_prmtr_07;
300 l_rec.prmtr_08 := p_prmtr_08;
301 l_rec.prmtr_09 := p_prmtr_09;
302 l_rec.prmtr_10 := p_prmtr_10;
303 l_rec.person_id := p_person_id;
304 l_rec.business_group_id := p_business_group_id;
305 l_rec.object_version_number := p_object_version_number;
306 l_rec.chg_actl_dt := p_chg_actl_dt;
307 l_rec.new_val1 := p_new_val1;
308 l_rec.new_val2 := p_new_val2;
309 l_rec.new_val3 := p_new_val3;
310 l_rec.new_val4 := p_new_val4;
311 l_rec.new_val5 := p_new_val5;
312 l_rec.new_val6 := p_new_val6;
313 l_rec.old_val1 := p_old_val1;
314 l_rec.old_val2 := p_old_val2;
315 l_rec.old_val3 := p_old_val3;
316 l_rec.old_val4 := p_old_val4;
317 l_rec.old_val5 := p_old_val5;
318 l_rec.old_val6 := p_old_val6;
319 --
320 -- Return the plsql record structure.
321 --
322 hr_utility.set_location(' Leaving:'||l_proc, 10);
323 Return(l_rec);
324 --
325 End convert_args;
326 --
327 end ben_xcl_shd;