DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_WYP_SHD

Source


1 Package Body ben_wyp_shd as
2 /* $Header: bewyprhi.pkb 115.12 2003/01/01 00:03:22 mmudigon ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_wyp_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_WTHN_YR_PERD_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_WTHN_YR_PERD_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   Else
47     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50     hr_utility.raise_error;
51   End If;
52   --
53   hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (
61   p_wthn_yr_perd_id                    in number,
62   p_object_version_number              in number
63   )      Return Boolean Is
64 --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70         wthn_yr_perd_id,
71     strt_day,
72     end_day,
73     strt_mo,
74     end_mo,
75         tm_uom,
76     yr_perd_id,
77     business_group_id,
78     wyp_attribute_category,
79     wyp_attribute1,
80     wyp_attribute2,
81     wyp_attribute3,
82     wyp_attribute4,
83     wyp_attribute5,
84     wyp_attribute6,
85     wyp_attribute7,
86     wyp_attribute8,
87     wyp_attribute9,
88     wyp_attribute10,
89     wyp_attribute11,
90     wyp_attribute12,
91     wyp_attribute13,
92     wyp_attribute14,
93     wyp_attribute15,
94     wyp_attribute16,
95     wyp_attribute17,
96     wyp_attribute18,
97     wyp_attribute19,
98     wyp_attribute20,
99     wyp_attribute21,
100     wyp_attribute22,
101     wyp_attribute23,
102     wyp_attribute24,
103     wyp_attribute25,
104     wyp_attribute26,
105     wyp_attribute27,
106     wyp_attribute28,
107     wyp_attribute29,
108     wyp_attribute30,
109     object_version_number
110     from    ben_wthn_yr_perd
111     where   wthn_yr_perd_id = p_wthn_yr_perd_id;
112 --
113   l_proc    varchar2(72)    := g_package||'api_updating';
114   l_fct_ret boolean;
115 --
116 Begin
117   hr_utility.set_location('Entering:'||l_proc, 5);
118   --
119   If (
120     p_wthn_yr_perd_id is null and
121     p_object_version_number is null
122      ) Then
123     --
124     -- One of the primary key arguments is null therefore we must
125     -- set the returning function value to false
126     --
127     l_fct_ret := false;
128   Else
129     If (
130     p_wthn_yr_perd_id = g_old_rec.wthn_yr_perd_id and
131     p_object_version_number = g_old_rec.object_version_number
132        ) Then
133       hr_utility.set_location(l_proc, 10);
134       --
135       -- The g_old_rec is current therefore we must
136       -- set the returning function to true
137       --
138       l_fct_ret := true;
139     Else
140       --
141       -- Select the current row into g_old_rec
142       --
143       Open C_Sel1;
144       Fetch C_Sel1 Into g_old_rec;
145       If C_Sel1%notfound Then
146         Close C_Sel1;
147         --
148         -- The primary key is invalid therefore we must error
149         --
150         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
151         hr_utility.raise_error;
152       End If;
153       Close C_Sel1;
154       If (p_object_version_number <> g_old_rec.object_version_number) Then
155         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
156         hr_utility.raise_error;
157       End If;
158       hr_utility.set_location(l_proc, 15);
159       l_fct_ret := true;
160     End If;
161   End If;
162   hr_utility.set_location(' Leaving:'||l_proc, 20);
163   Return (l_fct_ret);
164 --
165 End api_updating;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171   (
172   p_wthn_yr_perd_id                    in number,
173   p_object_version_number              in number
174   ) is
175 --
176 -- Cursor selects the 'current' row from the HR Schema
177 --
178   Cursor C_Sel1 is
179     select  wthn_yr_perd_id,
180     strt_day,
181     end_day,
182     strt_mo,
183     end_mo,
184         tm_uom,
185     yr_perd_id,
186     business_group_id,
187     wyp_attribute_category,
188     wyp_attribute1,
189     wyp_attribute2,
190     wyp_attribute3,
191     wyp_attribute4,
192     wyp_attribute5,
193     wyp_attribute6,
194     wyp_attribute7,
195     wyp_attribute8,
196     wyp_attribute9,
197     wyp_attribute10,
198     wyp_attribute11,
199     wyp_attribute12,
200     wyp_attribute13,
201     wyp_attribute14,
202     wyp_attribute15,
203     wyp_attribute16,
204     wyp_attribute17,
205     wyp_attribute18,
206     wyp_attribute19,
207     wyp_attribute20,
208     wyp_attribute21,
209     wyp_attribute22,
210     wyp_attribute23,
211     wyp_attribute24,
212     wyp_attribute25,
213     wyp_attribute26,
214     wyp_attribute27,
215     wyp_attribute28,
216     wyp_attribute29,
217     wyp_attribute30,
218     object_version_number
219     from    ben_wthn_yr_perd
220     where   wthn_yr_perd_id = p_wthn_yr_perd_id
221     for update nowait;
222 --
223   l_proc    varchar2(72) := g_package||'lck';
224 --
225 Begin
226   hr_utility.set_location('Entering:'||l_proc, 5);
227   --
228   -- Add any mandatory argument checking here:
229   -- Example:
230   -- hr_api.mandatory_arg_error
231   --   (p_api_name       => l_proc,
232   --    p_argument       => 'object_version_number',
233   --    p_argument_value => p_object_version_number);
234   --
235   Open  C_Sel1;
236   Fetch C_Sel1 Into g_old_rec;
237   If C_Sel1%notfound then
238     Close C_Sel1;
239     --
240     -- The primary key is invalid therefore we must error
241     --
242     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
243     hr_utility.raise_error;
244   End If;
245   Close C_Sel1;
246   If (p_object_version_number <> g_old_rec.object_version_number) Then
247         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
248         hr_utility.raise_error;
249       End If;
250 --
251   hr_utility.set_location(' Leaving:'||l_proc, 10);
252 --
253 -- We need to trap the ORA LOCK exception
254 --
255 Exception
256   When HR_Api.Object_Locked then
257     --
258     -- The object is locked therefore we need to supply a meaningful
259     -- error message.
260     --
261     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
262     hr_utility.set_message_token('TABLE_NAME', 'ben_wthn_yr_perd');
263     hr_utility.raise_error;
264 End lck;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |-----------------------------< convert_args >-----------------------------|
268 -- ----------------------------------------------------------------------------
269 Function convert_args
270     (
271     p_wthn_yr_perd_id               in number,
272     p_strt_day                      in number,
273     p_end_day                       in number,
274     p_strt_mo                       in number,
275     p_end_mo                        in number,
276         p_tm_uom                        in varchar2,
277     p_yr_perd_id                    in number,
278     p_business_group_id             in number,
279     p_wyp_attribute_category        in varchar2,
280     p_wyp_attribute1                in varchar2,
281     p_wyp_attribute2                in varchar2,
282     p_wyp_attribute3                in varchar2,
283     p_wyp_attribute4                in varchar2,
284     p_wyp_attribute5                in varchar2,
285     p_wyp_attribute6                in varchar2,
286     p_wyp_attribute7                in varchar2,
287     p_wyp_attribute8                in varchar2,
288     p_wyp_attribute9                in varchar2,
289     p_wyp_attribute10               in varchar2,
290     p_wyp_attribute11               in varchar2,
291     p_wyp_attribute12               in varchar2,
292     p_wyp_attribute13               in varchar2,
293     p_wyp_attribute14               in varchar2,
294     p_wyp_attribute15               in varchar2,
295     p_wyp_attribute16               in varchar2,
296     p_wyp_attribute17               in varchar2,
297     p_wyp_attribute18               in varchar2,
298     p_wyp_attribute19               in varchar2,
299     p_wyp_attribute20               in varchar2,
300     p_wyp_attribute21               in varchar2,
301     p_wyp_attribute22               in varchar2,
302     p_wyp_attribute23               in varchar2,
303     p_wyp_attribute24               in varchar2,
304     p_wyp_attribute25               in varchar2,
305     p_wyp_attribute26               in varchar2,
306     p_wyp_attribute27               in varchar2,
307     p_wyp_attribute28               in varchar2,
308     p_wyp_attribute29               in varchar2,
309     p_wyp_attribute30               in varchar2,
310     p_object_version_number         in number
311     )
312     Return g_rec_type is
313 --
314   l_rec   g_rec_type;
315   l_proc  varchar2(72) := g_package||'convert_args';
316 --
317 Begin
318   --
319   hr_utility.set_location('Entering:'||l_proc, 5);
320   --
321   -- Convert arguments into local l_rec structure.
322   --
323   l_rec.wthn_yr_perd_id                  := p_wthn_yr_perd_id;
324   l_rec.strt_day                         := p_strt_day;
325   l_rec.end_day                          := p_end_day;
326   l_rec.strt_mo                          := p_strt_mo;
327   l_rec.end_mo                           := p_end_mo;
328   l_rec.tm_uom                           := p_tm_uom;
329   l_rec.yr_perd_id                       := p_yr_perd_id;
330   l_rec.business_group_id                := p_business_group_id;
331   l_rec.wyp_attribute_category           := p_wyp_attribute_category;
332   l_rec.wyp_attribute1                   := p_wyp_attribute1;
333   l_rec.wyp_attribute2                   := p_wyp_attribute2;
334   l_rec.wyp_attribute3                   := p_wyp_attribute3;
335   l_rec.wyp_attribute4                   := p_wyp_attribute4;
336   l_rec.wyp_attribute5                   := p_wyp_attribute5;
337   l_rec.wyp_attribute6                   := p_wyp_attribute6;
338   l_rec.wyp_attribute7                   := p_wyp_attribute7;
339   l_rec.wyp_attribute8                   := p_wyp_attribute8;
340   l_rec.wyp_attribute9                   := p_wyp_attribute9;
341   l_rec.wyp_attribute10                  := p_wyp_attribute10;
342   l_rec.wyp_attribute11                  := p_wyp_attribute11;
343   l_rec.wyp_attribute12                  := p_wyp_attribute12;
344   l_rec.wyp_attribute13                  := p_wyp_attribute13;
345   l_rec.wyp_attribute14                  := p_wyp_attribute14;
346   l_rec.wyp_attribute15                  := p_wyp_attribute15;
347   l_rec.wyp_attribute16                  := p_wyp_attribute16;
348   l_rec.wyp_attribute17                  := p_wyp_attribute17;
349   l_rec.wyp_attribute18                  := p_wyp_attribute18;
350   l_rec.wyp_attribute19                  := p_wyp_attribute19;
351   l_rec.wyp_attribute20                  := p_wyp_attribute20;
352   l_rec.wyp_attribute21                  := p_wyp_attribute21;
353   l_rec.wyp_attribute22                  := p_wyp_attribute22;
354   l_rec.wyp_attribute23                  := p_wyp_attribute23;
355   l_rec.wyp_attribute24                  := p_wyp_attribute24;
356   l_rec.wyp_attribute25                  := p_wyp_attribute25;
357   l_rec.wyp_attribute26                  := p_wyp_attribute26;
358   l_rec.wyp_attribute27                  := p_wyp_attribute27;
359   l_rec.wyp_attribute28                  := p_wyp_attribute28;
360   l_rec.wyp_attribute29                  := p_wyp_attribute29;
361   l_rec.wyp_attribute30                  := p_wyp_attribute30;
362   l_rec.object_version_number            := p_object_version_number;
363   --
364   -- Return the plsql record structure.
365   --
366   hr_utility.set_location(' Leaving:'||l_proc, 10);
367   Return(l_rec);
368 --
369 End convert_args;
370 --
371 end ben_wyp_shd;