DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_PLG_INS

Source


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