DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RNG_INS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body pqh_rng_ins as
2 /* $Header: pqrngrhi.pkb 115.18 2004/06/24 16:51:43 srajakum noship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_rng_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 --   2) To insert the row into the schema.
21 --   3) To trap any constraint violations that may have occurred.
22 --   4) To raise any other errors.
23 --
27 --   object_version_number which is initialised within this procedure).
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
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_rng_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_attribute_ranges
57   --
58   insert into pqh_attribute_ranges
59   (	attribute_range_id,
60 	approver_flag,
61 	enable_flag,
62 	delete_flag,
63 	assignment_id,
64 	attribute_id,
65 	from_char,
66 	from_date,
67 	from_number,
68 	position_id,
69 	range_name,
70 	routing_category_id,
71 	routing_list_member_id,
72 	to_char,
73 	to_date,
74 	to_number,
75 	object_version_number
76   )
77   Values
78   (	p_rec.attribute_range_id,
79 	p_rec.approver_flag,
80 	p_rec.enable_flag,
81 	p_rec.delete_flag,
82 	p_rec.assignment_id,
83 	p_rec.attribute_id,
84 	p_rec.from_char,
85 	p_rec.from_date,
86 	p_rec.from_number,
87 	p_rec.position_id,
88 	p_rec.range_name,
89 	p_rec.routing_category_id,
90 	p_rec.routing_list_member_id,
91 	p_rec.to_char,
92 	p_rec.to_date,
93 	p_rec.to_number,
94 	p_rec.object_version_number
95   );
96   --
97   --
98   hr_utility.set_location(' Leaving:'||l_proc, 10);
99 Exception
100   When hr_api.check_integrity_violated Then
101     -- A check constraint has been violated
102     pqh_rng_shd.constraint_error
103       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
104   When hr_api.parent_integrity_violated Then
105     -- Parent integrity has been violated
106     pqh_rng_shd.constraint_error
107       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
108   When hr_api.unique_integrity_violated Then
109     -- Unique integrity has been violated
110     pqh_rng_shd.constraint_error
111       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
112   When Others Then
113     Raise;
114 End insert_dml;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |------------------------------< pre_insert >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 --   This private procedure contains any processing which is required before
123 --   the insert dml. Presently, if the entity has a corresponding primary
124 --   key which is maintained by an associating sequence, the primary key for
125 --   the entity will be populated with the next sequence value in
126 --   preparation for the insert dml.
127 --
128 -- Prerequisites:
129 --   This is an internal procedure which is called from the ins procedure.
130 --
131 -- In Parameters:
132 --   A Pl/Sql record structre.
133 --
134 -- Post Success:
135 --   Processing continues.
136 --
137 -- Post Failure:
138 --   If an error has occurred, an error message and exception will be raised
139 --   but not handled.
140 --
141 -- Developer Implementation Notes:
142 --   Any pre-processing required before the insert dml is issued should be
143 --   coded within this procedure. As stated above, a good example is the
144 --   generation of a primary key number via a corresponding sequence.
145 --   It is important to note that any 3rd party maintenance should be reviewed
146 --   before placing in this procedure.
147 --
148 -- Access Status:
149 --   Internal Row Handler Use Only.
150 --
151 -- {End Of Comments}
152 -- ----------------------------------------------------------------------------
153 Procedure pre_insert(p_rec  in out nocopy pqh_rng_shd.g_rec_type) is
154 --
155   l_proc  varchar2(72) := g_package||'pre_insert';
156 --
157   Cursor C_Sel1 is select pqh_attribute_ranges_s.nextval from sys.dual;
158 --
159 Begin
160   hr_utility.set_location('Entering:'||l_proc, 5);
161   --
162   --
163   -- Select the next sequence number
164   --
165   Open C_Sel1;
166   Fetch C_Sel1 Into p_rec.attribute_range_id;
167   Close C_Sel1;
168   --
169   hr_utility.set_location(' Leaving:'||l_proc, 10);
170 End pre_insert;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |-----------------------------< post_insert >------------------------------|
174 -- ----------------------------------------------------------------------------
175 -- {Start Of Comments}
176 --
177 -- Description:
178 --   This private procedure contains any processing which is required after the
179 --   insert dml.
180 --
181 -- Prerequisites:
182 --   This is an internal procedure which is called from the ins procedure.
186 --
183 --
184 -- In Parameters:
185 --   A Pl/Sql record structre.
187 -- Post Success:
188 --   Processing continues.
189 --
190 -- Post Failure:
191 --   If an error has occurred, an error message and exception will be raised
192 --   but not handled.
193 --
194 -- Developer Implementation Notes:
195 --   Any post-processing required after the insert dml is issued should be
196 --   coded within this procedure. It is important to note that any 3rd party
197 --   maintenance should be reviewed before placing in this procedure.
198 --
199 -- Access Status:
200 --   Internal Row Handler Use Only.
201 --
202 -- {End Of Comments}
203 -- ----------------------------------------------------------------------------
204 Procedure post_insert(
205 p_effective_date in date,p_rec in pqh_rng_shd.g_rec_type) is
206 --
207   l_proc  varchar2(72) := g_package||'post_insert';
208 --
209 Begin
210   hr_utility.set_location('Entering:'||l_proc, 5);
211 --
212   --
213   -- Start of API User Hook for post_insert.
214   --
215   begin
216     --
217     pqh_rng_rki.after_insert
218       (
219   p_attribute_range_id            =>p_rec.attribute_range_id
220  ,p_approver_flag                 =>p_rec.approver_flag
221  ,p_enable_flag                 =>p_rec.enable_flag
222  ,p_delete_flag                 =>p_rec.delete_flag
223  ,p_assignment_id                 =>p_rec.assignment_id
224  ,p_attribute_id                  =>p_rec.attribute_id
225  ,p_from_char                     =>p_rec.from_char
226  ,p_from_date                     =>p_rec.from_date
227  ,p_from_number                   =>p_rec.from_number
228  ,p_position_id                   =>p_rec.position_id
229  ,p_range_name                    =>p_rec.range_name
230  ,p_routing_category_id           =>p_rec.routing_category_id
231  ,p_routing_list_member_id        =>p_rec.routing_list_member_id
232  ,p_to_char                       =>p_rec.to_char
233  ,p_to_date                       =>p_rec.to_date
234  ,p_to_number                     =>p_rec.to_number
235  ,p_object_version_number         =>p_rec.object_version_number
236  ,p_effective_date                =>p_effective_date
237       );
238     --
239   exception
240     --
241     when hr_api.cannot_find_prog_unit then
242       --
243       hr_api.cannot_find_prog_unit_error
244         (p_module_name => 'pqh_attribute_ranges'
245         ,p_hook_type   => 'AI');
246       --
247   end;
248   --
249   -- End of API User Hook for post_insert.
250   --
251   --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253 End post_insert;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |---------------------------------< ins >----------------------------------|
257 -- ----------------------------------------------------------------------------
258 Procedure ins
259   (
260   p_effective_date in date,
261   p_rec        in out nocopy pqh_rng_shd.g_rec_type
262   ) is
263 --
264   l_proc  varchar2(72) := g_package||'ins';
265 --
266 Begin
267   hr_utility.set_location('Entering:'||l_proc, 5);
268   --
269   -- Call the supporting insert validate operations
270   --
271   pqh_rng_bus.insert_validate(p_rec
272   ,p_effective_date);
273   --
274   -- Call the supporting pre-insert operation
275   --
276   pre_insert(p_rec);
277   --
278   -- Insert the row
279   --
280   insert_dml(p_rec);
281   --
282   -- Call the supporting post-insert operation
283   --
284   post_insert(
285 p_effective_date,p_rec);
286 end ins;
287 --
288 -- ----------------------------------------------------------------------------
289 -- |---------------------------------< ins >----------------------------------|
290 -- ----------------------------------------------------------------------------
291 Procedure ins
292   (
293   p_effective_date in date,
294   p_attribute_range_id           out nocopy number,
295   p_approver_flag                in varchar2         default null,
296   p_enable_flag                  in varchar2         default 'Y',
297   p_delete_flag                  in varchar2         default null,
298   p_assignment_id                in number           default null,
299   p_attribute_id                 in number           default null,
300   p_from_char                    in varchar2         default null,
301   p_from_date                    in date             default null,
302   p_from_number                  in number           default null,
303   p_position_id                  in number           default null,
304   p_range_name                   in varchar2,
305   p_routing_category_id          in number,
306   p_routing_list_member_id       in number           default null,
307   p_to_char                      in varchar2         default null,
308   p_to_date                      in date             default null,
309   p_to_number                    in number           default null,
310   p_object_version_number        out nocopy number
311   ) is
312 --
313   l_rec	  pqh_rng_shd.g_rec_type;
314   l_proc  varchar2(72) := g_package||'ins';
315 --
316 Begin
317   hr_utility.set_location('Entering:'||l_proc, 5);
318   --
319   -- Call conversion function to turn arguments into the
320   -- p_rec structure.
321   --
322   l_rec :=
323   pqh_rng_shd.convert_args
324   (
325   null,
326   p_approver_flag,
327   p_enable_flag,
328   p_delete_flag,
329   p_assignment_id,
330   p_attribute_id,
331   p_from_char,
332   p_from_date,
333   p_from_number,
334   p_position_id,
335   p_range_name,
336   p_routing_category_id,
337   p_routing_list_member_id,
338   p_to_char,
339   p_to_date,
340   p_to_number,
341   null
342   );
343   --
344   -- Having converted the arguments into the pqh_rng_rec
345   -- plsql record structure we call the corresponding record business process.
346   --
347   ins(
348     p_effective_date,l_rec);
349   --
350   -- As the primary key argument(s)
351   -- are specified as an OUT's we must set these values.
352   --
353   p_attribute_range_id := l_rec.attribute_range_id;
354   p_object_version_number := l_rec.object_version_number;
355   --
356   hr_utility.set_location(' Leaving:'||l_proc, 10);
357 End ins;
358 --
359 end pqh_rng_ins;