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