DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_AGF_SHD

Source


1 Package Body ben_agf_shd as
2 /* $Header: beagfrhi.pkb 120.0 2005/05/28 00:23:13 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_agf_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_AGE_FCTR_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;
44     hr_utility.set_message_token('STEP','10');
41   ElsIf (p_constraint_name = 'BEN_AGE_FCTR_PK') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'BEN_AGE_RT_F_FK1') Then
47     ben_utility.child_exists_error(p_table_name => 'BEN_AGE_RT_F');
48   ElsIf (p_constraint_name = 'BEN_CMBN_AGE_LOS_FCTR_FK1') Then
49     ben_utility.child_exists_error(p_table_name => 'BEN_CMBN_AGE_LOS_FCTR');
50   ElsIf (p_constraint_name = 'BEN_ELIG_AGE_CVG_F_FK3') Then
51     ben_utility.child_exists_error(p_table_name => 'BEN_ELIG_AGE_CVG_F');
52   ElsIf (p_constraint_name = 'BEN_ELIG_AGE_PRTE_F_FK2') Then
53     ben_utility.child_exists_error(p_table_name => 'BEN_ELIG_AGE_PRTE_F');
54   ElsIf (p_constraint_name = 'BEN_VSTG_AGE_RQMT_FK1') Then
55     ben_utility.child_exists_error(p_table_name => 'BEN_VSTG_AGE_RQMT_FK1');
56   Else
57     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
59     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
60     hr_utility.raise_error;
61   End If;
62   --
63   hr_utility.set_location(' Leaving:'||l_proc, 10);
64 End constraint_error;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-----------------------------< api_updating >-----------------------------|
68 -- ----------------------------------------------------------------------------
69 Function api_updating
70   (
71   p_age_fctr_id                        in number,
72   p_object_version_number              in number
73   )      Return Boolean Is
74 --
75   --
76   -- Cursor selects the 'current' row from the HR Schema
77   --
78   Cursor C_Sel1 is
79     select
80 		age_fctr_id,
81 	name,
82 	mx_age_num,
83 	mn_age_num,
84 	age_uom,
85 	no_mn_age_flag,
86 	no_mx_age_flag,
87         age_to_use_cd,
88 	age_det_cd,
89 	age_det_rl,
90 	rndg_cd,
91 	rndg_rl,
92 	age_calc_rl,
93 	business_group_id,
94 	agf_attribute_category,
95 	agf_attribute1,
96 	agf_attribute2,
97 	agf_attribute3,
98 	agf_attribute4,
99 	agf_attribute5,
100 	agf_attribute6,
101 	agf_attribute7,
102 	agf_attribute8,
103 	agf_attribute9,
104 	agf_attribute10,
105 	agf_attribute11,
106 	agf_attribute12,
107 	agf_attribute13,
108 	agf_attribute14,
109 	agf_attribute15,
110 	agf_attribute16,
111 	agf_attribute17,
112 	agf_attribute18,
113 	agf_attribute19,
114 	agf_attribute20,
115 	agf_attribute21,
116 	agf_attribute22,
117 	agf_attribute23,
118 	agf_attribute24,
119 	agf_attribute25,
120 	agf_attribute26,
121 	agf_attribute27,
122 	agf_attribute28,
123 	agf_attribute29,
124 	agf_attribute30,
125 	object_version_number
126     from	ben_age_fctr
127     where	age_fctr_id = p_age_fctr_id;
128 --
129   l_proc	varchar2(72)	:= g_package||'api_updating';
130   l_fct_ret	boolean;
131 --
132 Begin
133   hr_utility.set_location('Entering:'||l_proc, 5);
134   --
135   If (
136 	p_age_fctr_id is null and
137 	p_object_version_number is null
138      ) Then
139     --
140     -- One of the primary key arguments is null therefore we must
141     -- set the returning function value to false
142     --
143     l_fct_ret := false;
144   Else
145     If (
146 	p_age_fctr_id = g_old_rec.age_fctr_id and
147 	p_object_version_number = g_old_rec.object_version_number
148        ) Then
149       hr_utility.set_location(l_proc, 10);
150       --
151       -- The g_old_rec is current therefore we must
152       -- set the returning function to true
153       --
154       l_fct_ret := true;
155     Else
156       --
157       -- Select the current row into g_old_rec
158       --
159       Open C_Sel1;
160       Fetch C_Sel1 Into g_old_rec;
161       If C_Sel1%notfound Then
162         Close C_Sel1;
163         --
164         -- The primary key is invalid therefore we must error
165         --
166         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
167         hr_utility.raise_error;
168       End If;
169       Close C_Sel1;
170       If (p_object_version_number <> g_old_rec.object_version_number) Then
171         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
172         hr_utility.raise_error;
173       End If;
174       hr_utility.set_location(l_proc, 15);
175       l_fct_ret := true;
176     End If;
177   End If;
178   hr_utility.set_location(' Leaving:'||l_proc, 20);
179   Return (l_fct_ret);
180 --
181 End api_updating;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |---------------------------------< lck >----------------------------------|
185 -- ----------------------------------------------------------------------------
186 Procedure lck
187   (
188   p_age_fctr_id                        in number,
189   p_object_version_number              in number
190   ) is
191 --
192 -- Cursor selects the 'current' row from the HR Schema
193 --
194   Cursor C_Sel1 is
195     select 	age_fctr_id,
196 	name,
197 	mx_age_num,
198 	mn_age_num,
199 	age_uom,
200 	no_mn_age_flag,
201 	no_mx_age_flag,
202         age_to_use_cd,
203 	age_det_cd,
204 	age_det_rl,
205 	rndg_cd,
206 	rndg_rl,
210 	agf_attribute1,
207 	age_calc_rl,
208 	business_group_id,
209 	agf_attribute_category,
211 	agf_attribute2,
212 	agf_attribute3,
213 	agf_attribute4,
214 	agf_attribute5,
215 	agf_attribute6,
216 	agf_attribute7,
217 	agf_attribute8,
218 	agf_attribute9,
219 	agf_attribute10,
220 	agf_attribute11,
221 	agf_attribute12,
222 	agf_attribute13,
223 	agf_attribute14,
224 	agf_attribute15,
225 	agf_attribute16,
226 	agf_attribute17,
227 	agf_attribute18,
228 	agf_attribute19,
229 	agf_attribute20,
230 	agf_attribute21,
231 	agf_attribute22,
232 	agf_attribute23,
233 	agf_attribute24,
234 	agf_attribute25,
235 	agf_attribute26,
236 	agf_attribute27,
237 	agf_attribute28,
238 	agf_attribute29,
239 	agf_attribute30,
240 	object_version_number
241     from	ben_age_fctr
242     where	age_fctr_id = p_age_fctr_id
243     for	update nowait;
244 --
245   l_proc	varchar2(72) := g_package||'lck';
246 --
247 Begin
248   hr_utility.set_location('Entering:'||l_proc, 5);
249   --
250   -- Add any mandatory argument checking here:
251   -- Example:
252   -- hr_api.mandatory_arg_error
253   --   (p_api_name       => l_proc,
254   --    p_argument       => 'object_version_number',
255   --    p_argument_value => p_object_version_number);
256   --
257   Open  C_Sel1;
258   Fetch C_Sel1 Into g_old_rec;
259   If C_Sel1%notfound then
260     Close C_Sel1;
261     --
262     -- The primary key is invalid therefore we must error
263     --
264     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
265     hr_utility.raise_error;
266   End If;
267   Close C_Sel1;
268   If (p_object_version_number <> g_old_rec.object_version_number) Then
269         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
270         hr_utility.raise_error;
271       End If;
272 --
273   hr_utility.set_location(' Leaving:'||l_proc, 10);
274 --
275 -- We need to trap the ORA LOCK exception
276 --
277 Exception
278   When HR_Api.Object_Locked then
279     --
280     -- The object is locked therefore we need to supply a meaningful
281     -- error message.
282     --
283     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
284     hr_utility.set_message_token('TABLE_NAME', 'ben_age_fctr');
285     hr_utility.raise_error;
286 End lck;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |-----------------------------< convert_args >-----------------------------|
290 -- ----------------------------------------------------------------------------
291 Function convert_args
292 	(
293 	p_age_fctr_id                   in number,
294 	p_name                          in varchar2,
295 	p_mx_age_num                    in number,
296 	p_mn_age_num                    in number,
297 	p_age_uom                       in varchar2,
298 	p_no_mn_age_flag                in varchar2,
299 	p_no_mx_age_flag                in varchar2,
300         p_age_to_use_cd                 in varchar2,
301 	p_age_det_cd                    in varchar2,
302 	p_age_det_rl                    in number,
303 	p_rndg_cd                       in varchar2,
304 	p_rndg_rl                       in number,
305 	p_age_calc_rl                   in number,
306 	p_business_group_id             in number,
307 	p_agf_attribute_category        in varchar2,
308 	p_agf_attribute1                in varchar2,
309 	p_agf_attribute2                in varchar2,
310 	p_agf_attribute3                in varchar2,
311 	p_agf_attribute4                in varchar2,
312 	p_agf_attribute5                in varchar2,
313 	p_agf_attribute6                in varchar2,
314 	p_agf_attribute7                in varchar2,
315 	p_agf_attribute8                in varchar2,
316 	p_agf_attribute9                in varchar2,
317 	p_agf_attribute10               in varchar2,
318 	p_agf_attribute11               in varchar2,
319 	p_agf_attribute12               in varchar2,
320 	p_agf_attribute13               in varchar2,
321 	p_agf_attribute14               in varchar2,
322 	p_agf_attribute15               in varchar2,
323 	p_agf_attribute16               in varchar2,
324 	p_agf_attribute17               in varchar2,
325 	p_agf_attribute18               in varchar2,
326 	p_agf_attribute19               in varchar2,
327 	p_agf_attribute20               in varchar2,
328 	p_agf_attribute21               in varchar2,
329 	p_agf_attribute22               in varchar2,
330 	p_agf_attribute23               in varchar2,
331 	p_agf_attribute24               in varchar2,
332 	p_agf_attribute25               in varchar2,
333 	p_agf_attribute26               in varchar2,
334 	p_agf_attribute27               in varchar2,
335 	p_agf_attribute28               in varchar2,
336 	p_agf_attribute29               in varchar2,
337 	p_agf_attribute30               in varchar2,
338 	p_object_version_number         in number
339 	)
340 	Return g_rec_type is
341 --
342   l_rec	  g_rec_type;
343   l_proc  varchar2(72) := g_package||'convert_args';
344 --
345 Begin
346   --
347   hr_utility.set_location('Entering:'||l_proc, 5);
348   --
349   -- Convert arguments into local l_rec structure.
350   --
351   l_rec.age_fctr_id                      := p_age_fctr_id;
352   l_rec.name                             := p_name;
353   l_rec.mx_age_num                       := p_mx_age_num;
354   l_rec.mn_age_num                       := p_mn_age_num;
355   l_rec.age_uom                          := p_age_uom;
356   l_rec.no_mn_age_flag                   := p_no_mn_age_flag;
357   l_rec.no_mx_age_flag                   := p_no_mx_age_flag;
358   l_rec.age_to_use_cd                    := p_age_to_use_cd;
359   l_rec.age_det_cd                       := p_age_det_cd;
360   l_rec.age_det_rl                       := p_age_det_rl;
361   l_rec.rndg_cd                          := p_rndg_cd;
362   l_rec.rndg_rl                          := p_rndg_rl;
363   l_rec.age_calc_rl                      := p_age_calc_rl;
364   l_rec.business_group_id                := p_business_group_id;
365   l_rec.agf_attribute_category           := p_agf_attribute_category;
366   l_rec.agf_attribute1                   := p_agf_attribute1;
367   l_rec.agf_attribute2                   := p_agf_attribute2;
368   l_rec.agf_attribute3                   := p_agf_attribute3;
369   l_rec.agf_attribute4                   := p_agf_attribute4;
370   l_rec.agf_attribute5                   := p_agf_attribute5;
371   l_rec.agf_attribute6                   := p_agf_attribute6;
372   l_rec.agf_attribute7                   := p_agf_attribute7;
373   l_rec.agf_attribute8                   := p_agf_attribute8;
374   l_rec.agf_attribute9                   := p_agf_attribute9;
375   l_rec.agf_attribute10                  := p_agf_attribute10;
376   l_rec.agf_attribute11                  := p_agf_attribute11;
377   l_rec.agf_attribute12                  := p_agf_attribute12;
378   l_rec.agf_attribute13                  := p_agf_attribute13;
379   l_rec.agf_attribute14                  := p_agf_attribute14;
380   l_rec.agf_attribute15                  := p_agf_attribute15;
381   l_rec.agf_attribute16                  := p_agf_attribute16;
382   l_rec.agf_attribute17                  := p_agf_attribute17;
383   l_rec.agf_attribute18                  := p_agf_attribute18;
384   l_rec.agf_attribute19                  := p_agf_attribute19;
385   l_rec.agf_attribute20                  := p_agf_attribute20;
386   l_rec.agf_attribute21                  := p_agf_attribute21;
387   l_rec.agf_attribute22                  := p_agf_attribute22;
388   l_rec.agf_attribute23                  := p_agf_attribute23;
389   l_rec.agf_attribute24                  := p_agf_attribute24;
390   l_rec.agf_attribute25                  := p_agf_attribute25;
391   l_rec.agf_attribute26                  := p_agf_attribute26;
392   l_rec.agf_attribute27                  := p_agf_attribute27;
393   l_rec.agf_attribute28                  := p_agf_attribute28;
394   l_rec.agf_attribute29                  := p_agf_attribute29;
395   l_rec.agf_attribute30                  := p_agf_attribute30;
396   l_rec.object_version_number            := p_object_version_number;
397   --
398   -- Return the plsql record structure.
399   --
400   hr_utility.set_location(' Leaving:'||l_proc, 10);
401   Return(l_rec);
402 --
403 End convert_args;
404 --
405 end ben_agf_shd;