DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RSC_SHD

Source


1 Package Body per_rsc_shd as
2 /* $Header: perscrhi.pkb 120.0 2005/05/31 19:45:58 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_rsc_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20   --
21   If (p_constraint_name = 'PER_RATING_SCALES_FK1') Then
22     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
23     hr_utility.set_message_token('PROCEDURE', l_proc);
24     hr_utility.set_message_token('STEP','5');
25     hr_utility.raise_error;
26   ElsIf (p_constraint_name = 'PER_RATING_SCALES_PK') Then
27     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
28     hr_utility.set_message_token('PROCEDURE', l_proc);
29     hr_utility.set_message_token('STEP','10');
30     hr_utility.raise_error;
31   --
32   -- pmfletch. Now a coded check in TL row handler
33   --
34   -- ElsIf (p_constraint_name = 'PER_RATING_SCALES_UK1') Then
35   --   hr_utility.set_message(801, 'HR_51449_RSC_NAME_NOT_UNIQUE');
36   --   hr_utility.raise_error;
37   Else
38     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
39     hr_utility.set_message_token('PROCEDURE', l_proc);
40     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
41     hr_utility.raise_error;
42   End If;
43   --
44   hr_utility.set_location(' Leaving:'||l_proc, 10);
45 End constraint_error;
46 --
47 -- ----------------------------------------------------------------------------
48 -- |-----------------------------< api_updating >-----------------------------|
49 -- ----------------------------------------------------------------------------
50 Function api_updating
51   (
52   p_rating_scale_id                    in number,
53   p_object_version_number              in number
54   )      Return Boolean Is
55   --
56   --
57   -- Cursor selects the 'current' row from the HR Schema
58   --
59   Cursor C_Sel1 is
60     select
61       rating_scale_id,
62       business_group_id,
63       name,
64       type,
65       object_version_number,
66       description,
67       max_scale_step,
68       min_scale_step,
69       default_flag,
70       attribute_category,
71       attribute1,
72       attribute2,
73       attribute3,
74       attribute4,
75       attribute5,
76       attribute6,
77       attribute7,
78       attribute8,
79       attribute9,
80       attribute10,
81       attribute11,
82       attribute12,
83       attribute13,
84       attribute14,
85       attribute15,
86       attribute16,
87       attribute17,
88       attribute18,
89       attribute19,
90       attribute20
91     from	per_rating_scales
92     where	rating_scale_id = p_rating_scale_id;
93 --
94   l_proc	varchar2(72)	:= g_package||'api_updating';
95   l_fct_ret	boolean;
96 --
97 Begin
98   hr_utility.set_location('Entering:'||l_proc, 5);
99   --
100   If (
101 	p_rating_scale_id is null and
102 	p_object_version_number is null
103      ) Then
104     --
105     -- One of the primary key arguments is null therefore we must
106     -- set the returning function value to false
107     --
108     l_fct_ret := false;
109   Else
110     If (
111 	p_rating_scale_id = g_old_rec.rating_scale_id and
112 	p_object_version_number = g_old_rec.object_version_number
113        ) Then
114       hr_utility.set_location(l_proc, 10);
115       --
116       -- The g_old_rec is current therefore we must
117       -- set the returning function to true
118       --
119       l_fct_ret := true;
120     Else
121       --
122       -- Select the current row into g_old_rec
123       --
124       Open C_Sel1;
125       Fetch C_Sel1 Into g_old_rec;
126       If C_Sel1%notfound Then
127         Close C_Sel1;
128         --
129         -- The primary key is invalid therefore we must error
130         --
131         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
132         hr_utility.raise_error;
133       End If;
134       Close C_Sel1;
135       If (p_object_version_number <> g_old_rec.object_version_number) Then
136         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
137         hr_utility.raise_error;
138       End If;
139       hr_utility.set_location(l_proc, 15);
140       l_fct_ret := true;
141     End If;
142   End If;
143   hr_utility.set_location(' Leaving:'||l_proc, 20);
144   Return (l_fct_ret);
145 --
146 End api_updating;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |---------------------------------< lck >----------------------------------|
150 -- ----------------------------------------------------------------------------
151 Procedure lck
152   (
153   p_rating_scale_id                    in number,
154   p_object_version_number              in number
155   ) is
156 --
157 -- Cursor selects the 'current' row from the HR Schema
158 --
159   Cursor C_Sel1 is
160     select 	rating_scale_id,
161 	business_group_id,
162 	name,
163 	type,
164 	object_version_number,
165 	description,
166 	max_scale_step,
167 	min_scale_step,
168         default_flag,
169         attribute_category,
170         attribute1,
171         attribute2,
172         attribute3,
173         attribute4,
174         attribute5,
175         attribute6,
176         attribute7,
177         attribute8,
178         attribute9,
179         attribute10,
180         attribute11,
181         attribute12,
182         attribute13,
183         attribute14,
184         attribute15,
185         attribute16,
186         attribute17,
187         attribute18,
188         attribute19,
189         attribute20
190     from	per_rating_scales
191     where	rating_scale_id = p_rating_scale_id
192     for	update nowait;
193 --
194   l_proc	varchar2(72) := g_package||'lck';
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198   --
199   -- Add any mandatory argument checking here:
200    hr_api.mandatory_arg_error
201      (p_api_name       => l_proc,
202       p_argument       => 'object_version_number',
203       p_argument_value => p_object_version_number);
204   --
205   Open  C_Sel1;
206   Fetch C_Sel1 Into g_old_rec;
207   If C_Sel1%notfound then
208     Close C_Sel1;
209     --
210     -- The primary key is invalid therefore we must error
211     --
212     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
213     hr_utility.raise_error;
214   End If;
215   Close C_Sel1;
216   If (p_object_version_number <> g_old_rec.object_version_number) Then
217         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
218         hr_utility.raise_error;
219       End If;
220 --
221   hr_utility.set_location(' Leaving:'||l_proc, 10);
222 --
223 -- We need to trap the ORA LOCK exception
224 --
225 Exception
226   When HR_Api.Object_Locked then
227     --
228     -- The object is locked therefore we need to supply a meaningful
229     -- error message.
230     --
231     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
232     hr_utility.set_message_token('TABLE_NAME', 'per_rating_scales');
233     hr_utility.raise_error;
234 End lck;
235 --
236 -- ----------------------------------------------------------------------------
237 -- |-----------------------------< convert_args >-----------------------------|
238 -- ----------------------------------------------------------------------------
239 Function convert_args
240 	(
241 	p_rating_scale_id               in number,
242 	p_business_group_id             in number,
243 	p_name                          in varchar2,
244 	p_type                          in varchar2,
245 	p_object_version_number         in number,
246 	p_description                   in varchar2,
247 	p_max_scale_step                in number,
248 	p_min_scale_step                in number,
249         p_default_flag                  in varchar2,
250         p_attribute_category            in varchar2,
251         p_attribute1                    in varchar2,
252         p_attribute2                    in varchar2,
253         p_attribute3                    in varchar2,
254         p_attribute4                    in varchar2,
255         p_attribute5                    in varchar2,
256         p_attribute6                    in varchar2,
257         p_attribute7                    in varchar2,
258         p_attribute8                    in varchar2,
259         p_attribute9                    in varchar2,
260         p_attribute10                   in varchar2,
261         p_attribute11                   in varchar2,
262         p_attribute12                   in varchar2,
263         p_attribute13                   in varchar2,
264         p_attribute14                   in varchar2,
265         p_attribute15                   in varchar2,
266         p_attribute16                   in varchar2,
267         p_attribute17                   in varchar2,
268         p_attribute18                   in varchar2,
269         p_attribute19                   in varchar2,
270         p_attribute20                   in varchar2
271 	)
272 	Return g_rec_type is
273 --
274   l_rec	  g_rec_type;
275   l_proc  varchar2(72) := g_package||'convert_args';
276 --
277 Begin
278   --
279   hr_utility.set_location('Entering:'||l_proc, 5);
280   --
281   -- Convert arguments into local l_rec structure.
282   --
283   l_rec.rating_scale_id                  := p_rating_scale_id;
284   l_rec.business_group_id                := p_business_group_id;
285   l_rec.name                             := p_name;
286   l_rec.type                             := p_type;
287   l_rec.object_version_number            := p_object_version_number;
288   l_rec.description                      := p_description;
289   l_rec.max_scale_step                   := p_max_scale_step;
290   l_rec.min_scale_step                   := p_min_scale_step;
291   l_rec.default_flag                     := p_default_flag;
292   l_rec.attribute_category               := p_attribute_category;
293   l_rec.attribute1                       := p_attribute1;
294   l_rec.attribute2                       := p_attribute2;
295   l_rec.attribute3                       := p_attribute3;
296   l_rec.attribute4                       := p_attribute4;
297   l_rec.attribute5                       := p_attribute5;
298   l_rec.attribute6                       := p_attribute6;
299   l_rec.attribute7                       := p_attribute7;
300   l_rec.attribute8                       := p_attribute8;
301   l_rec.attribute9                       := p_attribute9;
302   l_rec.attribute10                      := p_attribute10;
303   l_rec.attribute11                      := p_attribute11;
304   l_rec.attribute12                      := p_attribute12;
305   l_rec.attribute13                      := p_attribute13;
306   l_rec.attribute14                      := p_attribute14;
307   l_rec.attribute15                      := p_attribute15;
308   l_rec.attribute16                      := p_attribute16;
309   l_rec.attribute17                      := p_attribute17;
310   l_rec.attribute18                      := p_attribute18;
311   l_rec.attribute19                      := p_attribute19;
312   l_rec.attribute20                      := p_attribute20;
313   --
314   -- Return the plsql record structure.
315   --
316   hr_utility.set_location(' Leaving:'||l_proc, 10);
317   Return(l_rec);
318 --
319 End convert_args;
320 --
321 end per_rsc_shd;