DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_ACC_INS

Source


1 Package Body pqh_acc_ins as
2 /* $Header: pqaccrhi.pkb 115.4 2004/03/15 23:54:54 svorugan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_acc_ins.';  -- Global package name
9 --
10 -- The following global variables are only to be used by
11 -- the set_base_key_value and pre_insert procedures.
12 --
13 g_accommodation_id_i  number   default null;
14 --
15 -- ----------------------------------------------------------------------------
16 -- |------------------------< set_base_key_value >----------------------------|
17 -- ----------------------------------------------------------------------------
18 procedure set_base_key_value
19   (p_accommodation_id  in  number) is
20 --
21   l_proc       varchar2(72) := g_package||'set_base_key_value';
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   pqh_acc_ins.g_accommodation_id_i := p_accommodation_id;
27   --
28   hr_utility.set_location(' Leaving:'||l_proc, 20);
29 End set_base_key_value;
30 --
31 --
32 -- ----------------------------------------------------------------------------
33 -- |----------------------------< dt_insert_dml >-----------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 --   This procedure controls the actual dml insert logic for datetrack. The
39 --   functions of this procedure are as follows:
40 --   1) Get the object_version_number.
41 --   2) To set the effective start and end dates to the corresponding
42 --      validation start and end dates. Also, the object version number
43 --      record attribute is set.
44 --   3) To set and unset the g_api_dml status as required (as we are about to
45 --      perform dml).
46 --   4) To insert the row into the schema with the derived effective start
47 --      and end dates and the object version number.
48 --   5) To trap any constraint violations that may have occurred.
49 --   6) To raise any other errors.
50 --
51 -- Prerequisites:
52 --   This is an internal private procedure which must be called from the
53 --   insert_dml and pre_update (logic permitting) procedure and must have
54 --   all mandatory arguments set.
55 --
56 -- In Parameters:
57 --   A Pl/Sql record structure.
58 --
59 -- Post Success:
60 --   The specified row will be inserted into the schema.
61 --
62 -- Post Failure:
63 --   On the insert dml failure it is important to note that we always reset the
64 --   g_api_dml status to false.
65 --   If a check or unique integrity constraint violation is raised the
66 --   constraint_error procedure will be called.
67 --   If any other error is reported, the error will be raised after the
68 --   g_api_dml status is reset.
69 --
70 -- Developer Implementation Notes:
71 --   This is an internal datetrack maintenance procedure which should
72 --   not be modified in anyway.
73 --
74 -- Access Status:
75 --   Internal Row Handler Use Only.
76 --
77 -- {End Of Comments}
78 -- ----------------------------------------------------------------------------
79 Procedure dt_insert_dml
80   (p_rec                     in out nocopy pqh_acc_shd.g_rec_type
81   ,p_effective_date          in date
82   ,p_datetrack_mode          in varchar2
83   ,p_validation_start_date   in date
84   ,p_validation_end_date     in date
85   ) is
86 -- Cursor to select 'old' created AOL who column values
87 --
88   Cursor C_Sel1 Is
89     select t.created_by,
90            t.creation_date
91     from   pqh_accommodations_f t
92     where  t.accommodation_id       = p_rec.accommodation_id
93     and    t.effective_start_date =
94              pqh_acc_shd.g_old_rec.effective_start_date
95     and    t.effective_end_date   = (p_validation_start_date - 1);
96 --
97   l_proc                varchar2(72) := g_package||'dt_insert_dml';
98   l_created_by          pqh_accommodations_f.created_by%TYPE;
99   l_creation_date       pqh_accommodations_f.creation_date%TYPE;
100   l_last_update_date    pqh_accommodations_f.last_update_date%TYPE;
101   l_last_updated_by     pqh_accommodations_f.last_updated_by%TYPE;
102   l_last_update_login   pqh_accommodations_f.last_update_login%TYPE;
103 --
104 Begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106   --
107   -- Get the object version number for the insert
108   --
109   p_rec.object_version_number :=
110     dt_api.get_object_version_number
111       (p_base_table_name => 'pqh_accommodations_f'
112       ,p_base_key_column => 'accommodation_id'
113       ,p_base_key_value  => p_rec.accommodation_id
114       );
115   --
116   -- Set the effective start and end dates to the corresponding
117   -- validation start and end dates
118   --
119   p_rec.effective_start_date := p_validation_start_date;
120   p_rec.effective_end_date   := p_validation_end_date;
121   --
122   -- If the datetrack_mode is not INSERT then we must populate the WHO
123   -- columns with the 'old' creation values and 'new' updated values.
124   --
125   If (p_datetrack_mode <> hr_api.g_insert) then
126     hr_utility.set_location(l_proc, 10);
127     --
128     -- Select the 'old' created values
129     --
130     Open C_Sel1;
131     Fetch C_Sel1 Into l_created_by, l_creation_date;
132     If C_Sel1%notfound Then
133       --
134       -- The previous 'old' created row has not been found. We need
135       -- to error as an internal datetrack problem exists.
136       --
137       Close C_Sel1;
138       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
139       fnd_message.set_token('PROCEDURE', l_proc);
140       fnd_message.set_token('STEP','10');
141       fnd_message.raise_error;
142     End If;
143     Close C_Sel1;
144     --
145     -- Set the AOL updated WHO values
146     --
147     l_last_update_date   := sysdate;
148     l_last_updated_by    := fnd_global.user_id;
149     l_last_update_login  := fnd_global.login_id;
150   End If;
151   --
152   --
153   --
154   -- Insert the row into: pqh_accommodations_f
155   --
156   insert into pqh_accommodations_f
157       (accommodation_id
158       ,accommodation_name
159       ,effective_start_date
160       ,effective_end_date
161       ,business_group_id
162       ,location_id
163       ,accommodation_desc
164       ,accommodation_type
165       ,style
166       ,address_line_1
167       ,address_line_2
168       ,address_line_3
169       ,town_or_city
170       ,country
171       ,postal_code
172       ,region_1
173       ,region_2
174       ,region_3
175       ,telephone_number_1
176       ,telephone_number_2
177       ,telephone_number_3
178       ,floor_number
179       ,floor_area
180       ,floor_area_measure_unit
181       ,main_rooms
182       ,family_size
183       ,suitability_disabled
184       ,rental_value
185       ,rental_value_currency
186       ,owner
187       ,comments
188       ,information_category
189       ,information1
190       ,information2
191       ,information3
192       ,information4
193       ,information5
194       ,information6
195       ,information7
196       ,information8
197       ,information9
198       ,information10
199       ,information11
200       ,information12
201       ,information13
202       ,information14
203       ,information15
204       ,information16
205       ,information17
206       ,information18
207       ,information19
208       ,information20
209       ,information21
210       ,information22
211       ,information23
212       ,information24
213       ,information25
214       ,information26
215       ,information27
216       ,information28
217       ,information29
218       ,information30
219       ,attribute_category
220       ,attribute1
221       ,attribute2
222       ,attribute3
223       ,attribute4
224       ,attribute5
225       ,attribute6
226       ,attribute7
227       ,attribute8
228       ,attribute9
229       ,attribute10
230       ,attribute11
231       ,attribute12
232       ,attribute13
233       ,attribute14
234       ,attribute15
235       ,attribute16
236       ,attribute17
237       ,attribute18
238       ,attribute19
239       ,attribute20
240       ,attribute21
241       ,attribute22
242       ,attribute23
243       ,attribute24
244       ,attribute25
245       ,attribute26
246       ,attribute27
247       ,attribute28
248       ,attribute29
249       ,attribute30
250       ,object_version_number
251       ,created_by
252       ,creation_date
253       ,last_update_date
254       ,last_updated_by
255       ,last_update_login
256       )
257   Values
258     (p_rec.accommodation_id
259     ,p_rec.accommodation_name
260     ,p_rec.effective_start_date
261     ,p_rec.effective_end_date
262     ,p_rec.business_group_id
263     ,p_rec.location_id
264     ,p_rec.accommodation_desc
265     ,p_rec.accommodation_type
266     ,p_rec.style
267     ,p_rec.address_line_1
268     ,p_rec.address_line_2
269     ,p_rec.address_line_3
270     ,p_rec.town_or_city
271     ,p_rec.country
272     ,p_rec.postal_code
273     ,p_rec.region_1
274     ,p_rec.region_2
275     ,p_rec.region_3
276     ,p_rec.telephone_number_1
277     ,p_rec.telephone_number_2
278     ,p_rec.telephone_number_3
279     ,p_rec.floor_number
280     ,p_rec.floor_area
281     ,p_rec.floor_area_measure_unit
282     ,p_rec.main_rooms
283     ,p_rec.family_size
284     ,p_rec.suitability_disabled
285     ,p_rec.rental_value
286     ,p_rec.rental_value_currency
287     ,p_rec.owner
288     ,p_rec.comments
289     ,p_rec.information_category
290     ,p_rec.information1
291     ,p_rec.information2
292     ,p_rec.information3
293     ,p_rec.information4
294     ,p_rec.information5
295     ,p_rec.information6
296     ,p_rec.information7
297     ,p_rec.information8
298     ,p_rec.information9
299     ,p_rec.information10
300     ,p_rec.information11
301     ,p_rec.information12
302     ,p_rec.information13
303     ,p_rec.information14
304     ,p_rec.information15
305     ,p_rec.information16
306     ,p_rec.information17
307     ,p_rec.information18
308     ,p_rec.information19
309     ,p_rec.information20
310     ,p_rec.information21
311     ,p_rec.information22
312     ,p_rec.information23
313     ,p_rec.information24
314     ,p_rec.information25
315     ,p_rec.information26
316     ,p_rec.information27
317     ,p_rec.information28
318     ,p_rec.information29
319     ,p_rec.information30
320     ,p_rec.attribute_category
321     ,p_rec.attribute1
322     ,p_rec.attribute2
323     ,p_rec.attribute3
324     ,p_rec.attribute4
325     ,p_rec.attribute5
326     ,p_rec.attribute6
327     ,p_rec.attribute7
328     ,p_rec.attribute8
329     ,p_rec.attribute9
330     ,p_rec.attribute10
331     ,p_rec.attribute11
332     ,p_rec.attribute12
333     ,p_rec.attribute13
334     ,p_rec.attribute14
335     ,p_rec.attribute15
336     ,p_rec.attribute16
337     ,p_rec.attribute17
338     ,p_rec.attribute18
339     ,p_rec.attribute19
340     ,p_rec.attribute20
341     ,p_rec.attribute21
342     ,p_rec.attribute22
343     ,p_rec.attribute23
344     ,p_rec.attribute24
345     ,p_rec.attribute25
346     ,p_rec.attribute26
347     ,p_rec.attribute27
348     ,p_rec.attribute28
349     ,p_rec.attribute29
350     ,p_rec.attribute30
351     ,p_rec.object_version_number
352     ,l_created_by
353     ,l_creation_date
354     ,l_last_update_date
355     ,l_last_updated_by
356     ,l_last_update_login
357     );
358   --
359   --
360   hr_utility.set_location(' Leaving:'||l_proc, 15);
361 --
362 Exception
363   When hr_api.check_integrity_violated Then
364     -- A check constraint has been violated
365     --
366     pqh_acc_shd.constraint_error
367       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
368   When hr_api.unique_integrity_violated Then
369     -- Unique integrity has been violated
370     --
371     pqh_acc_shd.constraint_error
372       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
373   When Others Then
374     --
375     Raise;
376 End dt_insert_dml;
377 --
378 -- ----------------------------------------------------------------------------
379 -- |------------------------------< insert_dml >------------------------------|
380 -- ----------------------------------------------------------------------------
381 Procedure insert_dml
382   (p_rec                   in out nocopy pqh_acc_shd.g_rec_type
383   ,p_effective_date        in date
384   ,p_datetrack_mode        in varchar2
385   ,p_validation_start_date in date
386   ,p_validation_end_date   in date
387   ) is
388 --
389   l_proc        varchar2(72) := g_package||'insert_dml';
390 --
391 Begin
392   hr_utility.set_location('Entering:'||l_proc, 5);
393   --
394   pqh_acc_ins.dt_insert_dml
395     (p_rec                   => p_rec
396     ,p_effective_date        => p_effective_date
397     ,p_datetrack_mode        => p_datetrack_mode
398     ,p_validation_start_date => p_validation_start_date
399     ,p_validation_end_date   => p_validation_end_date
400     );
401   --
402   hr_utility.set_location(' Leaving:'||l_proc, 10);
403 End insert_dml;
404 --
405 -- ----------------------------------------------------------------------------
406 -- |------------------------------< pre_insert >------------------------------|
407 -- ----------------------------------------------------------------------------
408 -- {Start Of Comments}
409 --
410 -- Description:
411 --   This private procedure contains any processing which is required before
412 --   the insert dml. Presently, if the entity has a corresponding primary
413 --   key which is maintained by an associating sequence, the primary key for
414 --   the entity will be populated with the next sequence value in
415 --   preparation for the insert dml.
416 --   Also, if comments are defined for this entity, the comments insert
417 --   logic will also be called, generating a comment_id if required.
418 --
419 -- Prerequisites:
420 --   This is an internal procedure which is called from the ins procedure.
421 --
422 -- In Parameters:
423 --   A Pl/Sql record structure.
424 --
425 -- Post Success:
426 --   Processing continues.
427 --
428 -- Post Failure:
429 --   If an error has occurred, an error message and exception will be raised
430 --   but not handled.
431 --
432 -- Developer Implementation Notes:
433 --   Any pre-processing required before the insert dml is issued should be
434 --   coded within this procedure. As stated above, a good example is the
435 --   generation of a primary key number via a corresponding sequence.
436 --   It is important to note that any 3rd party maintenance should be reviewed
437 --   before placing in this procedure.
438 --
439 -- Access Status:
440 --   Internal Row Handler Use Only.
441 --
442 -- {End Of Comments}
443 -- ----------------------------------------------------------------------------
444 Procedure pre_insert
445   (p_rec                   in out nocopy pqh_acc_shd.g_rec_type
446   ,p_effective_date        in date
447   ,p_datetrack_mode        in varchar2
448   ,p_validation_start_date in date
449   ,p_validation_end_date   in date
450   ) is
451 --
452   Cursor C_Sel1 is select pqh_accommodations_s.nextval from sys.dual;
453 --
454  Cursor C_Sel2 is
455     Select null
456       from pqh_accommodations_f
457      where accommodation_id =
458              pqh_acc_ins.g_accommodation_id_i;
459 --
460   l_proc        varchar2(72) := g_package||'pre_insert';
461   l_exists      varchar2(1);
462 --
463 Begin
464   hr_utility.set_location('Entering:'||l_proc, 5);
465   --
466     If (pqh_acc_ins.g_accommodation_id_i is not null) Then
467     --
468     -- Verify registered primary key values not already in use
469     --
470     Open C_Sel2;
471     Fetch C_Sel2 into l_exists;
472     If C_Sel2%found Then
473        Close C_Sel2;
474        --
475        -- The primary key values are already in use.
476        --
477        fnd_message.set_name('PER','PER_289391_KEY_ALREADY_USED');
478        fnd_message.set_token('TABLE_NAME','pqh_accommodations_f');
479        fnd_message.raise_error;
480     End If;
481     Close C_Sel2;
482     --
483     -- Use registered key values and clear globals
484     --
485     p_rec.accommodation_id :=
486       pqh_acc_ins.g_accommodation_id_i;
487     pqh_acc_ins.g_accommodation_id_i := null;
488   Else
489     --
490     -- No registerd key values, so select the next sequence number
491     --
492     --
493     -- Select the next sequence number
494     --
495     Open C_Sel1;
496     Fetch C_Sel1 Into p_rec.accommodation_id;
497     Close C_Sel1;
498   End If;
499   --
500   --
501   hr_utility.set_location(' Leaving:'||l_proc, 10);
502 End pre_insert;
503 --
504 -- ----------------------------------------------------------------------------
505 -- |----------------------------< post_insert >-------------------------------|
506 -- ----------------------------------------------------------------------------
507 -- {Start Of Comments}
508 --
509 -- Description:
510 --   This private procedure contains any processing which is required after
511 --   the insert dml.
512 --
513 -- Prerequisites:
514 --   This is an internal procedure which is called from the ins procedure.
515 --
516 -- In Parameters:
517 --   A Pl/Sql record structure.
518 --
519 -- Post Success:
520 --   Processing continues.
521 --
522 -- Post Failure:
523 --   If an error has occurred, an error message and exception will be raised
524 --   but not handled.
525 --
526 -- Developer Implementation Notes:
527 --   Any post-processing required after the insert dml is issued should be
528 --   coded within this procedure. It is important to note that any 3rd party
529 --   maintenance should be reviewed before placing in this procedure.
530 --
531 -- Access Status:
532 --   Internal Row Handler Use Only.
533 --
534 -- {End Of Comments}
535 -- ----------------------------------------------------------------------------
536 Procedure post_insert
537   (p_rec                   in pqh_acc_shd.g_rec_type
538   ,p_effective_date        in date
539   ,p_datetrack_mode        in varchar2
540   ,p_validation_start_date in date
541   ,p_validation_end_date   in date
542   ) is
543 --
544   l_proc        varchar2(72) := g_package||'post_insert';
545 --
546 Begin
547   hr_utility.set_location('Entering:'||l_proc, 5);
548   begin
549     --
550     pqh_acc_rki.after_insert
551       (p_effective_date
552       => p_effective_date
553       ,p_validation_start_date
554       => p_validation_start_date
555       ,p_validation_end_date
556       => p_validation_end_date
557       ,p_accommodation_id
558       => p_rec.accommodation_id
559       ,p_accommodation_name
560       => p_rec.accommodation_name
561       ,p_effective_start_date
562       => p_rec.effective_start_date
563       ,p_effective_end_date
564       => p_rec.effective_end_date
565       ,p_business_group_id
566       => p_rec.business_group_id
567       ,p_location_id
568       => p_rec.location_id
569       ,p_accommodation_desc
570       => p_rec.accommodation_desc
571       ,p_accommodation_type
572       => p_rec.accommodation_type
573       ,p_style
574       => p_rec.style
575       ,p_address_line_1
576       => p_rec.address_line_1
577       ,p_address_line_2
578       => p_rec.address_line_2
579       ,p_address_line_3
580       => p_rec.address_line_3
581       ,p_town_or_city
582       => p_rec.town_or_city
583       ,p_country
584       => p_rec.country
585       ,p_postal_code
586       => p_rec.postal_code
587       ,p_region_1
588       => p_rec.region_1
589       ,p_region_2
590       => p_rec.region_2
591       ,p_region_3
592       => p_rec.region_3
593       ,p_telephone_number_1
594       => p_rec.telephone_number_1
595       ,p_telephone_number_2
596       => p_rec.telephone_number_2
597       ,p_telephone_number_3
598       => p_rec.telephone_number_3
599       ,p_floor_number
600       => p_rec.floor_number
601       ,p_floor_area
602       => p_rec.floor_area
603       ,p_floor_area_measure_unit
604       => p_rec.floor_area_measure_unit
605       ,p_main_rooms
606       => p_rec.main_rooms
607       ,p_family_size
608       => p_rec.family_size
609       ,p_suitability_disabled
610       => p_rec.suitability_disabled
611       ,p_rental_value
612       => p_rec.rental_value
613       ,p_rental_value_currency
614       => p_rec.rental_value_currency
615       ,p_owner
616       => p_rec.owner
617       ,p_comments
618       => p_rec.comments
619       ,p_information_category
620       => p_rec.information_category
621       ,p_information1
622       => p_rec.information1
623       ,p_information2
624       => p_rec.information2
625       ,p_information3
626       => p_rec.information3
627       ,p_information4
628       => p_rec.information4
629       ,p_information5
630       => p_rec.information5
631       ,p_information6
632       => p_rec.information6
633       ,p_information7
634       => p_rec.information7
635       ,p_information8
636       => p_rec.information8
637       ,p_information9
638       => p_rec.information9
639       ,p_information10
640       => p_rec.information10
641       ,p_information11
642       => p_rec.information11
643       ,p_information12
644       => p_rec.information12
645       ,p_information13
646       => p_rec.information13
647       ,p_information14
648       => p_rec.information14
649       ,p_information15
650       => p_rec.information15
651       ,p_information16
652       => p_rec.information16
653       ,p_information17
654       => p_rec.information17
655       ,p_information18
656       => p_rec.information18
657       ,p_information19
658       => p_rec.information19
659       ,p_information20
660       => p_rec.information20
661       ,p_information21
662       => p_rec.information21
663       ,p_information22
664       => p_rec.information22
665       ,p_information23
666       => p_rec.information23
667       ,p_information24
668       => p_rec.information24
669       ,p_information25
670       => p_rec.information25
671       ,p_information26
672       => p_rec.information26
673       ,p_information27
674       => p_rec.information27
675       ,p_information28
676       => p_rec.information28
677       ,p_information29
678       => p_rec.information29
679       ,p_information30
680       => p_rec.information30
681       ,p_attribute_category
682       => p_rec.attribute_category
683       ,p_attribute1
684       => p_rec.attribute1
685       ,p_attribute2
686       => p_rec.attribute2
687       ,p_attribute3
688       => p_rec.attribute3
689       ,p_attribute4
690       => p_rec.attribute4
691       ,p_attribute5
692       => p_rec.attribute5
693       ,p_attribute6
694       => p_rec.attribute6
695       ,p_attribute7
696       => p_rec.attribute7
697       ,p_attribute8
698       => p_rec.attribute8
699       ,p_attribute9
700       => p_rec.attribute9
701       ,p_attribute10
702       => p_rec.attribute10
703       ,p_attribute11
704       => p_rec.attribute11
705       ,p_attribute12
706       => p_rec.attribute12
707       ,p_attribute13
708       => p_rec.attribute13
709       ,p_attribute14
710       => p_rec.attribute14
711       ,p_attribute15
712       => p_rec.attribute15
713       ,p_attribute16
714       => p_rec.attribute16
715       ,p_attribute17
716       => p_rec.attribute17
717       ,p_attribute18
718       => p_rec.attribute18
719       ,p_attribute19
720       => p_rec.attribute19
721       ,p_attribute20
722       => p_rec.attribute20
723       ,p_attribute21
724       => p_rec.attribute21
725       ,p_attribute22
726       => p_rec.attribute22
727       ,p_attribute23
728       => p_rec.attribute23
729       ,p_attribute24
730       => p_rec.attribute24
731       ,p_attribute25
732       => p_rec.attribute25
733       ,p_attribute26
734       => p_rec.attribute26
735       ,p_attribute27
736       => p_rec.attribute27
737       ,p_attribute28
738       => p_rec.attribute28
739       ,p_attribute29
740       => p_rec.attribute29
741       ,p_attribute30
742       => p_rec.attribute30
743       ,p_object_version_number
744       => p_rec.object_version_number
745       );
746     --
747   exception
748     --
749     when hr_api.cannot_find_prog_unit then
750       --
751       hr_api.cannot_find_prog_unit_error
752         (p_module_name => 'PQH_ACCOMMODATIONS_F'
753         ,p_hook_type   => 'AI');
754       --
755   end;
756   --
757   hr_utility.set_location(' Leaving:'||l_proc, 10);
758 End post_insert;
759 --
760 -- ----------------------------------------------------------------------------
761 -- |-------------------------------< ins_lck >--------------------------------|
762 -- ----------------------------------------------------------------------------
763 -- {Start Of Comments}
764 --
765 -- Description:
766 --   The ins_lck process has one main function to perform. When inserting
767 --   a datetracked row, we must validate the DT mode.
768 --
769 -- Prerequisites:
770 --   This procedure can only be called for the datetrack mode of INSERT.
771 --
772 -- In Parameters:
773 --
774 -- Post Success:
775 --   On successful completion of the ins_lck process the parental
776 --   datetracked rows will be locked providing the p_enforce_foreign_locking
777 --   argument value is TRUE.
778 --   If the p_enforce_foreign_locking argument value is FALSE then the
779 --   parential rows are not locked.
780 --
781 -- Post Failure:
782 --   The Lck process can fail for:
783 --   1) When attempting to lock the row the row could already be locked by
784 --      another user. This will raise the HR_Api.Object_Locked exception.
785 --   2) When attempting to the lock the parent which doesn't exist.
786 --      For the entity to be locked the parent must exist!
787 --
788 -- Developer Implementation Notes:
789 --   None.
790 --
791 -- Access Status:
792 --   Internal Row Handler Use Only.
793 --
794 -- {End Of Comments}
795 -- ----------------------------------------------------------------------------
796 Procedure ins_lck
797   (p_effective_date        in date
798   ,p_datetrack_mode        in varchar2
799   ,p_rec                   in pqh_acc_shd.g_rec_type
800   ,p_validation_start_date out nocopy date
801   ,p_validation_end_date   out nocopy date
802   ) is
803 --
804   l_proc                  varchar2(72) := g_package||'ins_lck';
805   l_validation_start_date date;
806   l_validation_end_date   date;
807 --
808 Begin
809   hr_utility.set_location('Entering:'||l_proc, 5);
810   --
811   -- Validate the datetrack mode mode getting the validation start
812   -- and end dates for the specified datetrack operation.
813   --
814   dt_api.validate_dt_mode
815     (p_effective_date          => p_effective_date
816     ,p_datetrack_mode          => p_datetrack_mode
817     ,p_base_table_name         => 'pqh_accommodations_f'
818     ,p_base_key_column         => 'accommodation_id'
819     ,p_base_key_value          => p_rec.accommodation_id
820     ,p_enforce_foreign_locking => true
821     ,p_validation_start_date   => l_validation_start_date
822     ,p_validation_end_date     => l_validation_end_date
823     );
824   --
825   -- Set the validation start and end date OUT arguments
826   --
827   p_validation_start_date := l_validation_start_date;
828   p_validation_end_date   := l_validation_end_date;
829   --
830   hr_utility.set_location(' Leaving:'||l_proc, 10);
831   --
832 End ins_lck;
833 --
834 -- ----------------------------------------------------------------------------
835 -- |---------------------------------< ins >----------------------------------|
836 -- ----------------------------------------------------------------------------
837 Procedure ins
838   (p_effective_date in     date
839   ,p_rec            in out nocopy pqh_acc_shd.g_rec_type
840   ) is
841 --
842   l_proc                        varchar2(72) := g_package||'ins';
843   l_datetrack_mode              varchar2(30) := hr_api.g_insert;
844   l_validation_start_date       date;
845   l_validation_end_date         date;
846 --
847 Begin
848   hr_utility.set_location('Entering:'||l_proc, 5);
849   --
850   -- Call the lock operation
851   --
852   pqh_acc_ins.ins_lck
853     (p_effective_date        => p_effective_date
854     ,p_datetrack_mode        => l_datetrack_mode
855     ,p_rec                   => p_rec
856     ,p_validation_start_date => l_validation_start_date
857     ,p_validation_end_date   => l_validation_end_date
858     );
859   --
860   -- Call the supporting insert validate operations
861   --
862   pqh_acc_bus.insert_validate
863     (p_rec                   => p_rec
864     ,p_effective_date        => p_effective_date
865     ,p_datetrack_mode        => l_datetrack_mode
866     ,p_validation_start_date => l_validation_start_date
867     ,p_validation_end_date   => l_validation_end_date
868     );
869   --
870   -- Call to raise any errors on multi-message list
871   hr_multi_message.end_validation_set;
872   --
873   -- Call the supporting pre-insert operation
874   --
875   pqh_acc_ins.pre_insert
876     (p_rec                   => p_rec
877     ,p_effective_date        => p_effective_date
878     ,p_datetrack_mode        => l_datetrack_mode
879     ,p_validation_start_date => l_validation_start_date
880     ,p_validation_end_date   => l_validation_end_date
881     );
882   --
883   -- Insert the row
884   --
885   pqh_acc_ins.insert_dml
886     (p_rec                   => p_rec
887     ,p_effective_date        => p_effective_date
888     ,p_datetrack_mode        => l_datetrack_mode
889     ,p_validation_start_date => l_validation_start_date
890     ,p_validation_end_date   => l_validation_end_date
891     );
892   --
893   -- Call the supporting post-insert operation
894   --
895   pqh_acc_ins.post_insert
896     (p_rec                   => p_rec
897     ,p_effective_date        => p_effective_date
898     ,p_datetrack_mode        => l_datetrack_mode
899     ,p_validation_start_date => l_validation_start_date
900     ,p_validation_end_date   => l_validation_end_date
901     );
902   --
903   -- Call to raise any errors on multi-message list
904   hr_multi_message.end_validation_set;
905   --
906   hr_utility.set_location('Leaving:'||l_proc,10);
907 end ins;
908 --
909 -- ----------------------------------------------------------------------------
910 -- |---------------------------------< ins >----------------------------------|
911 -- ----------------------------------------------------------------------------
912 Procedure ins
913   (p_effective_date                 in     date
914   ,p_accommodation_name             in     varchar2
915   ,p_business_group_id              in     number
916   ,p_location_id                    in     number
917   ,p_accommodation_desc             in     varchar2 default null
918   ,p_accommodation_type             in     varchar2 default null
919   ,p_style                          in     varchar2 default null
920   ,p_address_line_1                 in     varchar2 default null
921   ,p_address_line_2                 in     varchar2 default null
922   ,p_address_line_3                 in     varchar2 default null
923   ,p_town_or_city                   in     varchar2 default null
924   ,p_country                        in     varchar2 default null
925   ,p_postal_code                    in     varchar2 default null
926   ,p_region_1                       in     varchar2 default null
927   ,p_region_2                       in     varchar2 default null
928   ,p_region_3                       in     varchar2 default null
929   ,p_telephone_number_1             in     varchar2 default null
930   ,p_telephone_number_2             in     varchar2 default null
931   ,p_telephone_number_3             in     varchar2 default null
932   ,p_floor_number                   in     varchar2 default null
933   ,p_floor_area                     in     number   default null
934   ,p_floor_area_measure_unit        in     varchar2 default null
935   ,p_main_rooms                     in     number   default null
936   ,p_family_size                    in     number   default null
937   ,p_suitability_disabled           in     varchar2 default null
938   ,p_rental_value                   in     number   default null
939   ,p_rental_value_currency          in     varchar2 default null
940   ,p_owner                          in     varchar2 default null
941   ,p_comments                       in     varchar2 default null
942   ,p_information_category           in     varchar2 default null
943   ,p_information1                   in     varchar2 default null
944   ,p_information2                   in     varchar2 default null
945   ,p_information3                   in     varchar2 default null
946   ,p_information4                   in     varchar2 default null
947   ,p_information5                   in     varchar2 default null
948   ,p_information6                   in     varchar2 default null
949   ,p_information7                   in     varchar2 default null
950   ,p_information8                   in     varchar2 default null
951   ,p_information9                   in     varchar2 default null
952   ,p_information10                  in     varchar2 default null
953   ,p_information11                  in     varchar2 default null
954   ,p_information12                  in     varchar2 default null
955   ,p_information13                  in     varchar2 default null
956   ,p_information14                  in     varchar2 default null
957   ,p_information15                  in     varchar2 default null
958   ,p_information16                  in     varchar2 default null
959   ,p_information17                  in     varchar2 default null
960   ,p_information18                  in     varchar2 default null
961   ,p_information19                  in     varchar2 default null
962   ,p_information20                  in     varchar2 default null
963   ,p_information21                  in     varchar2 default null
964   ,p_information22                  in     varchar2 default null
965   ,p_information23                  in     varchar2 default null
966   ,p_information24                  in     varchar2 default null
967   ,p_information25                  in     varchar2 default null
968   ,p_information26                  in     varchar2 default null
969   ,p_information27                  in     varchar2 default null
970   ,p_information28                  in     varchar2 default null
971   ,p_information29                  in     varchar2 default null
972   ,p_information30                  in     varchar2 default null
973   ,p_attribute_category             in     varchar2 default null
974   ,p_attribute1                     in     varchar2 default null
975   ,p_attribute2                     in     varchar2 default null
976   ,p_attribute3                     in     varchar2 default null
977   ,p_attribute4                     in     varchar2 default null
978   ,p_attribute5                     in     varchar2 default null
979   ,p_attribute6                     in     varchar2 default null
980   ,p_attribute7                     in     varchar2 default null
981   ,p_attribute8                     in     varchar2 default null
982   ,p_attribute9                     in     varchar2 default null
983   ,p_attribute10                    in     varchar2 default null
984   ,p_attribute11                    in     varchar2 default null
985   ,p_attribute12                    in     varchar2 default null
986   ,p_attribute13                    in     varchar2 default null
987   ,p_attribute14                    in     varchar2 default null
988   ,p_attribute15                    in     varchar2 default null
989   ,p_attribute16                    in     varchar2 default null
990   ,p_attribute17                    in     varchar2 default null
991   ,p_attribute18                    in     varchar2 default null
992   ,p_attribute19                    in     varchar2 default null
993   ,p_attribute20                    in     varchar2 default null
994   ,p_attribute21                    in     varchar2 default null
995   ,p_attribute22                    in     varchar2 default null
996   ,p_attribute23                    in     varchar2 default null
997   ,p_attribute24                    in     varchar2 default null
998   ,p_attribute25                    in     varchar2 default null
999   ,p_attribute26                    in     varchar2 default null
1000   ,p_attribute27                    in     varchar2 default null
1001   ,p_attribute28                    in     varchar2 default null
1002   ,p_attribute29                    in     varchar2 default null
1003   ,p_attribute30                    in     varchar2 default null
1004   ,p_accommodation_id                  out nocopy number
1005   ,p_object_version_number             out nocopy number
1006   ,p_effective_start_date              out nocopy date
1007   ,p_effective_end_date                out nocopy date
1008   ) is
1009 --
1010   l_rec         pqh_acc_shd.g_rec_type;
1011   l_proc        varchar2(72) := g_package||'ins';
1012 --
1013 Begin
1014   hr_utility.set_location('Entering:'||l_proc, 5);
1015   --
1016   -- Call conversion function to turn arguments into the
1017   -- p_rec structure.
1018   --
1019   l_rec :=
1020   pqh_acc_shd.convert_args
1021     (null
1022     ,p_accommodation_name
1023     ,null
1024     ,null
1025     ,p_business_group_id
1026     ,p_location_id
1027     ,p_accommodation_desc
1028     ,p_accommodation_type
1029     ,p_style
1030     ,p_address_line_1
1031     ,p_address_line_2
1032     ,p_address_line_3
1033     ,p_town_or_city
1034     ,p_country
1035     ,p_postal_code
1036     ,p_region_1
1037     ,p_region_2
1038     ,p_region_3
1039     ,p_telephone_number_1
1040     ,p_telephone_number_2
1041     ,p_telephone_number_3
1042     ,p_floor_number
1043     ,p_floor_area
1044     ,p_floor_area_measure_unit
1045     ,p_main_rooms
1046     ,p_family_size
1047     ,p_suitability_disabled
1048     ,p_rental_value
1049     ,p_rental_value_currency
1050     ,p_owner
1051     ,p_comments
1052     ,p_information_category
1053     ,p_information1
1054     ,p_information2
1055     ,p_information3
1056     ,p_information4
1057     ,p_information5
1058     ,p_information6
1059     ,p_information7
1060     ,p_information8
1061     ,p_information9
1062     ,p_information10
1063     ,p_information11
1064     ,p_information12
1065     ,p_information13
1066     ,p_information14
1067     ,p_information15
1068     ,p_information16
1069     ,p_information17
1070     ,p_information18
1071     ,p_information19
1072     ,p_information20
1073     ,p_information21
1074     ,p_information22
1075     ,p_information23
1076     ,p_information24
1077     ,p_information25
1078     ,p_information26
1079     ,p_information27
1080     ,p_information28
1081     ,p_information29
1082     ,p_information30
1083     ,p_attribute_category
1084     ,p_attribute1
1085     ,p_attribute2
1086     ,p_attribute3
1087     ,p_attribute4
1088     ,p_attribute5
1089     ,p_attribute6
1090     ,p_attribute7
1091     ,p_attribute8
1092     ,p_attribute9
1093     ,p_attribute10
1094     ,p_attribute11
1095     ,p_attribute12
1096     ,p_attribute13
1097     ,p_attribute14
1098     ,p_attribute15
1099     ,p_attribute16
1100     ,p_attribute17
1101     ,p_attribute18
1102     ,p_attribute19
1103     ,p_attribute20
1104     ,p_attribute21
1105     ,p_attribute22
1106     ,p_attribute23
1107     ,p_attribute24
1108     ,p_attribute25
1109     ,p_attribute26
1110     ,p_attribute27
1111     ,p_attribute28
1112     ,p_attribute29
1113     ,p_attribute30
1114     ,null
1115     );
1116   --
1117   -- Having converted the arguments into the pqh_acc_rec
1118   -- plsql record structure we call the corresponding record
1119   -- business process.
1120   --
1121   pqh_acc_ins.ins
1122     (p_effective_date
1123     ,l_rec
1124     );
1125   --
1126   -- Set the OUT arguments.
1127   --
1128   p_accommodation_id                 := l_rec.accommodation_id;
1129   p_effective_start_date             := l_rec.effective_start_date;
1130   p_effective_end_date               := l_rec.effective_end_date;
1131   p_object_version_number            := l_rec.object_version_number;
1132   --
1133   --
1134   hr_utility.set_location(' Leaving:'||l_proc, 10);
1135 End ins;
1136 --
1137 end pqh_acc_ins;