DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_PTI_INS

Source


1 Package Body pqh_pti_ins as
2 /* $Header: pqptirhi.pkb 120.2 2005/10/12 20:18:49 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_pti_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic. The processing of
17 --   this procedure are as follows:
18 --   1) Initialise the object_version_number to 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   3) To insert the row into the schema.
21 --   4) To trap any constraint violations that may have occurred.
22 --   5) To raise any other errors.
23 --
24 -- Prerequisites:
25 --   This is an internal private procedure which must be called from the ins
26 --   procedure and must have all mandatory attributes set (except the
27 --   object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 --   If a check, unique or parent integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 --   None.
41 --
42 -- Access Status:
43 --   Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy pqh_pti_shd.g_rec_type) is
48 --
49   l_proc  varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   p_rec.object_version_number := 1;  -- Initialise the object version
54   --
55   --
56   -- Insert the row into: pqh_ptx_info_types
57   --
58   insert into pqh_ptx_info_types
59   (	information_type,
60 	active_inactive_flag,
61 	description,
62 	multiple_occurences_flag,
63 	legislation_code,
64 	object_version_number
65   )
66   Values
67   (	p_rec.information_type,
68 	p_rec.active_inactive_flag,
69 	p_rec.description,
70 	p_rec.multiple_occurences_flag,
71 	p_rec.legislation_code,
72 	p_rec.object_version_number
73   );
74   --
75   --
76   hr_utility.set_location(' Leaving:'||l_proc, 10);
77 Exception
78   When hr_api.check_integrity_violated Then
79     -- A check constraint has been violated
80     pqh_pti_shd.constraint_error
81       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
82   When hr_api.parent_integrity_violated Then
83     -- Parent integrity has been violated
84     pqh_pti_shd.constraint_error
85       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
86   When hr_api.unique_integrity_violated Then
87     -- Unique integrity has been violated
88     pqh_pti_shd.constraint_error
89       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
90   When Others Then
91     Raise;
92 End insert_dml;
93 --
94 -- ----------------------------------------------------------------------------
95 -- |------------------------------< pre_insert >------------------------------|
96 -- ----------------------------------------------------------------------------
97 -- {Start Of Comments}
98 --
99 -- Description:
100 --   This private procedure contains any processing which is required before
101 --   the insert dml. Presently, if the entity has a corresponding primary
102 --   key which is maintained by an associating sequence, the primary key for
103 --   the entity will be populated with the next sequence value in
104 --   preparation for the insert dml.
105 --
106 -- Prerequisites:
107 --   This is an internal procedure which is called from the ins procedure.
108 --
109 -- In Parameters:
110 --   A Pl/Sql record structre.
111 --
112 -- Post Success:
113 --   Processing continues.
114 --
115 -- Post Failure:
116 --   If an error has occurred, an error message and exception will be raised
117 --   but not handled.
118 --
119 -- Developer Implementation Notes:
120 --   Any pre-processing required before the insert dml is issued should be
121 --   coded within this procedure. As stated above, a good example is the
122 --   generation of a primary key number via a corresponding sequence.
123 --   It is important to note that any 3rd party maintenance should be reviewed
124 --   before placing in this procedure.
125 --
126 -- Access Status:
127 --   Internal Row Handler Use Only.
128 --
129 -- {End Of Comments}
130 -- ----------------------------------------------------------------------------
131 Procedure pre_insert(p_rec  in out nocopy pqh_pti_shd.g_rec_type) is
132 --
133   l_proc  varchar2(72) := g_package||'pre_insert';
134 --
135 --
136 --
137 Begin
138   hr_utility.set_location('Entering:'||l_proc, 5);
139   --
140   --
141   --
142   hr_utility.set_location(' Leaving:'||l_proc, 10);
143 End pre_insert;
144 --
145 -- ----------------------------------------------------------------------------
146 -- |-----------------------------< post_insert >------------------------------|
147 -- ----------------------------------------------------------------------------
148 -- {Start Of Comments}
149 --
150 -- Description:
151 --   This private procedure contains any processing which is required after the
152 --   insert dml.
153 --
154 -- Prerequisites:
155 --   This is an internal procedure which is called from the ins procedure.
156 --
157 -- In Parameters:
158 --   A Pl/Sql record structre.
159 --
160 -- Post Success:
161 --   Processing continues.
162 --
163 -- Post Failure:
164 --   If an error has occurred, an error message and exception will be raised
165 --   but not handled.
166 --
167 -- Developer Implementation Notes:
168 --   Any post-processing required after the insert dml is issued should be
169 --   coded within this procedure. It is important to note that any 3rd party
170 --   maintenance should be reviewed before placing in this procedure.
171 --
172 -- Access Status:
173 --   Internal Row Handler Use Only.
174 --
175 -- {End Of Comments}
176 -- ----------------------------------------------------------------------------
177 Procedure post_insert(
178 p_effective_date in date,p_rec in pqh_pti_shd.g_rec_type) is
179 --
180   l_proc  varchar2(72) := g_package||'post_insert';
181 --
182 Begin
183   hr_utility.set_location('Entering:'||l_proc, 5);
184 --
185   --
186   -- Start of API User Hook for post_insert.
187   --
188   begin
189     --
190     pqh_pti_rki.after_insert
191       (
192   p_information_type              =>p_rec.information_type
193  ,p_active_inactive_flag          =>p_rec.active_inactive_flag
194  ,p_description                   =>p_rec.description
195  ,p_multiple_occurences_flag      =>p_rec.multiple_occurences_flag
196  ,p_legislation_code              =>p_rec.legislation_code
197  ,p_object_version_number         =>p_rec.object_version_number
198  ,p_effective_date                =>p_effective_date
199       );
200     --
201   exception
202     --
203     when hr_api.cannot_find_prog_unit then
204       --
205       hr_api.cannot_find_prog_unit_error
206         (p_module_name => 'pqh_ptx_info_types'
207         ,p_hook_type   => 'AI');
208       --
209   end;
210   --
211   -- End of API User Hook for post_insert.
212   --
213   --
214   hr_utility.set_location(' Leaving:'||l_proc, 10);
215 End post_insert;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |---------------------------------< ins >----------------------------------|
219 -- ----------------------------------------------------------------------------
220 Procedure ins
221   (
222   p_effective_date in date,
223   p_rec        in out nocopy pqh_pti_shd.g_rec_type
224   ) is
225 --
226   l_proc  varchar2(72) := g_package||'ins';
227 --
228 Begin
229   hr_utility.set_location('Entering:'||l_proc, 5);
230   --
231   -- Call the supporting insert validate operations
232   --
233   pqh_pti_bus.insert_validate(p_rec
234   ,p_effective_date);
235   --
236   -- Call the supporting pre-insert operation
237   --
238   pre_insert(p_rec);
239   --
240   -- Insert the row
241   --
242   insert_dml(p_rec);
243   --
244   -- Call the supporting post-insert operation
245   --
246   post_insert(
247 p_effective_date,p_rec);
248 end ins;
249 --
250 -- ----------------------------------------------------------------------------
251 -- |---------------------------------< ins >----------------------------------|
252 -- ----------------------------------------------------------------------------
253 Procedure ins
254   (
255   p_effective_date in date,
256   p_information_type             out nocopy varchar2,
257   p_active_inactive_flag         in varchar2,
258   p_description                  in varchar2         default null,
259   p_multiple_occurences_flag     in varchar2,
260   p_legislation_code             in varchar2         default null,
261   p_object_version_number        out nocopy number
262   ) is
263 --
264   l_rec	  pqh_pti_shd.g_rec_type;
265   l_proc  varchar2(72) := g_package||'ins';
266 --
267 Begin
268   hr_utility.set_location('Entering:'||l_proc, 5);
269   --
270   -- Call conversion function to turn arguments into the
271   -- p_rec structure.
272   --
273   l_rec :=
274   pqh_pti_shd.convert_args
275   (
276   null,
277   p_active_inactive_flag,
278   p_description,
279   p_multiple_occurences_flag,
280   p_legislation_code,
281   null
282   );
283   --
284   -- Having converted the arguments into the pqh_pti_rec
285   -- plsql record structure we call the corresponding record business process.
286   --
287   ins(
288     p_effective_date,l_rec);
289   --
290   -- As the primary key argument(s)
291   -- are specified as an OUT's we must set these values.
292   --
293   p_information_type := l_rec.information_type;
294   p_object_version_number := l_rec.object_version_number;
295   --
296   hr_utility.set_location(' Leaving:'||l_proc, 10);
297 End ins;
298 --
299 end pqh_pti_ins;