[Home] [Help]
PACKAGE BODY: APPS.PQP_PVD_SHD
Source
1 Package Body pqp_pvd_shd as
2 /* $Header: pqpvdrhi.pkb 115.6 2003/02/17 22:14:43 tmehra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqp_pvd_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16 --
17 Return (nvl(g_api_dml, false));
18 --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25 (p_constraint_name in all_constraints.constraint_name%TYPE
26 ) Is
27 --
28 l_proc varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31 --
32 If (p_constraint_name = 'PQP_VEHICLE_DETAILS_PK') Then
33 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('STEP','5');
36 fnd_message.raise_error;
37 Else
38 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41 fnd_message.raise_error;
42 End If;
43 --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50 (p_vehicle_details_id in number
51 ,p_object_version_number in number
52 )
53 Return Boolean Is
54 --
55 --
56 -- Cursor selects the 'current' row from the HR Schema
57 --
58 Cursor C_Sel1 is
59 select
60 vehicle_details_id
61 ,vehicle_type
62 ,business_group_id
63 ,registration_number
64 ,make
65 ,model
66 ,date_first_registered
67 ,engine_capacity_in_cc
68 ,fuel_type
69 ,fuel_card
70 ,currency_code
71 ,list_price
72 ,accessory_value_at_startdate
73 ,accessory_value_added_later
74 -- ,capital_contributions
75 -- ,private_use_contributions
76 ,market_value_classic_car
77 ,co2_emissions
78 ,vehicle_provider
79 ,object_version_number
80 ,vehicle_identification_number
81 ,vehicle_ownership
82 ,vhd_attribute_category
83 ,vhd_attribute1
84 ,vhd_attribute2
85 ,vhd_attribute3
86 ,vhd_attribute4
87 ,vhd_attribute5
88 ,vhd_attribute6
89 ,vhd_attribute7
90 ,vhd_attribute8
91 ,vhd_attribute9
92 ,vhd_attribute10
93 ,vhd_attribute11
94 ,vhd_attribute12
95 ,vhd_attribute13
96 ,vhd_attribute14
97 ,vhd_attribute15
98 ,vhd_attribute16
99 ,vhd_attribute17
100 ,vhd_attribute18
101 ,vhd_attribute19
102 ,vhd_attribute20
103 ,vhd_information_category
104 ,vhd_information1
105 ,vhd_information2
106 ,vhd_information3
107 ,vhd_information4
108 ,vhd_information5
109 ,vhd_information6
110 ,vhd_information7
111 ,vhd_information8
112 ,vhd_information9
113 ,vhd_information10
114 ,vhd_information11
115 ,vhd_information12
116 ,vhd_information13
117 ,vhd_information14
118 ,vhd_information15
119 ,vhd_information16
120 ,vhd_information17
121 ,vhd_information18
122 ,vhd_information19
123 ,vhd_information20
124 from pqp_vehicle_details
125 where vehicle_details_id = p_vehicle_details_id;
126 --
127 l_fct_ret boolean;
128 --
129 Begin
130 --
131 If (p_vehicle_details_id is null and
132 p_object_version_number is null
133 ) Then
134 --
135 -- One of the primary key arguments is null therefore we must
136 -- set the returning function value to false
137 --
138 l_fct_ret := false;
139 Else
140 If (p_vehicle_details_id
141 = pqp_pvd_shd.g_old_rec.vehicle_details_id and
142 p_object_version_number
143 = pqp_pvd_shd.g_old_rec.object_version_number
144 ) Then
145 --
146 -- The g_old_rec is current therefore we must
147 -- set the returning function to true
148 --
149 l_fct_ret := true;
150 Else
151 --
152 -- Select the current row into g_old_rec
153 --
154 Open C_Sel1;
155 Fetch C_Sel1 Into pqp_pvd_shd.g_old_rec;
156 If C_Sel1%notfound Then
157 Close C_Sel1;
158 --
159 -- The primary key is invalid therefore we must error
160 --
161 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
162 fnd_message.raise_error;
163 End If;
164 Close C_Sel1;
165 If (p_object_version_number
166 <> pqp_pvd_shd.g_old_rec.object_version_number) Then
167 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
168 fnd_message.raise_error;
169 End If;
170 l_fct_ret := true;
171 End If;
172 End If;
173 Return (l_fct_ret);
174 --
175 End api_updating;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |---------------------------------< lck >----------------------------------|
179 -- ----------------------------------------------------------------------------
180 Procedure lck
181 (p_vehicle_details_id in number
182 ,p_object_version_number in number
183 ) is
184 --
185 -- Cursor selects the 'current' row from the HR Schema
186 --
187 Cursor C_Sel1 is
188 select
189 vehicle_details_id
190 ,vehicle_type
191 ,business_group_id
192 ,registration_number
193 ,make
194 ,model
195 ,date_first_registered
196 ,engine_capacity_in_cc
197 ,fuel_type
198 ,fuel_card
199 ,currency_code
200 ,list_price
201 ,accessory_value_at_startdate
202 ,accessory_value_added_later
203 -- ,capital_contributions
204 -- ,private_use_contributions
205 ,market_value_classic_car
206 ,co2_emissions
207 ,vehicle_provider
208 ,object_version_number
209 ,vehicle_identification_number
210 ,vehicle_ownership
211 ,vhd_attribute_category
212 ,vhd_attribute1
213 ,vhd_attribute2
214 ,vhd_attribute3
215 ,vhd_attribute4
216 ,vhd_attribute5
217 ,vhd_attribute6
218 ,vhd_attribute7
219 ,vhd_attribute8
220 ,vhd_attribute9
221 ,vhd_attribute10
222 ,vhd_attribute11
223 ,vhd_attribute12
224 ,vhd_attribute13
225 ,vhd_attribute14
226 ,vhd_attribute15
227 ,vhd_attribute16
228 ,vhd_attribute17
229 ,vhd_attribute18
230 ,vhd_attribute19
231 ,vhd_attribute20
232 ,vhd_information_category
233 ,vhd_information1
234 ,vhd_information2
235 ,vhd_information3
236 ,vhd_information4
237 ,vhd_information5
238 ,vhd_information6
239 ,vhd_information7
240 ,vhd_information8
241 ,vhd_information9
242 ,vhd_information10
243 ,vhd_information11
244 ,vhd_information12
245 ,vhd_information13
246 ,vhd_information14
247 ,vhd_information15
248 ,vhd_information16
249 ,vhd_information17
250 ,vhd_information18
251 ,vhd_information19
252 ,vhd_information20
253 from pqp_vehicle_details
254 where vehicle_details_id = p_vehicle_details_id
255 for update nowait;
256 --
257 l_proc varchar2(72) := g_package||'lck';
258 --
259 Begin
260 hr_utility.set_location('Entering:'||l_proc, 5);
261 --
262 hr_api.mandatory_arg_error
263 (p_api_name => l_proc
264 ,p_argument => 'VEHICLE_DETAILS_ID'
265 ,p_argument_value => p_vehicle_details_id
266 );
267 --
268 Open C_Sel1;
269 Fetch C_Sel1 Into pqp_pvd_shd.g_old_rec;
270 If C_Sel1%notfound then
271 Close C_Sel1;
272 --
273 -- The primary key is invalid therefore we must error
274 --
275 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
276 fnd_message.raise_error;
277 End If;
278 Close C_Sel1;
279 If (p_object_version_number
280 <> pqp_pvd_shd.g_old_rec.object_version_number) Then
281 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
282 fnd_message.raise_error;
283 End If;
284 --
285 hr_utility.set_location(' Leaving:'||l_proc, 10);
286 --
287 -- We need to trap the ORA LOCK exception
288 --
289 Exception
290 When HR_Api.Object_Locked then
291 --
292 -- The object is locked therefore we need to supply a meaningful
293 -- error message.
294 --
295 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
296 fnd_message.set_token('TABLE_NAME', 'pqp_vehicle_details');
297 fnd_message.raise_error;
298 End lck;
299 --
300 -- ----------------------------------------------------------------------------
301 -- |-----------------------------< convert_args >-----------------------------|
302 -- ----------------------------------------------------------------------------
303 Function convert_args
304 (p_vehicle_details_id in number
305 ,p_vehicle_type in varchar2
306 ,p_business_group_id in number
307 ,p_registration_number in varchar2
308 ,p_make in varchar2
309 ,p_model in varchar2
310 ,p_date_first_registered in date
311 ,p_engine_capacity_in_cc in number
312 ,p_fuel_type in varchar2
313 ,p_fuel_card in varchar2
314 ,p_currency_code in varchar2
315 ,p_list_price in number
316 ,p_accessory_value_at_startdate in number
317 ,p_accessory_value_added_later in number
318 -- ,p_capital_contributions in number
319 -- ,p_private_use_contributions in number
320 ,p_market_value_classic_car in number
321 ,p_co2_emissions in number
322 ,p_vehicle_provider in varchar2
323 ,p_object_version_number in number
324 ,p_vehicle_identification_numbe in varchar2
325 ,p_vehicle_ownership in varchar2
326 ,p_vhd_attribute_category in varchar2
327 ,p_vhd_attribute1 in varchar2
328 ,p_vhd_attribute2 in varchar2
329 ,p_vhd_attribute3 in varchar2
330 ,p_vhd_attribute4 in varchar2
331 ,p_vhd_attribute5 in varchar2
332 ,p_vhd_attribute6 in varchar2
333 ,p_vhd_attribute7 in varchar2
334 ,p_vhd_attribute8 in varchar2
335 ,p_vhd_attribute9 in varchar2
336 ,p_vhd_attribute10 in varchar2
337 ,p_vhd_attribute11 in varchar2
338 ,p_vhd_attribute12 in varchar2
339 ,p_vhd_attribute13 in varchar2
340 ,p_vhd_attribute14 in varchar2
341 ,p_vhd_attribute15 in varchar2
342 ,p_vhd_attribute16 in varchar2
343 ,p_vhd_attribute17 in varchar2
344 ,p_vhd_attribute18 in varchar2
345 ,p_vhd_attribute19 in varchar2
346 ,p_vhd_attribute20 in varchar2
347 ,p_vhd_information_category in varchar2
348 ,p_vhd_information1 in varchar2
349 ,p_vhd_information2 in varchar2
350 ,p_vhd_information3 in varchar2
351 ,p_vhd_information4 in varchar2
352 ,p_vhd_information5 in varchar2
353 ,p_vhd_information6 in varchar2
354 ,p_vhd_information7 in varchar2
355 ,p_vhd_information8 in varchar2
356 ,p_vhd_information9 in varchar2
357 ,p_vhd_information10 in varchar2
358 ,p_vhd_information11 in varchar2
359 ,p_vhd_information12 in varchar2
360 ,p_vhd_information13 in varchar2
361 ,p_vhd_information14 in varchar2
362 ,p_vhd_information15 in varchar2
363 ,p_vhd_information16 in varchar2
364 ,p_vhd_information17 in varchar2
365 ,p_vhd_information18 in varchar2
366 ,p_vhd_information19 in varchar2
367 ,p_vhd_information20 in varchar2
368 )
369 Return g_rec_type is
370 --
371 l_rec g_rec_type;
372 --
373 Begin
374 --
375 -- Convert arguments into local l_rec structure.
376 --
377 l_rec.vehicle_details_id := p_vehicle_details_id;
378 l_rec.vehicle_type := p_vehicle_type;
379 l_rec.business_group_id := p_business_group_id;
380 l_rec.registration_number := p_registration_number;
381 l_rec.make := p_make;
382 l_rec.model := p_model;
383 l_rec.date_first_registered := p_date_first_registered;
384 l_rec.engine_capacity_in_cc := p_engine_capacity_in_cc;
385 l_rec.fuel_type := p_fuel_type;
386 l_rec.fuel_card := p_fuel_card;
387 l_rec.currency_code := p_currency_code;
388 l_rec.list_price := p_list_price;
389 l_rec.accessory_value_at_startdate := p_accessory_value_at_startdate;
390 l_rec.accessory_value_added_later := p_accessory_value_added_later;
391 -- l_rec.capital_contributions := p_capital_contributions;
392 -- l_rec.private_use_contributions := p_private_use_contributions;
393 l_rec.market_value_classic_car := p_market_value_classic_car;
394 l_rec.co2_emissions := p_co2_emissions;
395 l_rec.vehicle_provider := p_vehicle_provider;
396 l_rec.object_version_number := p_object_version_number;
397 l_rec.vehicle_identification_number := p_vehicle_identification_numbe;
398 l_rec.vehicle_ownership := p_vehicle_ownership;
399 l_rec.vhd_attribute_category := p_vhd_attribute_category;
400 l_rec.vhd_attribute1 := p_vhd_attribute1;
401 l_rec.vhd_attribute2 := p_vhd_attribute2;
402 l_rec.vhd_attribute3 := p_vhd_attribute3;
403 l_rec.vhd_attribute4 := p_vhd_attribute4;
404 l_rec.vhd_attribute5 := p_vhd_attribute5;
405 l_rec.vhd_attribute6 := p_vhd_attribute6;
406 l_rec.vhd_attribute7 := p_vhd_attribute7;
407 l_rec.vhd_attribute8 := p_vhd_attribute8;
408 l_rec.vhd_attribute9 := p_vhd_attribute9;
409 l_rec.vhd_attribute10 := p_vhd_attribute10;
410 l_rec.vhd_attribute11 := p_vhd_attribute11;
411 l_rec.vhd_attribute12 := p_vhd_attribute12;
412 l_rec.vhd_attribute13 := p_vhd_attribute13;
413 l_rec.vhd_attribute14 := p_vhd_attribute14;
414 l_rec.vhd_attribute15 := p_vhd_attribute15;
415 l_rec.vhd_attribute16 := p_vhd_attribute16;
416 l_rec.vhd_attribute17 := p_vhd_attribute17;
417 l_rec.vhd_attribute18 := p_vhd_attribute18;
418 l_rec.vhd_attribute19 := p_vhd_attribute19;
419 l_rec.vhd_attribute20 := p_vhd_attribute20;
420 l_rec.vhd_information_category := p_vhd_information_category;
421 l_rec.vhd_information1 := p_vhd_information1;
422 l_rec.vhd_information2 := p_vhd_information2;
423 l_rec.vhd_information3 := p_vhd_information3;
424 l_rec.vhd_information4 := p_vhd_information4;
425 l_rec.vhd_information5 := p_vhd_information5;
426 l_rec.vhd_information6 := p_vhd_information6;
427 l_rec.vhd_information7 := p_vhd_information7;
428 l_rec.vhd_information8 := p_vhd_information8;
429 l_rec.vhd_information9 := p_vhd_information9;
430 l_rec.vhd_information10 := p_vhd_information10;
431 l_rec.vhd_information11 := p_vhd_information11;
432 l_rec.vhd_information12 := p_vhd_information12;
433 l_rec.vhd_information13 := p_vhd_information13;
434 l_rec.vhd_information14 := p_vhd_information14;
435 l_rec.vhd_information15 := p_vhd_information15;
436 l_rec.vhd_information16 := p_vhd_information16;
437 l_rec.vhd_information17 := p_vhd_information17;
438 l_rec.vhd_information18 := p_vhd_information18;
439 l_rec.vhd_information19 := p_vhd_information19;
440 l_rec.vhd_information20 := p_vhd_information20;
441 --
442 -- Return the plsql record structure.
443 --
444 Return(l_rec);
445 --
446 End convert_args;
447 --
448 end pqp_pvd_shd;