[Home] [Help]
PACKAGE BODY: APPS.PER_SUC_SHD
Source
1 PACKAGE BODY per_suc_shd AS
2 /* $Header: pesucrhi.pkb 120.1.12010000.9 2010/02/22 20:28:53 schowdhu ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package VARCHAR2 (33) := ' per_suc_shd.'; -- Global package name
9
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 FUNCTION return_api_dml_status
15 RETURN BOOLEAN
16 IS
17 --
18 l_proc VARCHAR2 (72) := g_package || 'return_api_dml_status';
19 --
20 BEGIN
21 hr_utility.set_location ('Entering:' || l_proc, 5);
22 --
23 RETURN (NVL (g_api_dml, FALSE));
24 --
25 hr_utility.set_location (' Leaving:' || l_proc, 10);
26 END return_api_dml_status;
27
28 --
29 -- ----------------------------------------------------------------------------
30 -- |---------------------------< constraint_error >---------------------------|
31 -- ----------------------------------------------------------------------------
32 PROCEDURE constraint_error (p_constraint_name IN all_constraints.constraint_name%TYPE)
33 IS
34 --
35 l_proc VARCHAR2 (72) := g_package || 'constraint_error';
36 --
37 BEGIN
38 hr_utility.set_location ('Entering:' || l_proc, 5);
39
40 --
41 IF (p_constraint_name = 'PER_SUCCESSION_PLANNING_FK1')
42 THEN
43 hr_utility.set_message (801, 'HR_52000_SUC_CHK_POS_EXISTS');
44 hr_utility.raise_error;
45 ELSIF (p_constraint_name = 'PER_SUCCESSION_PLANNING_FK2')
46 THEN
47 hr_utility.set_message (801, 'HR_6153_ALL_PROCEDURE_FAIL');
48 hr_utility.set_message_token ('PROCEDURE', l_proc);
49 hr_utility.set_message_token ('STEP', '10');
50 hr_utility.raise_error;
51 ELSIF (p_constraint_name = 'PER_SUCCESSION_PLANNING_PK')
52 THEN
53 hr_utility.set_message (801, 'HR_52006_SUC_CHK_SUCC_PLAN_ID');
54 hr_utility.raise_error;
55 ELSIF (p_constraint_name = 'PER_SUCCESSION_PLANNING_UK')
56 THEN
57 hr_utility.set_message (800, 'HR_33468_SUC_SAME_SUCCESSOR');
58 hr_utility.raise_error;
59 ELSIF (p_constraint_name = 'PER_SUC_AVAIL_FOR_PROMOTION')
60 THEN
61 hr_utility.set_message (801, 'HR_52004_SUC_CHK_AVAILABLE');
62 hr_utility.raise_error;
63 ELSE
64 hr_utility.set_message (801, 'HR_7877_API_INVALID_CONSTRAINT');
65 hr_utility.set_message_token ('PROCEDURE', l_proc);
66 hr_utility.set_message_token ('CONSTRAINT_NAME', p_constraint_name);
67 hr_utility.raise_error;
68 END IF;
69
70 --
71 hr_utility.set_location (' Leaving:' || l_proc, 10);
72 END constraint_error;
73
74 --
75 -- ----------------------------------------------------------------------------
76 -- |-----------------------------< api_updating >-----------------------------|
77 -- ----------------------------------------------------------------------------
78 FUNCTION api_updating (p_succession_plan_id IN NUMBER, p_object_version_number IN NUMBER)
79 RETURN BOOLEAN
80 IS
81 --
82 --
83 -- Cursor selects the 'current' row from the HR Schema
84 --
85 CURSOR c_sel1
86 IS
87 SELECT succession_plan_id,
88 person_id,
89 position_id,
90 business_group_id,
91 start_date,
92 time_scale,
93 end_date,
94 available_for_promotion,
95 manager_comments,
96 object_version_number,
97 attribute_category,
98 attribute1,
99 attribute2,
100 attribute3,
101 attribute4,
102 attribute5,
103 attribute6,
104 attribute7,
105 attribute8,
106 attribute9,
107 attribute10,
108 attribute11,
109 attribute12,
110 attribute13,
111 attribute14,
112 attribute15,
113 attribute16,
114 attribute17,
115 attribute18,
116 attribute19,
117 attribute20,
118 job_id,
119 successee_person_id,
120 person_rank,
121 PERFORMANCE,
122 plan_status,
123 readiness_percentage
124 FROM per_succession_planning
125 WHERE succession_plan_id = p_succession_plan_id;
126
127 --
128 l_proc VARCHAR2 (72) := g_package || 'api_updating';
129 l_fct_ret BOOLEAN;
130 --
131 BEGIN
132 hr_utility.set_location ('Entering:' || l_proc, 5);
133
134 --
135 IF (p_succession_plan_id IS NULL AND p_object_version_number IS NULL)
136 THEN
137 --
138 -- One of the primary key arguments is null therefore we must
139 -- set the returning function value to false
140 --
141 l_fct_ret := FALSE;
142 ELSE
143 IF ( p_succession_plan_id = g_old_rec.succession_plan_id
144 AND p_object_version_number = g_old_rec.object_version_number
145 )
146 THEN
147 hr_utility.set_location (l_proc, 10);
148 --
149 -- The g_old_rec is current therefore we must
150 -- set the returning function to true
151 --
152 l_fct_ret := TRUE;
153 ELSE
154 --
155 -- Select the current row into g_old_rec
156 --
157 OPEN c_sel1;
158
159 FETCH c_sel1
160 INTO g_old_rec;
161
162 IF c_sel1%NOTFOUND
163 THEN
164 CLOSE c_sel1;
165
166 --
167 -- The primary key is invalid therefore we must error
168 --
169 hr_utility.set_message (801, 'HR_7220_INVALID_PRIMARY_KEY');
170 hr_utility.raise_error;
171 END IF;
172
173 CLOSE c_sel1;
174
175 IF (p_object_version_number <> g_old_rec.object_version_number)
176 THEN
177 hr_utility.set_message (801, 'HR_7155_OBJECT_INVALID');
178 hr_utility.raise_error;
179 END IF;
180
181 hr_utility.set_location (l_proc, 15);
182 l_fct_ret := TRUE;
183 END IF;
184 END IF;
185
186 hr_utility.set_location (' Leaving:' || l_proc, 20);
187 RETURN (l_fct_ret);
188 --
189 END api_updating;
190
191 --
192 -- ----------------------------------------------------------------------------
193 -- |---------------------------------< lck >----------------------------------|
194 -- ----------------------------------------------------------------------------
195 PROCEDURE lck (p_succession_plan_id IN NUMBER, p_object_version_number IN NUMBER)
196 IS
197 --
198 -- Cursor selects the 'current' row from the HR Schema
199 --
200 CURSOR c_sel1
201 IS
202 SELECT succession_plan_id,
203 person_id,
204 position_id,
205 business_group_id,
206 start_date,
207 time_scale,
208 end_date,
209 available_for_promotion,
210 manager_comments,
211 object_version_number,
212 attribute_category,
213 attribute1,
214 attribute2,
215 attribute3,
216 attribute4,
217 attribute5,
218 attribute6,
219 attribute7,
220 attribute8,
221 attribute9,
222 attribute10,
223 attribute11,
224 attribute12,
225 attribute13,
226 attribute14,
227 attribute15,
228 attribute16,
229 attribute17,
230 attribute18,
231 attribute19,
232 attribute20,
233 job_id,
234 successee_person_id,
235 person_rank,
239 FROM per_succession_planning
236 PERFORMANCE,
237 plan_status,
238 readiness_percentage
240 WHERE succession_plan_id = p_succession_plan_id
241 FOR UPDATE NOWAIT;
242
243 --
244 l_proc VARCHAR2 (72) := g_package || 'lck';
245 --
246 BEGIN
247 hr_utility.set_location ('Entering:' || l_proc, 5);
248
249 --
250 -- Add any mandatory argument checking here:
251 -- Example:
252 -- hr_api.mandatory_arg_error
253 -- (p_api_name => l_proc,
254 -- p_argument => 'object_version_number',
255 -- p_argument_value => p_object_version_number);
256 --
257 OPEN c_sel1;
258
259 FETCH c_sel1
260 INTO g_old_rec;
261
262 IF c_sel1%NOTFOUND
263 THEN
264 CLOSE c_sel1;
265
266 --
267 -- The primary key is invalid therefore we must error
268 --
269 hr_utility.set_message (801, 'HR_7220_INVALID_PRIMARY_KEY');
270 hr_utility.raise_error;
271 END IF;
272
273 CLOSE c_sel1;
274
275 IF (p_object_version_number <> g_old_rec.object_version_number)
276 THEN
277 hr_utility.set_message (801, 'HR_7155_OBJECT_INVALID');
278 hr_utility.raise_error;
279 END IF;
280
281 --
282 hr_utility.set_location (' Leaving:' || l_proc, 10);
283 --
284 -- We need to trap the ORA LOCK exception
285 --
286 EXCEPTION
287 WHEN hr_api.object_locked
288 THEN
289 --
290 -- The object is locked therefore we need to supply a meaningful
291 -- error message.
292 --
293 hr_utility.set_message (801, 'HR_7165_OBJECT_LOCKED');
294 hr_utility.set_message_token ('TABLE_NAME', 'per_succession_planning');
295 hr_utility.raise_error;
296 END lck;
297
298 --
299 -- ----------------------------------------------------------------------------
300 -- |-----------------------------< convert_args >-----------------------------|
301 -- ----------------------------------------------------------------------------
302 FUNCTION convert_args (
303 p_succession_plan_id IN NUMBER,
304 p_person_id IN NUMBER,
305 p_position_id IN NUMBER,
306 p_business_group_id IN NUMBER,
307 p_start_date IN DATE,
308 p_time_scale IN VARCHAR2,
309 p_end_date IN DATE,
310 p_available_for_promotion IN VARCHAR2,
311 p_manager_comments IN VARCHAR2,
312 p_object_version_number IN NUMBER,
313 p_attribute_category IN VARCHAR2,
314 p_attribute1 IN VARCHAR2,
315 p_attribute2 IN VARCHAR2,
316 p_attribute3 IN VARCHAR2,
317 p_attribute4 IN VARCHAR2,
318 p_attribute5 IN VARCHAR2,
319 p_attribute6 IN VARCHAR2,
320 p_attribute7 IN VARCHAR2,
321 p_attribute8 IN VARCHAR2,
322 p_attribute9 IN VARCHAR2,
323 p_attribute10 IN VARCHAR2,
324 p_attribute11 IN VARCHAR2,
325 p_attribute12 IN VARCHAR2,
326 p_attribute13 IN VARCHAR2,
327 p_attribute14 IN VARCHAR2,
328 p_attribute15 IN VARCHAR2,
329 p_attribute16 IN VARCHAR2,
330 p_attribute17 IN VARCHAR2,
331 p_attribute18 IN VARCHAR2,
332 p_attribute19 IN VARCHAR2,
333 p_attribute20 IN VARCHAR2,
334 p_job_id IN NUMBER,
335 p_successee_person_id IN NUMBER,
336 p_person_rank IN NUMBER,
337 p_performance IN VARCHAR2,
338 p_plan_status IN VARCHAR2,
339 p_readiness_percentage IN NUMBER
340 )
341 RETURN g_rec_type
342 IS
343 --
344 l_rec g_rec_type;
345 l_proc VARCHAR2 (72) := g_package || 'convert_args';
346 --
347 BEGIN
348 --
349 hr_utility.set_location ('Entering:' || l_proc, 5);
350 --
351 -- Convert arguments into local l_rec structure.
352 --
353 l_rec.succession_plan_id := p_succession_plan_id;
354 l_rec.person_id := p_person_id;
355 l_rec.position_id := p_position_id;
356 l_rec.business_group_id := p_business_group_id;
357 l_rec.start_date := p_start_date;
358 l_rec.time_scale := p_time_scale;
359 l_rec.end_date := p_end_date;
360 l_rec.available_for_promotion := p_available_for_promotion;
361 l_rec.manager_comments := p_manager_comments;
362 l_rec.object_version_number := p_object_version_number;
363 l_rec.attribute_category := p_attribute_category;
364 l_rec.attribute1 := p_attribute1;
365 l_rec.attribute2 := p_attribute2;
366 l_rec.attribute3 := p_attribute3;
367 l_rec.attribute4 := p_attribute4;
368 l_rec.attribute5 := p_attribute5;
369 l_rec.attribute6 := p_attribute6;
370 l_rec.attribute7 := p_attribute7;
371 l_rec.attribute8 := p_attribute8;
372 l_rec.attribute9 := p_attribute9;
373 l_rec.attribute10 := p_attribute10;
374 l_rec.attribute11 := p_attribute11;
375 l_rec.attribute12 := p_attribute12;
376 l_rec.attribute13 := p_attribute13;
377 l_rec.attribute14 := p_attribute14;
378 l_rec.attribute15 := p_attribute15;
379 l_rec.attribute16 := p_attribute16;
380 l_rec.attribute17 := p_attribute17;
381 l_rec.attribute18 := p_attribute18;
382 l_rec.attribute19 := p_attribute19;
383 l_rec.attribute20 := p_attribute20;
384 l_rec.job_id := p_job_id;
385 l_rec.successee_person_id := p_successee_person_id;
386 l_rec.person_rank := p_person_rank;
387 l_rec.PERFORMANCE := p_performance;
388 l_rec.plan_status := p_plan_status;
389 l_rec.readiness_percentage := p_readiness_percentage;
390 --
391 -- Return the plsql record structure.
392 --
393 hr_utility.set_location (' Leaving:' || l_proc, 10);
394 RETURN (l_rec);
395 --
396 END convert_args;
397 --
398 END per_suc_shd;