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