DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PRV_SHD

Source


1 Package Body per_prv_shd as
2 /* $Header: peprvrhi.pkb 120.1 2006/04/14 17:27:46 kandra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_prv_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 = 'PER_PERFORMANCE_REVIEWS_FK2') Then
37     hr_utility.set_location(l_proc, 10);
38     hr_utility.set_message(800,'HR_52396_PRV_INVALID_REVIEW');
39     hr_utility.raise_error;
40   ElsIf (p_constraint_name = 'PER_PERFORMANCE_REVIEWS_PK') Then
41     hr_utility.set_location(l_proc, 15);
42     hr_utility.set_message(800,'HR_52395_PRV_INVALID_PK');
43     hr_utility.raise_error;
44   ElsIf (p_constraint_name = 'PER_PERFORMANCE_REVIEWS_DT1') Then
45     hr_utility.set_location(l_proc, 15);
46     hr_utility.set_message(800,'HR_52397_PRV_INVALID_PERSON');
47     hr_utility.raise_error;
48   Else
49     hr_utility.set_location(l_proc, 20);
50     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
51     hr_utility.set_message_token('PROCEDURE', l_proc);
52     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
53     hr_utility.raise_error;
54 
55   End If;
56   --
57   hr_utility.set_location(' Leaving:'||l_proc, 30);
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64   (
65   p_performance_review_id              in number,
66   p_object_version_number              in number
67   )      Return Boolean Is
68 --
69   --
70   -- Cursor selects the 'current' row from the HR Schema
71   --
72   Cursor C_Sel1 is
73     select
74 		performance_review_id,
75 	person_id,
76 	event_id,
77 	review_date,
78 	performance_rating,
79 	next_perf_review_date,
80 	attribute_category,
81 	attribute1,
82 	attribute2,
83 	attribute3,
84 	attribute4,
85 	attribute5,
86 	attribute6,
87 	attribute7,
88 	attribute8,
89 	attribute9,
90 	attribute10,
91 	attribute11,
92 	attribute12,
93 	attribute13,
94 	attribute14,
95 	attribute15,
96 	attribute16,
97 	attribute17,
98 	attribute18,
99 	attribute19,
100 	attribute20,
101 	attribute21,
102 	attribute22,
103 	attribute23,
104 	attribute24,
105 	attribute25,
106 	attribute26,
107 	attribute27,
108 	attribute28,
109 	attribute29,
110 	attribute30,
111 	object_version_number
112     from	per_performance_reviews
113     where	performance_review_id = p_performance_review_id;
114 --
115   l_proc	varchar2(72)	:= g_package||'api_updating';
116   l_fct_ret	boolean;
117 --
118 Begin
119   hr_utility.set_location('Entering:'||l_proc, 5);
120   --
121   If (
122 	p_performance_review_id is null and
123 	p_object_version_number is null
124      ) Then
125     --
126     -- One of the primary key arguments is null therefore we must
127     -- set the returning function value to false
128     --
129     l_fct_ret := false;
130   Else
131     If (
132 	p_performance_review_id = g_old_rec.performance_review_id and
133 	p_object_version_number = g_old_rec.object_version_number
134        ) Then
135       hr_utility.set_location(l_proc, 10);
136       --
137       -- The g_old_rec is current therefore we must
138       -- set the returning function to true
139       --
140       l_fct_ret := true;
141     Else
142       --
143       -- Select the current row into g_old_rec
144       --
145       Open C_Sel1;
146       Fetch C_Sel1 Into g_old_rec;
147       If C_Sel1%notfound Then
148         Close C_Sel1;
149         --
150         -- The primary key is invalid therefore we must error
151         --
152         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
153         hr_utility.raise_error;
154       End If;
155       Close C_Sel1;
156       If (p_object_version_number <> g_old_rec.object_version_number) Then
157         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
158         hr_utility.raise_error;
159       End If;
160       hr_utility.set_location(l_proc, 15);
161       l_fct_ret := true;
162     End If;
163   End If;
164   hr_utility.set_location(' Leaving:'||l_proc, 20);
165   Return (l_fct_ret);
166 --
167 End api_updating;
168 --
169 -- ----------------------------------------------------------------------------
170 -- |---------------------------------< lck >----------------------------------|
171 -- ----------------------------------------------------------------------------
172 Procedure lck
173   (
174   p_performance_review_id              in number,
175   p_object_version_number              in number
176   ) is
177 --
178 -- Cursor selects the 'current' row from the HR Schema
179 --
180   Cursor C_Sel1 is
181     select 	performance_review_id,
182 	person_id,
183 	event_id,
184 	review_date,
185 	performance_rating,
186 	next_perf_review_date,
187 	attribute_category,
188 	attribute1,
189 	attribute2,
190 	attribute3,
191 	attribute4,
192 	attribute5,
193 	attribute6,
194 	attribute7,
195 	attribute8,
196 	attribute9,
197 	attribute10,
198 	attribute11,
199 	attribute12,
200 	attribute13,
201 	attribute14,
202 	attribute15,
203 	attribute16,
204 	attribute17,
205 	attribute18,
206 	attribute19,
207 	attribute20,
208 	attribute21,
209 	attribute22,
210 	attribute23,
211 	attribute24,
212 	attribute25,
213 	attribute26,
214 	attribute27,
215 	attribute28,
216 	attribute29,
217 	attribute30,
218 	object_version_number
219     from	per_performance_reviews
220     where	performance_review_id = p_performance_review_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', 'per_performance_reviews');
263     hr_utility.raise_error;
264 End lck;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |-----------------------------< convert_args >-----------------------------|
268 -- ----------------------------------------------------------------------------
269 Function convert_args
270 	(
271 	p_performance_review_id         in number,
272         p_person_id                     in number,
273 	p_event_id                      in number,
274 	p_review_date                   in date,
275 	p_performance_rating            in varchar2,
276 	p_next_perf_review_date         in date,
277 	p_attribute_category            in varchar2,
278 	p_attribute1                    in varchar2,
279 	p_attribute2                    in varchar2,
280 	p_attribute3                    in varchar2,
281 	p_attribute4                    in varchar2,
282 	p_attribute5                    in varchar2,
283 	p_attribute6                    in varchar2,
284 	p_attribute7                    in varchar2,
285 	p_attribute8                    in varchar2,
286 	p_attribute9                    in varchar2,
287 	p_attribute10                   in varchar2,
288 	p_attribute11                   in varchar2,
289 	p_attribute12                   in varchar2,
290 	p_attribute13                   in varchar2,
291 	p_attribute14                   in varchar2,
292 	p_attribute15                   in varchar2,
293 	p_attribute16                   in varchar2,
294 	p_attribute17                   in varchar2,
295 	p_attribute18                   in varchar2,
296 	p_attribute19                   in varchar2,
297 	p_attribute20                   in varchar2,
298 	p_attribute21                   in varchar2,
299 	p_attribute22                   in varchar2,
300 	p_attribute23                   in varchar2,
301 	p_attribute24                   in varchar2,
302 	p_attribute25                   in varchar2,
303 	p_attribute26                   in varchar2,
304 	p_attribute27                   in varchar2,
305 	p_attribute28                   in varchar2,
306 	p_attribute29                   in varchar2,
307 	p_attribute30                   in varchar2,
308 	p_object_version_number         in number
309 	)
310 	Return g_rec_type is
311 --
312   l_rec	  g_rec_type;
313   l_proc  varchar2(72) := g_package||'convert_args';
314 --
315 Begin
316   --
317   hr_utility.set_location('Entering:'||l_proc, 5);
318   --
319   -- Convert arguments into local l_rec structure.
320   --
321   l_rec.performance_review_id            := p_performance_review_id;
322   l_rec.person_id                        := p_person_id;
323   l_rec.event_id                         := p_event_id;
324   l_rec.review_date                      := p_review_date;
325   l_rec.performance_rating               := p_performance_rating;
326   l_rec.next_perf_review_date            := p_next_perf_review_date;
327   l_rec.attribute_category               := p_attribute_category;
328   l_rec.attribute1                       := p_attribute1;
329   l_rec.attribute2                       := p_attribute2;
330   l_rec.attribute3                       := p_attribute3;
331   l_rec.attribute4                       := p_attribute4;
332   l_rec.attribute5                       := p_attribute5;
333   l_rec.attribute6                       := p_attribute6;
334   l_rec.attribute7                       := p_attribute7;
335   l_rec.attribute8                       := p_attribute8;
336   l_rec.attribute9                       := p_attribute9;
337   l_rec.attribute10                      := p_attribute10;
338   l_rec.attribute11                      := p_attribute11;
339   l_rec.attribute12                      := p_attribute12;
340   l_rec.attribute13                      := p_attribute13;
341   l_rec.attribute14                      := p_attribute14;
342   l_rec.attribute15                      := p_attribute15;
343   l_rec.attribute16                      := p_attribute16;
344   l_rec.attribute17                      := p_attribute17;
345   l_rec.attribute18                      := p_attribute18;
346   l_rec.attribute19                      := p_attribute19;
347   l_rec.attribute20                      := p_attribute20;
348   l_rec.attribute21                      := p_attribute21;
349   l_rec.attribute22                      := p_attribute22;
350   l_rec.attribute23                      := p_attribute23;
351   l_rec.attribute24                      := p_attribute24;
352   l_rec.attribute25                      := p_attribute25;
353   l_rec.attribute26                      := p_attribute26;
354   l_rec.attribute27                      := p_attribute27;
355   l_rec.attribute28                      := p_attribute28;
356   l_rec.attribute29                      := p_attribute29;
357   l_rec.attribute30                      := p_attribute30;
358   l_rec.object_version_number            := p_object_version_number;
359   --
360   -- Return the plsql record structure.
361   --
362   hr_utility.set_location(' Leaving:'||l_proc, 10);
363   Return(l_rec);
364 --
365 End convert_args;
366 --
367 end per_prv_shd;