DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RTL_SHD

Source


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