[Home] [Help]
PACKAGE BODY: APPS.PER_SUB_SHD
Source
1 Package Body per_sub_shd as
2 /* $Header: pesubrhi.pkb 115.14 2004/02/23 01:47:08 smparame ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sub_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_SUBJECTS_TAKEN_FK1') Then
37 hr_utility.set_message(801, 'HR_51813_SUB_QUAL_ID_REF');
38 hr_utility.raise_error;
39 ElsIf (p_constraint_name = 'PER_SUBJECTS_TAKEN_PK') Then
40 hr_utility.set_message(801, 'HR_51814_SUB_SUB_TAKEN_ID_PK');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'PER_SUBJECTS_TAKEN_UK1') Then
43 hr_utility.set_message(801, 'HR_51815_SUB_REC_NOT_UNIQ');
44 hr_utility.raise_error;
45 ElsIf (p_constraint_name = 'PER_SUB_START_DATES') Then
46 hr_utility.set_message(801, 'HR_51816_SUB_START_DATE_INV');
47 hr_utility.raise_error;
48 Else
49 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
50 hr_utility.set_message_token('PROCEDURE', l_proc);
51 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
52 hr_utility.raise_error;
53 End If;
54 --
58 -- ----------------------------------------------------------------------------
55 hr_utility.set_location(' Leaving:'||l_proc, 10);
56 End constraint_error;
57 --
59 -- |-----------------------------< api_updating >-----------------------------|
60 -- ----------------------------------------------------------------------------
61 Function api_updating
62 (
63 p_subjects_taken_id in number,
64 p_object_version_number in number
65 ) Return Boolean Is
66 --
67 --
68 -- Cursor selects the 'current' row from the HR Schema
69 --
70 Cursor C_Sel1 is
71 select
72 subjects_taken_id,
73 start_date,
74 major,
75 subject_status,
76 subject,
77 grade_attained,
78 end_date,
79 qualification_id,
80 object_version_number,
81 attribute_category,
82 attribute1,
83 attribute2,
84 attribute3,
85 attribute4,
86 attribute5,
87 attribute6,
88 attribute7,
89 attribute8,
90 attribute9,
91 attribute10,
92 attribute11,
93 attribute12,
94 attribute13,
95 attribute14,
96 attribute15,
97 attribute16,
98 attribute17,
99 attribute18,
100 attribute19,
101 attribute20,
102 sub_information_category,
103 sub_information1,
104 sub_information2,
105 sub_information3,
106 sub_information4,
107 sub_information5,
108 sub_information6,
109 sub_information7,
110 sub_information8,
111 sub_information9,
112 sub_information10,
113 sub_information11,
114 sub_information12,
115 sub_information13,
116 sub_information14,
117 sub_information15,
118 sub_information16,
119 sub_information17,
120 sub_information18,
121 sub_information19,
122 sub_information20
123 from per_subjects_taken
124 where subjects_taken_id = p_subjects_taken_id;
125 --
126 l_proc varchar2(72) := g_package||'api_updating';
127 l_fct_ret boolean;
128 --
129 Begin
130 hr_utility.set_location('Entering:'||l_proc, 5);
131 --
132 If (
133 p_subjects_taken_id is null and
134 p_object_version_number is null
135 ) Then
136 --
137 -- One of the primary key arguments is null therefore we must
138 -- set the returning function value to false
139 --
140 l_fct_ret := false;
141 Else
142 If (
143 p_subjects_taken_id = g_old_rec.subjects_taken_id and
144 p_object_version_number = g_old_rec.object_version_number
145 ) Then
146 hr_utility.set_location(l_proc, 10);
147 --
148 -- The g_old_rec is current therefore we must
149 -- set the returning function to true
150 --
151 l_fct_ret := true;
152 Else
153 --
154 -- Select the current row into g_old_rec
155 --
156 Open C_Sel1;
157 Fetch C_Sel1 Into g_old_rec;
158 If C_Sel1%notfound Then
159 Close C_Sel1;
160 --
161 -- The primary key is invalid therefore we must error
162 --
163 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
164 hr_utility.raise_error;
165 End If;
166 Close C_Sel1;
167 If (p_object_version_number <> g_old_rec.object_version_number) Then
168 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
169 hr_utility.raise_error;
170 End If;
171 hr_utility.set_location(l_proc, 15);
172 l_fct_ret := true;
173 End If;
174 End If;
175 hr_utility.set_location(' Leaving:'||l_proc, 20);
176 Return (l_fct_ret);
177 --
178 End api_updating;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |---------------------------------< lck >----------------------------------|
182 -- ----------------------------------------------------------------------------
183 Procedure lck
184 (
185 p_subjects_taken_id in number,
186 p_object_version_number in number
187 ) is
188 --
189 -- Cursor selects the 'current' row from the HR Schema
190 --
191 Cursor C_Sel1 is
192 select subjects_taken_id,
193 start_date,
194 major,
195 subject_status,
196 subject,
197 grade_attained,
198 end_date,
199 qualification_id,
200 object_version_number,
201 attribute_category,
202 attribute1,
203 attribute2,
204 attribute3,
205 attribute4,
206 attribute5,
207 attribute6,
208 attribute7,
209 attribute8,
210 attribute9,
211 attribute10,
212 attribute11,
213 attribute12,
214 attribute13,
215 attribute14,
216 attribute15,
217 attribute16,
218 attribute17,
219 attribute18,
220 attribute19,
221 attribute20,
222 sub_information_category,
223 sub_information1,
224 sub_information2,
225 sub_information3,
226 sub_information4,
227 sub_information5,
228 sub_information6,
229 sub_information7,
230 sub_information8,
231 sub_information9,
232 sub_information10,
233 sub_information11,
234 sub_information12,
235 sub_information13,
236 sub_information14,
237 sub_information15,
238 sub_information16,
242 sub_information20
239 sub_information17,
240 sub_information18,
241 sub_information19,
243 from per_subjects_taken
244 where subjects_taken_id = p_subjects_taken_id
245 for update nowait;
246 --
247 l_proc varchar2(72) := g_package||'lck';
248 --
249 Begin
250 hr_utility.set_location('Entering:'||l_proc, 5);
251 --
252 -- Add any mandatory argument checking here:
253 -- Example:
254 -- hr_api.mandatory_arg_error
255 -- (p_api_name => l_proc,
256 -- p_argument => 'object_version_number',
257 -- p_argument_value => p_object_version_number);
258 --
259 Open C_Sel1;
260 Fetch C_Sel1 Into g_old_rec;
261 If C_Sel1%notfound then
262 Close C_Sel1;
263 --
264 -- The primary key is invalid therefore we must error
265 --
266 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
267 hr_utility.raise_error;
268 End If;
269 Close C_Sel1;
270 If (p_object_version_number <> g_old_rec.object_version_number) Then
271 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
272 hr_utility.raise_error;
273 End If;
274 --
275 hr_utility.set_location(' Leaving:'||l_proc, 10);
276 --
277 -- We need to trap the ORA LOCK exception
278 --
279 Exception
280 When HR_Api.Object_Locked then
281 --
282 -- The object is locked therefore we need to supply a meaningful
283 -- error message.
284 --
285 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
286 hr_utility.set_message_token('TABLE_NAME', 'per_subjects_taken');
287 hr_utility.raise_error;
288 End lck;
289 --
290 -- ----------------------------------------------------------------------------
291 -- |-----------------------------< convert_args >-----------------------------|
292 -- ----------------------------------------------------------------------------
293 Function convert_args
294 (
295 p_subjects_taken_id in number,
296 p_start_date in date,
297 p_major in varchar2,
298 p_subject_status in varchar2,
299 p_subject in varchar2,
300 p_grade_attained in varchar2,
301 p_end_date in date,
302 p_qualification_id in number,
303 p_object_version_number in number,
304 p_attribute_category in varchar2,
305 p_attribute1 in varchar2,
306 p_attribute2 in varchar2,
307 p_attribute3 in varchar2,
308 p_attribute4 in varchar2,
309 p_attribute5 in varchar2,
310 p_attribute6 in varchar2,
311 p_attribute7 in varchar2,
312 p_attribute8 in varchar2,
313 p_attribute9 in varchar2,
314 p_attribute10 in varchar2,
315 p_attribute11 in varchar2,
316 p_attribute12 in varchar2,
317 p_attribute13 in varchar2,
318 p_attribute14 in varchar2,
319 p_attribute15 in varchar2,
320 p_attribute16 in varchar2,
321 p_attribute17 in varchar2,
322 p_attribute18 in varchar2,
323 p_attribute19 in varchar2,
324 p_attribute20 in varchar2,
325 p_sub_information_category in varchar2,
326 p_sub_information1 in varchar2,
327 p_sub_information2 in varchar2,
328 p_sub_information3 in varchar2,
329 p_sub_information4 in varchar2,
330 p_sub_information5 in varchar2,
331 p_sub_information6 in varchar2,
332 p_sub_information7 in varchar2,
333 p_sub_information8 in varchar2,
334 p_sub_information9 in varchar2,
335 p_sub_information10 in varchar2,
336 p_sub_information11 in varchar2,
337 p_sub_information12 in varchar2,
338 p_sub_information13 in varchar2,
339 p_sub_information14 in varchar2,
340 p_sub_information15 in varchar2,
341 p_sub_information16 in varchar2,
342 p_sub_information17 in varchar2,
343 p_sub_information18 in varchar2,
344 p_sub_information19 in varchar2,
345 p_sub_information20 in varchar2
346 )
347 Return g_rec_type is
348 --
349 l_rec g_rec_type;
350 l_proc varchar2(72) := g_package||'convert_args';
351 --
352 Begin
353 --
354 hr_utility.set_location('Entering:'||l_proc, 5);
355 --
356 -- Convert arguments into local l_rec structure.
357 --
358 l_rec.subjects_taken_id := p_subjects_taken_id;
359 l_rec.start_date := p_start_date;
360 l_rec.major := p_major;
361 l_rec.subject_status := p_subject_status;
362 l_rec.subject := p_subject;
363 l_rec.grade_attained := p_grade_attained;
364 l_rec.end_date := p_end_date;
365 l_rec.qualification_id := p_qualification_id;
366 l_rec.object_version_number := p_object_version_number;
367 l_rec.attribute_category := p_attribute_category;
368 l_rec.attribute1 := p_attribute1;
369 l_rec.attribute2 := p_attribute2;
370 l_rec.attribute3 := p_attribute3;
371 l_rec.attribute4 := p_attribute4;
372 l_rec.attribute5 := p_attribute5;
373 l_rec.attribute6 := p_attribute6;
374 l_rec.attribute7 := p_attribute7;
375 l_rec.attribute8 := p_attribute8;
376 l_rec.attribute9 := p_attribute9;
377 l_rec.attribute10 := p_attribute10;
378 l_rec.attribute11 := p_attribute11;
379 l_rec.attribute12 := p_attribute12;
380 l_rec.attribute13 := p_attribute13;
381 l_rec.attribute14 := p_attribute14;
382 l_rec.attribute15 := p_attribute15;
383 l_rec.attribute16 := p_attribute16;
384 l_rec.attribute17 := p_attribute17;
385 l_rec.attribute18 := p_attribute18;
386 l_rec.attribute19 := p_attribute19;
387 l_rec.attribute20 := p_attribute20;
388 l_rec.sub_information_category := p_sub_information_category;
389 l_rec.sub_information1 := p_sub_information1;
390 l_rec.sub_information2 := p_sub_information2;
391 l_rec.sub_information3 := p_sub_information3;
392 l_rec.sub_information4 := p_sub_information4;
393 l_rec.sub_information5 := p_sub_information5;
394 l_rec.sub_information6 := p_sub_information6;
395 l_rec.sub_information7 := p_sub_information7;
396 l_rec.sub_information8 := p_sub_information8;
397 l_rec.sub_information9 := p_sub_information9;
398 l_rec.sub_information10 := p_sub_information10;
399 l_rec.sub_information11 := p_sub_information11;
400 l_rec.sub_information12 := p_sub_information12;
401 l_rec.sub_information13 := p_sub_information13;
402 l_rec.sub_information14 := p_sub_information14;
403 l_rec.sub_information15 := p_sub_information15;
404 l_rec.sub_information16 := p_sub_information16;
405 l_rec.sub_information17 := p_sub_information17;
406 l_rec.sub_information18 := p_sub_information18;
407 l_rec.sub_information19 := p_sub_information19;
408 l_rec.sub_information20 := p_sub_information20;
409 --
410 -- Return the plsql record structure.
411 --
412 hr_utility.set_location(' Leaving:'||l_proc, 10);
413 Return(l_rec);
414 --
415 End convert_args;
416 --
417 end per_sub_shd;