[Home] [Help]
PACKAGE BODY: APPS.PER_PHN_SHD
Source
1 Package Body per_phn_shd as
2 /* $Header: pephnrhi.pkb 120.0 2005/05/31 14:21:07 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_phn_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_PHONES_PK') Then
22 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
23 hr_utility.set_message_token('PROCEDURE', l_proc);
24 hr_utility.set_message_token('STEP','5');
25 hr_utility.raise_error;
26 Else
27 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
28 hr_utility.set_message_token('PROCEDURE', l_proc);
29 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
30 hr_utility.raise_error;
31 End If;
32 --
33 hr_utility.set_location(' Leaving:'||l_proc, 10);
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (
41 p_phone_id in number,
42 p_object_version_number in number
43 ) Return Boolean Is
44 --
45 --
46 -- Cursor selects the 'current' row from the HR Schema
47 --
48 Cursor C_Sel1 is
49 select
50 phone_id,
51 date_from,
52 date_to,
53 phone_type,
54 phone_number,
55 parent_id,
56 parent_table,
57 attribute_category,
58 attribute1,
59 attribute2,
60 attribute3,
61 attribute4,
62 attribute5,
63 attribute6,
64 attribute7,
65 attribute8,
66 attribute9,
67 attribute10,
68 attribute11,
69 attribute12,
70 attribute13,
71 attribute14,
72 attribute15,
73 attribute16,
74 attribute17,
75 attribute18,
76 attribute19,
77 attribute20,
78 attribute21,
79 attribute22,
80 attribute23,
81 attribute24,
82 attribute25,
83 attribute26,
84 attribute27,
85 attribute28,
86 attribute29,
87 attribute30,
88 party_id, -- HR/TCA merge
89 validity,
90 object_version_number
91 from per_phones
92 where phone_id = p_phone_id;
93 --
94 l_proc varchar2(72) := g_package||'api_updating';
95 l_fct_ret boolean;
96 --
97 Begin
98 hr_utility.set_location('Entering:'||l_proc, 5);
99 --
100 If (
101 p_phone_id is null and
102 p_object_version_number is null
103 ) Then
104 --
105 -- One of the primary key arguments is null therefore we must
106 -- set the returning function value to false
107 --
108 l_fct_ret := false;
109 Else
110 If (
111 p_phone_id = g_old_rec.phone_id and
112 p_object_version_number = g_old_rec.object_version_number
113 ) Then
114 hr_utility.set_location(l_proc, 10);
115 --
116 -- The g_old_rec is current therefore we must
117 -- set the returning function to true
118 --
119 l_fct_ret := true;
120 Else
121 --
122 -- Select the current row into g_old_rec
123 --
124 Open C_Sel1;
125 Fetch C_Sel1 Into g_old_rec;
126 If C_Sel1%notfound Then
127 Close C_Sel1;
128 --
129 -- The primary key is invalid therefore we must error
130 --
131 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
132 hr_utility.raise_error;
133 End If;
134 Close C_Sel1;
135 If (p_object_version_number <> g_old_rec.object_version_number) Then
136 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
137 hr_utility.raise_error;
138 End If;
139 hr_utility.set_location(l_proc, 15);
140 l_fct_ret := true;
141 End If;
142 End If;
143 hr_utility.set_location(' Leaving:'||l_proc, 20);
144 Return (l_fct_ret);
145 --
146 End api_updating;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |---------------------------------< lck >----------------------------------|
150 -- ----------------------------------------------------------------------------
151 Procedure lck
152 (
153 p_phone_id in number,
154 p_object_version_number in number
155 ) is
156 --
157 -- Cursor selects the 'current' row from the HR Schema
158 --
159 Cursor C_Sel1 is
160 select phone_id,
161 date_from,
162 date_to,
163 phone_type,
164 phone_number,
165 parent_id,
166 parent_table,
167 attribute_category,
168 attribute1,
169 attribute2,
170 attribute3,
171 attribute4,
172 attribute5,
173 attribute6,
174 attribute7,
175 attribute8,
176 attribute9,
177 attribute10,
178 attribute11,
179 attribute12,
180 attribute13,
181 attribute14,
182 attribute15,
183 attribute16,
184 attribute17,
185 attribute18,
186 attribute19,
187 attribute20,
188 attribute21,
189 attribute22,
190 attribute23,
191 attribute24,
192 attribute25,
193 attribute26,
194 attribute27,
195 attribute28,
196 attribute29,
197 attribute30,
198 party_id, -- HR/TCA merge
199 validity,
200 object_version_number
201 from per_phones
202 where phone_id = p_phone_id
203 for update nowait;
204 --
205 l_proc varchar2(72) := g_package||'lck';
206 --
207 Begin
208 hr_utility.set_location('Entering:'||l_proc, 5);
209 --
210 -- Add any mandatory argument checking here:
211 -- Example:
212 -- hr_api.mandatory_arg_error
213 -- (p_api_name => l_proc,
214 -- p_argument => 'object_version_number',
215 -- p_argument_value => p_object_version_number);
216 --
217 Open C_Sel1;
218 Fetch C_Sel1 Into g_old_rec;
219 If C_Sel1%notfound then
220 Close C_Sel1;
221 --
222 -- The primary key is invalid therefore we must error
223 --
224 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
225 hr_utility.raise_error;
226 End If;
227 Close C_Sel1;
228 If (p_object_version_number <> g_old_rec.object_version_number) Then
229 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
230 hr_utility.raise_error;
231 End If;
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 10);
234 --
235 -- We need to trap the ORA LOCK exception
236 --
237 Exception
238 When HR_Api.Object_Locked then
239 --
240 -- The object is locked therefore we need to supply a meaningful
241 -- error message.
242 --
243 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
244 hr_utility.set_message_token('TABLE_NAME', 'per_phones');
245 hr_utility.raise_error;
246 End lck;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |-----------------------------< convert_args >-----------------------------|
250 -- ----------------------------------------------------------------------------
251 Function convert_args
252 (
253 p_phone_id in number,
254 p_date_from in date,
255 p_date_to in date,
256 p_phone_type in varchar2,
257 p_phone_number in varchar2,
258 p_parent_id in number,
259 p_parent_table in varchar2,
260 p_attribute_category in varchar2,
261 p_attribute1 in varchar2,
262 p_attribute2 in varchar2,
263 p_attribute3 in varchar2,
264 p_attribute4 in varchar2,
265 p_attribute5 in varchar2,
266 p_attribute6 in varchar2,
267 p_attribute7 in varchar2,
268 p_attribute8 in varchar2,
269 p_attribute9 in varchar2,
270 p_attribute10 in varchar2,
271 p_attribute11 in varchar2,
272 p_attribute12 in varchar2,
273 p_attribute13 in varchar2,
274 p_attribute14 in varchar2,
275 p_attribute15 in varchar2,
276 p_attribute16 in varchar2,
277 p_attribute17 in varchar2,
278 p_attribute18 in varchar2,
279 p_attribute19 in varchar2,
280 p_attribute20 in varchar2,
281 p_attribute21 in varchar2,
282 p_attribute22 in varchar2,
283 p_attribute23 in varchar2,
284 p_attribute24 in varchar2,
285 p_attribute25 in varchar2,
286 p_attribute26 in varchar2,
287 p_attribute27 in varchar2,
288 p_attribute28 in varchar2,
289 p_attribute29 in varchar2,
290 p_attribute30 in varchar2,
291 p_party_id in number default null, -- HR/TCA merge
292 p_validity in varchar2,
293 p_object_version_number in number
294 )
295 Return g_rec_type is
296 --
297 l_rec g_rec_type;
298 l_proc varchar2(72) := g_package||'convert_args';
299 --
300 Begin
301 --
302 hr_utility.set_location('Entering:'||l_proc, 5);
303 --
304 -- Convert arguments into local l_rec structure.
305 --
306 l_rec.phone_id := p_phone_id;
307 l_rec.date_from := p_date_from;
308 l_rec.date_to := p_date_to;
309 l_rec.phone_type := p_phone_type;
310 l_rec.phone_number := p_phone_number;
311 l_rec.parent_id := p_parent_id;
312 l_rec.parent_table := p_parent_table;
313 l_rec.attribute_category := p_attribute_category;
314 l_rec.attribute1 := p_attribute1;
315 l_rec.attribute2 := p_attribute2;
316 l_rec.attribute3 := p_attribute3;
317 l_rec.attribute4 := p_attribute4;
318 l_rec.attribute5 := p_attribute5;
319 l_rec.attribute6 := p_attribute6;
320 l_rec.attribute7 := p_attribute7;
321 l_rec.attribute8 := p_attribute8;
322 l_rec.attribute9 := p_attribute9;
323 l_rec.attribute10 := p_attribute10;
324 l_rec.attribute11 := p_attribute11;
325 l_rec.attribute12 := p_attribute12;
326 l_rec.attribute13 := p_attribute13;
327 l_rec.attribute14 := p_attribute14;
328 l_rec.attribute15 := p_attribute15;
329 l_rec.attribute16 := p_attribute16;
330 l_rec.attribute17 := p_attribute17;
331 l_rec.attribute18 := p_attribute18;
332 l_rec.attribute19 := p_attribute19;
333 l_rec.attribute20 := p_attribute20;
334 l_rec.attribute21 := p_attribute21;
335 l_rec.attribute22 := p_attribute22;
336 l_rec.attribute23 := p_attribute23;
337 l_rec.attribute24 := p_attribute24;
338 l_rec.attribute25 := p_attribute25;
339 l_rec.attribute26 := p_attribute26;
340 l_rec.attribute27 := p_attribute27;
341 l_rec.attribute28 := p_attribute28;
342 l_rec.attribute29 := p_attribute29;
343 l_rec.attribute30 := p_attribute30;
344 l_rec.party_id := p_party_id; -- HR/TCA merge
345 l_rec.validity := p_validity;
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 -- ----------------------------------------------------------------------------
356 -- |--------------------------< set_called_from_form >------------------------|
357 -- ----------------------------------------------------------------------------
358 procedure set_called_from_form
359 ( p_flag in boolean ) as
360 begin
361 g_called_from_form:=p_flag;
362 end;
363 --
364 end per_phn_shd;