[Home] [Help]
PACKAGE BODY: APPS.PER_JBR_SHD
Source
1 Package Body per_jbr_shd as
2 /* $Header: pejbrrhi.pkb 115.7 2002/12/06 10:18:00 pkakar ship $ */
3 --
4 -- ---------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ---------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_jbr_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_JOB_REQUIREMENTS_FK1') Then
37 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38 hr_utility.set_message_token('PROCEDURE', l_proc);
39 hr_utility.set_message_token('STEP','5');
40 hr_utility.raise_error;
41 ElsIf (p_constraint_name = 'PER_JOB_REQUIREMENTS_FK2') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 ElsIf (p_constraint_name = 'PER_JOB_REQUIREMENTS_FK50') 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','15');
50 hr_utility.raise_error;
51 ElsIf (p_constraint_name = 'PER_JOB_REQUIREMENTS_FK51') Then
52 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
53 hr_utility.set_message_token('PROCEDURE', l_proc);
54 hr_utility.set_message_token('STEP','20');
55 hr_utility.raise_error;
56 ElsIf (p_constraint_name = 'PER_JOB_REQUIREMENTS_PK') Then
57 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
58 hr_utility.set_message_token('PROCEDURE', l_proc);
59 hr_utility.set_message_token('STEP','25');
60 hr_utility.raise_error;
61 ElsIf (p_constraint_name = 'PER_REQ_ESSENTIAL_CHK') Then
62 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
63 hr_utility.set_message_token('PROCEDURE', l_proc);
64 hr_utility.set_message_token('STEP','30');
65 hr_utility.raise_error;
66 Else
67 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
68 hr_utility.set_message_token('PROCEDURE', l_proc);
69 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
70 hr_utility.raise_error;
71 End If;
72 --
73 hr_utility.set_location(' Leaving:'||l_proc, 10);
74 End constraint_error;
75 --
76 -- ---------------------------------------------------------------------------
77 -- |----------------------------< api_updating >-----------------------------|
78 -- ---------------------------------------------------------------------------
79 Function api_updating
80 (
81 p_job_requirement_id in number,
82 p_object_version_number in number
83 ) Return Boolean Is
84 --
85 --
86 -- Cursor selects the 'current' row from the HR Schema
87 --
88 Cursor C_Sel1 is
89 select
90 job_requirement_id,
91 business_group_id,
92 analysis_criteria_id,
93 comments,
94 date_from,
95 date_to,
96 essential,
97 job_id,
98 position_id,
99 request_id,
100 program_application_id,
101 program_id,
102 program_update_date,
103 attribute_category,
104 attribute1,
105 attribute2,
106 attribute3,
107 attribute4,
108 attribute5,
109 attribute6,
110 attribute7,
111 attribute8,
112 attribute9,
113 attribute10,
114 attribute11,
115 attribute12,
116 attribute13,
117 attribute14,
118 attribute15,
119 attribute16,
120 attribute17,
121 attribute18,
122 attribute19,
123 attribute20,
124 object_version_number
125 from per_job_requirements
126 where job_requirement_id = p_job_requirement_id;
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 If (
135 p_job_requirement_id is null and
136 p_object_version_number is null
137 ) Then
138 --
139 -- One of the primary key arguments is null therefore we must
140 -- set the returning function value to false
141 --
142 l_fct_ret := false;
143 Else
144 If (
145 p_job_requirement_id = g_old_rec.job_requirement_id and
146 p_object_version_number = g_old_rec.object_version_number
147 ) Then
148 hr_utility.set_location(l_proc, 10);
149 --
150 -- The g_old_rec is current therefore we must
151 -- set the returning function to true
152 --
153 l_fct_ret := true;
154 Else
155 --
156 -- Select the current row into g_old_rec
157 --
158 Open C_Sel1;
159 Fetch C_Sel1 Into g_old_rec;
160 If C_Sel1%notfound Then
161 Close C_Sel1;
162 --
163 -- The primary key is invalid therefore we must error
164 --
165 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
166 hr_utility.raise_error;
167 End If;
168 Close C_Sel1;
169 If (p_object_version_number <> g_old_rec.object_version_number) Then
170 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
171 hr_utility.raise_error;
172 End If;
173 hr_utility.set_location(l_proc, 15);
174 l_fct_ret := true;
175 End If;
176 End If;
177 hr_utility.set_location(' Leaving:'||l_proc, 20);
178 Return (l_fct_ret);
179 --
180 End api_updating;
181 --
182 -- ---------------------------------------------------------------------------
183 -- |--------------------------------< lck >----------------------------------|
184 -- ---------------------------------------------------------------------------
185 Procedure lck
186 (
187 p_job_requirement_id in number,
188 p_object_version_number in number
189 ) is
190 --
191 -- Cursor selects the 'current' row from the HR Schema
192 --
193 Cursor C_Sel1 is
194 select
195 job_requirement_id,
196 business_group_id,
197 analysis_criteria_id,
198 comments,
199 date_from,
200 date_to,
201 essential,
202 job_id,
203 position_id,
204 request_id,
205 program_application_id,
206 program_id,
207 program_update_date,
208 attribute_category,
209 attribute1,
210 attribute2,
211 attribute3,
212 attribute4,
213 attribute5,
214 attribute6,
215 attribute7,
216 attribute8,
217 attribute9,
218 attribute10,
219 attribute11,
220 attribute12,
221 attribute13,
222 attribute14,
223 attribute15,
224 attribute16,
225 attribute17,
226 attribute18,
227 attribute19,
228 attribute20,
229 object_version_number
230 from per_job_requirements
231 where job_requirement_id = p_job_requirement_id
232 for update nowait;
233 --
234 l_proc varchar2(72) := g_package||'lck';
235 --
236 Begin
237 hr_utility.set_location('Entering:'||l_proc, 5);
238 --
239 -- Add any mandatory argument checking here:
240 -- Example:
241 -- hr_api.mandatory_arg_error
242 -- (p_api_name => l_proc,
243 -- p_argument => 'object_version_number',
244 -- p_argument_value => p_object_version_number);
245 --
246 Open C_Sel1;
247 Fetch C_Sel1 Into g_old_rec;
248 If C_Sel1%notfound then
249 Close C_Sel1;
250 --
251 -- The primary key is invalid therefore we must error
252 --
253 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
254 hr_utility.raise_error;
255 End If;
256 Close C_Sel1;
257 If (p_object_version_number <> g_old_rec.object_version_number) Then
258 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
259 hr_utility.raise_error;
260 End If;
261 --
262 hr_utility.set_location(' Leaving:'||l_proc, 10);
263 --
264 -- We need to trap the ORA LOCK exception
265 --
266 Exception
267 When HR_Api.Object_Locked then
268 --
269 -- The object is locked therefore we need to supply a meaningful
270 -- error message.
271 --
272 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
273 hr_utility.set_message_token('TABLE_NAME', 'per_job_requirements');
274 hr_utility.raise_error;
275 End lck;
276 --
277 -- ---------------------------------------------------------------------------
278 -- |----------------------------< convert_args >-----------------------------|
279 -- ---------------------------------------------------------------------------
280 Function convert_args
281 (
282 p_job_requirement_id in number,
283 p_business_group_id in number,
284 p_analysis_criteria_id in number,
285 p_comments in varchar2,
286 p_date_from in date,
287 p_date_to in date,
288 p_essential in varchar2,
289 p_job_id in number,
290 p_position_id in number,
291 p_request_id in number,
292 p_program_application_id in number,
293 p_program_id in number,
294 p_program_update_date in date,
295 p_attribute_category in varchar2,
296 p_attribute1 in varchar2,
297 p_attribute2 in varchar2,
298 p_attribute3 in varchar2,
299 p_attribute4 in varchar2,
300 p_attribute5 in varchar2,
301 p_attribute6 in varchar2,
302 p_attribute7 in varchar2,
303 p_attribute8 in varchar2,
304 p_attribute9 in varchar2,
305 p_attribute10 in varchar2,
306 p_attribute11 in varchar2,
307 p_attribute12 in varchar2,
308 p_attribute13 in varchar2,
309 p_attribute14 in varchar2,
310 p_attribute15 in varchar2,
311 p_attribute16 in varchar2,
312 p_attribute17 in varchar2,
313 p_attribute18 in varchar2,
314 p_attribute19 in varchar2,
315 p_attribute20 in varchar2,
316 p_object_version_number in number
317 )
318 Return g_rec_type is
319 --
320 l_rec g_rec_type;
321 l_proc varchar2(72) := g_package||'convert_args';
322 --
323 Begin
324 --
325 hr_utility.set_location('Entering:'||l_proc, 5);
326 --
327 -- Convert arguments into local l_rec structure.
328 --
329 l_rec.job_requirement_id := p_job_requirement_id;
330 l_rec.business_group_id := p_business_group_id;
331 l_rec.analysis_criteria_id := p_analysis_criteria_id;
332 l_rec.comments := p_comments;
333 l_rec.date_from := p_date_from;
334 l_rec.date_to := p_date_to;
335 l_rec.essential := p_essential;
336 l_rec.job_id := p_job_id;
337 l_rec.position_id := p_position_id;
338 l_rec.request_id := p_request_id;
339 l_rec.program_application_id := p_program_application_id;
340 l_rec.program_id := p_program_id;
341 l_rec.program_update_date := p_program_update_date;
342 l_rec.attribute_category := p_attribute_category;
343 l_rec.attribute1 := p_attribute1;
344 l_rec.attribute2 := p_attribute2;
345 l_rec.attribute3 := p_attribute3;
346 l_rec.attribute4 := p_attribute4;
347 l_rec.attribute5 := p_attribute5;
348 l_rec.attribute6 := p_attribute6;
349 l_rec.attribute7 := p_attribute7;
350 l_rec.attribute8 := p_attribute8;
351 l_rec.attribute9 := p_attribute9;
352 l_rec.attribute10 := p_attribute10;
353 l_rec.attribute11 := p_attribute11;
354 l_rec.attribute12 := p_attribute12;
355 l_rec.attribute13 := p_attribute13;
356 l_rec.attribute14 := p_attribute14;
357 l_rec.attribute15 := p_attribute15;
358 l_rec.attribute16 := p_attribute16;
359 l_rec.attribute17 := p_attribute17;
360 l_rec.attribute18 := p_attribute18;
361 l_rec.attribute19 := p_attribute19;
362 l_rec.attribute20 := p_attribute20;
363 l_rec.object_version_number := p_object_version_number;
364 --
365 -- Return the plsql record structure.
366 --
367 hr_utility.set_location(' Leaving:'||l_proc, 10);
368 Return(l_rec);
369 --
370 End convert_args;
371 --
372 end per_jbr_shd;