[Home] [Help]
PACKAGE BODY: APPS.PQH_CEA_INS
Source
1 Package Body pqh_cea_ins as
2 /* $Header: pqcearhi.pkb 115.5 2003/09/28 21:33:49 scnair ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_cea_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 --
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_cea_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 -- Insert the row into: pqh_copy_entity_attribs
56 --
57 insert into pqh_copy_entity_attribs
58 ( copy_entity_attrib_id,
59 copy_entity_txn_id,
60 row_type_cd,
61 information_category,
62 information1,
63 information2,
64 information3,
65 information4,
66 information5,
67 information6,
68 information7,
69 information8,
70 information9,
71 information10,
72 information11,
73 information12,
74 information13,
75 information14,
76 information15,
77 information16,
78 information17,
79 information18,
80 information19,
81 information20,
82 information21,
83 information22,
84 information23,
85 information24,
86 information25,
87 information26,
88 information27,
89 information28,
90 information29,
91 information30,
92 check_information1,
93 check_information2,
94 check_information3,
95 object_version_number
96 )
97 Values
98 ( p_rec.copy_entity_attrib_id,
99 p_rec.copy_entity_txn_id,
100 p_rec.row_type_cd,
101 p_rec.information_category,
102 p_rec.information1,
103 p_rec.information2,
104 p_rec.information3,
105 p_rec.information4,
106 p_rec.information5,
107 p_rec.information6,
108 p_rec.information7,
109 p_rec.information8,
110 p_rec.information9,
111 p_rec.information10,
112 p_rec.information11,
113 p_rec.information12,
114 p_rec.information13,
115 p_rec.information14,
116 p_rec.information15,
117 p_rec.information16,
118 p_rec.information17,
119 p_rec.information18,
120 p_rec.information19,
121 p_rec.information20,
122 p_rec.information21,
123 p_rec.information22,
124 p_rec.information23,
125 p_rec.information24,
126 p_rec.information25,
127 p_rec.information26,
128 p_rec.information27,
129 p_rec.information28,
130 p_rec.information29,
131 p_rec.information30,
132 p_rec.check_information1,
133 p_rec.check_information2,
134 p_rec.check_information3,
135 p_rec.object_version_number
136 );
137 --
138 hr_utility.set_location(' Leaving:'||l_proc, 10);
139 Exception
140 When hr_api.check_integrity_violated Then
141 -- A check constraint has been violated
142 pqh_cea_shd.constraint_error
143 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
144 When hr_api.parent_integrity_violated Then
145 -- Parent integrity has been violated
146 pqh_cea_shd.constraint_error
147 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
148 When hr_api.unique_integrity_violated Then
149 -- Unique integrity has been violated
150 pqh_cea_shd.constraint_error
151 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
152 When Others Then
153 Raise;
154 End insert_dml;
155 --
156 -- ----------------------------------------------------------------------------
157 -- |------------------------------< pre_insert >------------------------------|
158 -- ----------------------------------------------------------------------------
159 -- {Start Of Comments}
160 --
161 -- Description:
162 -- This private procedure contains any processing which is required before
163 -- the insert dml. Presently, if the entity has a corresponding primary
164 -- key which is maintained by an associating sequence, the primary key for
165 -- the entity will be populated with the next sequence value in
166 -- preparation for the insert dml.
167 --
168 -- Prerequisites:
169 -- This is an internal procedure which is called from the ins procedure.
170 --
171 -- In Parameters:
172 -- A Pl/Sql record structre.
173 --
174 -- Post Success:
175 -- Processing continues.
176 --
177 -- Post Failure:
178 -- If an error has occurred, an error message and exception will be raised
179 -- but not handled.
180 --
181 -- Developer Implementation Notes:
182 -- Any pre-processing required before the insert dml is issued should be
183 -- coded within this procedure. As stated above, a good example is the
184 -- generation of a primary key number via a corresponding sequence.
185 -- It is important to note that any 3rd party maintenance should be reviewed
186 -- before placing in this procedure.
187 --
188 -- Access Status:
189 -- Internal Row Handler Use Only.
190 --
191 -- {End Of Comments}
192 -- ----------------------------------------------------------------------------
193 Procedure pre_insert(p_rec in out nocopy pqh_cea_shd.g_rec_type) is
194 --
195 l_proc varchar2(72) := g_package||'pre_insert';
196 --
197 Cursor C_Sel1 is select pqh_copy_entity_attribs_s.nextval from sys.dual;
198 --
199 Begin
200 hr_utility.set_location('Entering:'||l_proc, 5);
201 --
202 --
203 -- Select the next sequence number
204 --
205 Open C_Sel1;
206 Fetch C_Sel1 Into p_rec.copy_entity_attrib_id;
207 Close C_Sel1;
208 --
209 hr_utility.set_location(' Leaving:'||l_proc, 10);
210 End pre_insert;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |-----------------------------< post_insert >------------------------------|
214 -- ----------------------------------------------------------------------------
215 -- {Start Of Comments}
216 --
217 -- Description:
218 -- This private procedure contains any processing which is required after the
219 -- insert dml.
220 --
221 -- Prerequisites:
222 -- This is an internal procedure which is called from the ins procedure.
223 --
224 -- In Parameters:
225 -- A Pl/Sql record structre.
226 --
227 -- Post Success:
228 -- Processing continues.
229 --
230 -- Post Failure:
231 -- If an error has occurred, an error message and exception will be raised
232 -- but not handled.
233 --
234 -- Developer Implementation Notes:
235 -- Any post-processing required after the insert dml is issued should be
236 -- coded within this procedure. It is important to note that any 3rd party
237 -- maintenance should be reviewed before placing in this procedure.
238 --
239 -- Access Status:
240 -- Internal Row Handler Use Only.
241 --
242 -- {End Of Comments}
243 -- ----------------------------------------------------------------------------
244 Procedure post_insert(
245 p_effective_date in date,p_rec in pqh_cea_shd.g_rec_type) is
246 --
247 l_proc varchar2(72) := g_package||'post_insert';
248 --
249 Begin
250 hr_utility.set_location('Entering:'||l_proc, 5);
251 --
252 --
253 -- Start of API User Hook for post_insert.
254 --
255 begin
256 --
257 pqh_cea_rki.after_insert
258 (
259 p_copy_entity_attrib_id =>p_rec.copy_entity_attrib_id
260 ,p_copy_entity_txn_id =>p_rec.copy_entity_txn_id
261 ,p_row_type_cd =>p_rec.row_type_cd
262 ,p_information_category =>p_rec.information_category
263 ,p_information1 =>p_rec.information1
264 ,p_information2 =>p_rec.information2
265 ,p_information3 =>p_rec.information3
266 ,p_information4 =>p_rec.information4
267 ,p_information5 =>p_rec.information5
268 ,p_information6 =>p_rec.information6
269 ,p_information7 =>p_rec.information7
270 ,p_information8 =>p_rec.information8
271 ,p_information9 =>p_rec.information9
272 ,p_information10 =>p_rec.information10
273 ,p_information11 =>p_rec.information11
274 ,p_information12 =>p_rec.information12
275 ,p_information13 =>p_rec.information13
276 ,p_information14 =>p_rec.information14
277 ,p_information15 =>p_rec.information15
278 ,p_information16 =>p_rec.information16
279 ,p_information17 =>p_rec.information17
280 ,p_information18 =>p_rec.information18
281 ,p_information19 =>p_rec.information19
282 ,p_information20 =>p_rec.information20
283 ,p_information21 =>p_rec.information21
284 ,p_information22 =>p_rec.information22
285 ,p_information23 =>p_rec.information23
286 ,p_information24 =>p_rec.information24
287 ,p_information25 =>p_rec.information25
288 ,p_information26 =>p_rec.information26
289 ,p_information27 =>p_rec.information27
290 ,p_information28 =>p_rec.information28
291 ,p_information29 =>p_rec.information29
292 ,p_information30 =>p_rec.information30
293 ,p_check_information1 =>p_rec.check_information1
294 ,p_check_information2 =>p_rec.check_information2
295 ,p_check_information3 =>p_rec.check_information3
296 ,p_object_version_number =>p_rec.object_version_number
297 ,p_effective_date =>p_effective_date
298 );
299 --
300 exception
301 --
302 when hr_api.cannot_find_prog_unit then
303 --
304 hr_api.cannot_find_prog_unit_error
305 (p_module_name => 'pqh_copy_entity_attribs'
306 ,p_hook_type => 'AI');
307 --
308 end;
309 --
310 -- End of API User Hook for post_insert.
311 --
312 --
313 hr_utility.set_location(' Leaving:'||l_proc, 10);
314 End post_insert;
315 --
319 Procedure ins
316 -- ----------------------------------------------------------------------------
317 -- |---------------------------------< ins >----------------------------------|
318 -- ----------------------------------------------------------------------------
320 (
321 p_effective_date in date,
322 p_rec in out nocopy pqh_cea_shd.g_rec_type
323 ) is
324 --
325 l_proc varchar2(72) := g_package||'ins';
326 --
327 Begin
328 hr_utility.set_location('Entering:'||l_proc, 5);
329 --
330 -- Call the supporting insert validate operations
331 --
332 pqh_cea_bus.insert_validate(p_rec
333 ,p_effective_date);
334 --
335 -- Call the supporting pre-insert operation
336 --
337 pre_insert(p_rec);
338 --
339 -- Insert the row
340 --
341 insert_dml(p_rec);
342 --
343 -- Call the supporting post-insert operation
344 --
345 post_insert(
346 p_effective_date,p_rec);
347 end ins;
348 --
349 -- ----------------------------------------------------------------------------
350 -- |---------------------------------< ins >----------------------------------|
351 -- ----------------------------------------------------------------------------
352 Procedure ins
353 (
354 p_effective_date in date,
355 p_copy_entity_attrib_id out nocopy number,
356 p_copy_entity_txn_id in number,
357 p_row_type_cd in varchar2 default null,
358 p_information_category in varchar2 default null,
359 p_information1 in varchar2 default null,
360 p_information2 in varchar2 default null,
361 p_information3 in varchar2 default null,
362 p_information4 in varchar2 default null,
363 p_information5 in varchar2 default null,
364 p_information6 in varchar2 default null,
365 p_information7 in varchar2 default null,
366 p_information8 in varchar2 default null,
367 p_information9 in varchar2 default null,
368 p_information10 in varchar2 default null,
369 p_information11 in varchar2 default null,
370 p_information12 in varchar2 default null,
371 p_information13 in varchar2 default null,
372 p_information14 in varchar2 default null,
373 p_information15 in varchar2 default null,
374 p_information16 in varchar2 default null,
375 p_information17 in varchar2 default null,
376 p_information18 in varchar2 default null,
377 p_information19 in varchar2 default null,
378 p_information20 in varchar2 default null,
379 p_information21 in varchar2 default null,
380 p_information22 in varchar2 default null,
381 p_information23 in varchar2 default null,
382 p_information24 in varchar2 default null,
383 p_information25 in varchar2 default null,
384 p_information26 in varchar2 default null,
385 p_information27 in varchar2 default null,
386 p_information28 in varchar2 default null,
387 p_information29 in varchar2 default null,
388 p_information30 in varchar2 default null,
389 p_check_information1 in varchar2 default null,
390 p_check_information2 in varchar2 default null,
391 p_check_information3 in varchar2 default null,
392 p_object_version_number out nocopy number
393 ) is
394 --
395 l_rec pqh_cea_shd.g_rec_type;
396 l_proc varchar2(72) := g_package||'ins';
397 --
398 Begin
399 hr_utility.set_location('Entering:'||l_proc, 5);
400 --
401 -- Call conversion function to turn arguments into the
402 -- p_rec structure.
403 --
404 l_rec :=
405 pqh_cea_shd.convert_args
406 (
407 null,
408 p_copy_entity_txn_id,
409 p_row_type_cd,
410 p_information_category,
411 p_information1,
412 p_information2,
413 p_information3,
414 p_information4,
415 p_information5,
416 p_information6,
417 p_information7,
418 p_information8,
419 p_information9,
420 p_information10,
421 p_information11,
422 p_information12,
423 p_information13,
424 p_information14,
425 p_information15,
426 p_information16,
427 p_information17,
428 p_information18,
429 p_information19,
430 p_information20,
431 p_information21,
432 p_information22,
433 p_information23,
434 p_information24,
435 p_information25,
436 p_information26,
437 p_information27,
438 p_information28,
439 p_information29,
440 p_information30,
441 p_check_information1,
442 p_check_information2,
443 p_check_information3,
444 null
445 );
446 --
447 -- Having converted the arguments into the pqh_cea_rec
448 -- plsql record structure we call the corresponding record business process.
449 --
450 ins(
451 p_effective_date,l_rec);
452 --
453 -- As the primary key argument(s)
454 -- are specified as an OUT's we must set these values.
455 --
456 p_copy_entity_attrib_id := l_rec.copy_entity_attrib_id;
457 p_object_version_number := l_rec.object_version_number;
458 --
459 hr_utility.set_location(' Leaving:'||l_proc, 10);
460 End ins;
461 --
462 end pqh_cea_ins;