[Home] [Help]
PACKAGE BODY: APPS.BEN_BNG_SHD
Source
1 Package Body ben_bng_shd as
2 /* $Header: bebngrhi.pkb 120.0.12010000.2 2008/08/05 14:08:45 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_bng_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_BENFTS_GRP_FK1') 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 ElsIf (p_constraint_name = 'BEN_BENFTS_GRP_PK') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 ElsIf (p_constraint_name = 'BEN_BNFTS_GRP_UK') Then
47 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('STEP','15');
50 hr_utility.raise_error;
51 ElsIf (p_constraint_name = 'BEN_BENEFIT_ACTIONS_FK3') Then
52 ben_utility.child_exists_error(p_table_name => 'BEN_BENEFIT_ACTIONS');
53 ElsIf (p_constraint_name = 'BEN_BENFTS_GRP_RT_F_FK1') Then
54 ben_utility.child_exists_error(p_table_name => 'BEN_BENFTS_GRP_RT_F');
55 ElsIf (p_constraint_name = 'BEN_BENFTS_GRP_PRTE_F_FK1') Then
56 ben_utility.child_exists_error(p_table_name => 'BEN_BENFTS_GRP_PRTE_F');
57 Else
58 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
59 hr_utility.set_message_token('PROCEDURE', l_proc);
60 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
61 hr_utility.raise_error;
62 End If;
63 --
64 hr_utility.set_location(' Leaving:'||l_proc, 10);
65 End constraint_error;
66 --
67 -- ----------------------------------------------------------------------------
68 -- |-----------------------------< api_updating >-----------------------------|
69 -- ----------------------------------------------------------------------------
70 Function api_updating
71 (
72 p_benfts_grp_id in number,
73 p_object_version_number in number
74 ) Return Boolean Is
75 --
76 --
77 -- Cursor selects the 'current' row from the HR Schema
78 --
79 Cursor C_Sel1 is
80 select
81 benfts_grp_id,
82 business_group_id,
83 name,
84 bng_desc,
85 bng_attribute_category,
86 bng_attribute1,
87 bng_attribute2,
88 bng_attribute3,
89 bng_attribute4,
90 bng_attribute5,
91 bng_attribute6,
92 bng_attribute7,
93 bng_attribute8,
94 bng_attribute9,
95 bng_attribute10,
96 bng_attribute11,
97 bng_attribute12,
98 bng_attribute13,
99 bng_attribute14,
100 bng_attribute15,
101 bng_attribute16,
102 bng_attribute17,
103 bng_attribute18,
104 bng_attribute19,
105 bng_attribute20,
106 bng_attribute21,
107 bng_attribute22,
108 bng_attribute23,
109 bng_attribute24,
110 bng_attribute25,
111 bng_attribute26,
112 bng_attribute27,
113 bng_attribute28,
114 bng_attribute29,
115 bng_attribute30,
116 object_version_number
117 from ben_benfts_grp
118 where benfts_grp_id = p_benfts_grp_id;
119 --
120 l_proc varchar2(72) := g_package||'api_updating';
121 l_fct_ret boolean;
122 --
123 Begin
124 hr_utility.set_location('Entering:'||l_proc, 5);
125 --
126 If (
127 p_benfts_grp_id is null and
128 p_object_version_number is null
129 ) Then
130 --
131 -- One of the primary key arguments is null therefore we must
132 -- set the returning function value to false
133 --
134 l_fct_ret := false;
135 Else
136 If (
137 p_benfts_grp_id = g_old_rec.benfts_grp_id and
138 p_object_version_number = g_old_rec.object_version_number
139 ) Then
140 hr_utility.set_location(l_proc, 10);
141 --
142 -- The g_old_rec is current therefore we must
143 -- set the returning function to true
144 --
145 l_fct_ret := true;
146 Else
147 --
148 -- Select the current row into g_old_rec
149 --
150 Open C_Sel1;
151 Fetch C_Sel1 Into g_old_rec;
152 If C_Sel1%notfound Then
153 Close C_Sel1;
154 --
155 -- The primary key is invalid therefore we must error
156 --
157 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
158 hr_utility.raise_error;
159 End If;
160 Close C_Sel1;
161 If (p_object_version_number <> g_old_rec.object_version_number) Then
162 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
163 hr_utility.raise_error;
164 End If;
165 hr_utility.set_location(l_proc, 15);
166 l_fct_ret := true;
167 End If;
168 End If;
169 hr_utility.set_location(' Leaving:'||l_proc, 20);
170 Return (l_fct_ret);
171 --
172 End api_updating;
173 --
174 -- ----------------------------------------------------------------------------
175 -- |---------------------------------< lck >----------------------------------|
176 -- ----------------------------------------------------------------------------
177 Procedure lck
178 (
179 p_benfts_grp_id in number,
180 p_object_version_number in number
181 ) is
182 --
183 -- Cursor selects the 'current' row from the HR Schema
184 --
185 Cursor C_Sel1 is
186 select benfts_grp_id,
187 business_group_id,
188 name,
189 bng_desc,
190 bng_attribute_category,
191 bng_attribute1,
192 bng_attribute2,
193 bng_attribute3,
194 bng_attribute4,
195 bng_attribute5,
196 bng_attribute6,
197 bng_attribute7,
198 bng_attribute8,
199 bng_attribute9,
200 bng_attribute10,
201 bng_attribute11,
202 bng_attribute12,
203 bng_attribute13,
204 bng_attribute14,
205 bng_attribute15,
206 bng_attribute16,
207 bng_attribute17,
208 bng_attribute18,
209 bng_attribute19,
210 bng_attribute20,
211 bng_attribute21,
212 bng_attribute22,
213 bng_attribute23,
214 bng_attribute24,
215 bng_attribute25,
216 bng_attribute26,
217 bng_attribute27,
218 bng_attribute28,
219 bng_attribute29,
220 bng_attribute30,
221 object_version_number
222 from ben_benfts_grp
223 where benfts_grp_id = p_benfts_grp_id
224 for update nowait;
225 --
226 l_proc varchar2(72) := g_package||'lck';
227 --
228 Begin
229 hr_utility.set_location('Entering:'||l_proc, 5);
230 --
231 -- Add any mandatory argument checking here:
232 -- Example:
233 -- hr_api.mandatory_arg_error
234 -- (p_api_name => l_proc,
235 -- p_argument => 'object_version_number',
236 -- p_argument_value => p_object_version_number);
237 --
238 Open C_Sel1;
239 Fetch C_Sel1 Into g_old_rec;
240 If C_Sel1%notfound then
241 Close C_Sel1;
242 --
243 -- The primary key is invalid therefore we must error
244 --
245 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
246 hr_utility.raise_error;
247 End If;
248 Close C_Sel1;
249 If (p_object_version_number <> g_old_rec.object_version_number) Then
250 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
251 hr_utility.raise_error;
252 End If;
253 --
254 hr_utility.set_location(' Leaving:'||l_proc, 10);
255 --
256 -- We need to trap the ORA LOCK exception
257 --
258 Exception
259 When HR_Api.Object_Locked then
260 --
261 -- The object is locked therefore we need to supply a meaningful
262 -- error message.
263 --
264 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
265 hr_utility.set_message_token('TABLE_NAME', 'ben_benfts_grp');
266 hr_utility.raise_error;
267 End lck;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |-----------------------------< convert_args >-----------------------------|
271 -- ----------------------------------------------------------------------------
272 Function convert_args
273 (
274 p_benfts_grp_id in number,
275 p_business_group_id in number,
276 p_name in varchar2,
277 p_bng_desc in varchar2,
278 p_bng_attribute_category in varchar2,
279 p_bng_attribute1 in varchar2,
280 p_bng_attribute2 in varchar2,
281 p_bng_attribute3 in varchar2,
282 p_bng_attribute4 in varchar2,
283 p_bng_attribute5 in varchar2,
284 p_bng_attribute6 in varchar2,
285 p_bng_attribute7 in varchar2,
286 p_bng_attribute8 in varchar2,
287 p_bng_attribute9 in varchar2,
288 p_bng_attribute10 in varchar2,
289 p_bng_attribute11 in varchar2,
290 p_bng_attribute12 in varchar2,
291 p_bng_attribute13 in varchar2,
292 p_bng_attribute14 in varchar2,
293 p_bng_attribute15 in varchar2,
294 p_bng_attribute16 in varchar2,
295 p_bng_attribute17 in varchar2,
296 p_bng_attribute18 in varchar2,
297 p_bng_attribute19 in varchar2,
298 p_bng_attribute20 in varchar2,
299 p_bng_attribute21 in varchar2,
300 p_bng_attribute22 in varchar2,
301 p_bng_attribute23 in varchar2,
302 p_bng_attribute24 in varchar2,
303 p_bng_attribute25 in varchar2,
304 p_bng_attribute26 in varchar2,
305 p_bng_attribute27 in varchar2,
306 p_bng_attribute28 in varchar2,
307 p_bng_attribute29 in varchar2,
308 p_bng_attribute30 in varchar2,
309 p_object_version_number in number
310 )
311 Return g_rec_type is
312 --
313 l_rec g_rec_type;
314 l_proc varchar2(72) := g_package||'convert_args';
315 --
316 Begin
317 --
318 hr_utility.set_location('Entering:'||l_proc, 5);
319 --
320 -- Convert arguments into local l_rec structure.
321 --
322 l_rec.benfts_grp_id := p_benfts_grp_id;
323 l_rec.business_group_id := p_business_group_id;
324 l_rec.name := p_name;
325 l_rec.bng_desc := p_bng_desc;
326 l_rec.bng_attribute_category := p_bng_attribute_category;
327 l_rec.bng_attribute1 := p_bng_attribute1;
328 l_rec.bng_attribute2 := p_bng_attribute2;
329 l_rec.bng_attribute3 := p_bng_attribute3;
330 l_rec.bng_attribute4 := p_bng_attribute4;
331 l_rec.bng_attribute5 := p_bng_attribute5;
332 l_rec.bng_attribute6 := p_bng_attribute6;
333 l_rec.bng_attribute7 := p_bng_attribute7;
334 l_rec.bng_attribute8 := p_bng_attribute8;
335 l_rec.bng_attribute9 := p_bng_attribute9;
336 l_rec.bng_attribute10 := p_bng_attribute10;
337 l_rec.bng_attribute11 := p_bng_attribute11;
338 l_rec.bng_attribute12 := p_bng_attribute12;
339 l_rec.bng_attribute13 := p_bng_attribute13;
340 l_rec.bng_attribute14 := p_bng_attribute14;
341 l_rec.bng_attribute15 := p_bng_attribute15;
342 l_rec.bng_attribute16 := p_bng_attribute16;
343 l_rec.bng_attribute17 := p_bng_attribute17;
344 l_rec.bng_attribute18 := p_bng_attribute18;
345 l_rec.bng_attribute19 := p_bng_attribute19;
346 l_rec.bng_attribute20 := p_bng_attribute20;
347 l_rec.bng_attribute21 := p_bng_attribute21;
348 l_rec.bng_attribute22 := p_bng_attribute22;
349 l_rec.bng_attribute23 := p_bng_attribute23;
350 l_rec.bng_attribute24 := p_bng_attribute24;
351 l_rec.bng_attribute25 := p_bng_attribute25;
352 l_rec.bng_attribute26 := p_bng_attribute26;
353 l_rec.bng_attribute27 := p_bng_attribute27;
354 l_rec.bng_attribute28 := p_bng_attribute28;
355 l_rec.bng_attribute29 := p_bng_attribute29;
356 l_rec.bng_attribute30 := p_bng_attribute30;
357 l_rec.object_version_number := p_object_version_number;
358 --
359 -- Return the plsql record structure.
360 --
361 hr_utility.set_location(' Leaving:'||l_proc, 10);
362 Return(l_rec);
363 --
364 End convert_args;
365 --
366 end ben_bng_shd;