DBA Data[Home] [Help]

PACKAGE BODY: APPS.SSP_MAT_INS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body ssp_mat_ins as
2 /* $Header: spmatrhi.pkb 120.10 2011/08/24 13:51:07 npannamp ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ssp_mat_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
16 --   This procedure controls the actual dml insert logic. The processing of
13 -- {Start Of Comments}
14 --
15 -- Description:
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 set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To insert the row into the schema.
23 --   4) To trap any constraint violations that may have occurred.
24 --   5) To raise any other errors.
25 --
26 -- Pre Conditions:
27 --   This is an internal private procedure which must be called from the ins
28 --   procedure and must have all mandatory attributes set (except the
29 --   object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 --   On the insert dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   None.
47 --
48 -- Access Status:
49 --   Internal Table Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy ssp_mat_shd.g_rec_type) is
54 --
55   l_proc  varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   p_rec.object_version_number := 1;  -- Initialise the object version
60   --
61   ssp_mat_shd.g_api_dml := true;  -- Set the api dml status
62   --
63   -- Insert the row into: ssp_maternities
64   --
65   insert into ssp_maternities
66   (	maternity_id,
67 	due_date,
68 	person_id,
69 	start_date_maternity_allowance,
70 	notification_of_birth_date,
71 	unfit_for_scheduled_return,
72 	stated_return_date,
73 	intend_to_return_flag,
74 	start_date_with_new_employer,
75 	smp_must_be_paid_by_date,
76 	pay_smp_as_lump_sum,
77 	live_birth_flag,
78 	actual_birth_date,
79 	mpp_start_date,
80 	object_version_number,
81 	attribute_category,
82 	attribute1,
83 	attribute2,
84 	attribute3,
85 	attribute4,
86 	attribute5,
87 	attribute6,
88 	attribute7,
89 	attribute8,
90 	attribute9,
91 	attribute10,
92 	attribute11,
93 	attribute12,
94 	attribute13,
95 	attribute14,
96 	attribute15,
97 	attribute16,
98 	attribute17,
99 	attribute18,
100 	attribute19,
101 	attribute20,
102     LEAVE_TYPE,
103     MATCHING_DATE ,
104     PLACEMENT_DATE ,
105     DISRUPTED_PLACEMENT_DATE,
106     mat_information_category,
107     mat_information1,
108     mat_information2,
109     mat_information3,
110     mat_information4,
111     mat_information5,
112     mat_information6,
113     mat_information7,
114     mat_information8,
115     mat_information9,
116     mat_information10,
117     mat_information11,
118     mat_information12,
119     mat_information13,
120     mat_information14,
121     mat_information15,
122     mat_information16,
123     mat_information17,
124     mat_information18,
125     mat_information19,
126     mat_information20,
127     mat_information21,
128     mat_information22,
129     mat_information23,
130     mat_information24,
131     mat_information25,
132     mat_information26,
133     mat_information27,
134     mat_information28,
135     mat_information29,
136     mat_information30,
137     partner_stat_pay_start_date,
138     partner_return_to_work,
139     partner_death_date
140    )
141   Values
142   (	p_rec.maternity_id,
143 	p_rec.due_date,
144 	p_rec.person_id,
145 	p_rec.start_date_maternity_allowance,
146 	p_rec.notification_of_birth_date,
147 	p_rec.unfit_for_scheduled_return,
148 	p_rec.stated_return_date,
149 	p_rec.intend_to_return_flag,
150 	p_rec.start_date_with_new_employer,
151 	p_rec.smp_must_be_paid_by_date,
152 	p_rec.pay_smp_as_lump_sum,
153 	p_rec.live_birth_flag,
154 	p_rec.actual_birth_date,
155 	p_rec.mpp_start_date,
156 	p_rec.object_version_number,
157 	p_rec.attribute_category,
158 	p_rec.attribute1,
159 	p_rec.attribute2,
160 	p_rec.attribute3,
161 	p_rec.attribute4,
162 	p_rec.attribute5,
163 	p_rec.attribute6,
164 	p_rec.attribute7,
165 	p_rec.attribute8,
166 	p_rec.attribute9,
167 	p_rec.attribute10,
168 	p_rec.attribute11,
169 	p_rec.attribute12,
170 	p_rec.attribute13,
171 	p_rec.attribute14,
172 	p_rec.attribute15,
173 	p_rec.attribute16,
174 	p_rec.attribute17,
175 	p_rec.attribute18,
176 	p_rec.attribute19,
177 	p_rec.attribute20,
178     p_rec.LEAVE_TYPE,
179     p_rec.MATCHING_DATE,
180     p_rec.PLACEMENT_DATE,
181     p_rec.DISRUPTED_PLACEMENT_DATE,
182     p_rec.mat_information_category,
183     p_rec.mat_information1,
184     p_rec.mat_information2,
185     p_rec.mat_information3,
186     p_rec.mat_information4,
187     p_rec.mat_information5,
188     p_rec.mat_information6,
189     p_rec.mat_information7,
190     p_rec.mat_information8,
191     p_rec.mat_information9,
192     p_rec.mat_information10,
193     p_rec.mat_information11,
194     p_rec.mat_information12,
195     p_rec.mat_information13,
196     p_rec.mat_information14,
197     p_rec.mat_information15,
201     p_rec.mat_information19,
198     p_rec.mat_information16,
199     p_rec.mat_information17,
200     p_rec.mat_information18,
202     p_rec.mat_information20,
203     p_rec.mat_information21,
204     p_rec.mat_information22,
205     p_rec.mat_information23,
206     p_rec.mat_information24,
207     p_rec.mat_information25,
208     p_rec.mat_information26,
209     p_rec.mat_information27,
210     p_rec.mat_information28,
211     p_rec.mat_information29,
212     p_rec.mat_information30,
213     p_rec.partner_stat_pay_start_date,
214     p_rec.partner_return_to_work,
215     p_rec.partner_death_date
216    );
217   --
218   ssp_mat_shd.g_api_dml := false;   -- Unset the api dml status
219   --
220   hr_utility.set_location(' Leaving:'||l_proc, 10);
221 Exception
222   When hr_api.check_integrity_violated Then
223     -- A check constraint has been violated
224     ssp_mat_shd.g_api_dml := false;   -- Unset the api dml status
225     ssp_mat_shd.constraint_error
226       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
227   When hr_api.parent_integrity_violated Then
228     -- Parent integrity has been violated
229     ssp_mat_shd.g_api_dml := false;   -- Unset the api dml status
230     ssp_mat_shd.constraint_error
231       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
232   When hr_api.unique_integrity_violated Then
233     -- Unique integrity has been violated
234     ssp_mat_shd.g_api_dml := false;   -- Unset the api dml status
235     ssp_mat_shd.constraint_error
236       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
237   When Others Then
238     ssp_mat_shd.g_api_dml := false;   -- Unset the api dml status
239     Raise;
240 End insert_dml;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |------------------------------< pre_insert >------------------------------|
244 -- ----------------------------------------------------------------------------
245 -- {Start Of Comments}
246 --
247 -- Description:
248 --   This private procedure contains any processing which is required before
249 --   the insert dml. Presently, if the entity has a corresponding primary
250 --   key which is maintained by an associating sequence, the primary key for
251 --   the entity will be populated with the next sequence value in
252 --   preparation for the insert dml.
253 --
254 -- Pre Conditions:
255 --   This is an internal procedure which is called from the ins procedure.
256 --
257 -- In Parameters:
258 --   A Pl/Sql record structre.
259 --
260 -- Post Success:
261 --   Processing continues.
262 --
263 -- Post Failure:
264 --   If an error has occurred, an error message and exception will be raised
265 --   but not handled.
266 --
267 -- Developer Implementation Notes:
268 --   Any pre-processing required before the insert dml is issued should be
269 --   coded within this procedure. As stated above, a good example is the
270 --   generation of a primary key number via a corresponding sequence.
271 --   It is important to note that any 3rd party maintenance should be reviewed
272 --   before placing in this procedure.
273 --
274 -- Access Status:
275 --   Internal Table Handler Use Only.
276 --
277 -- {End Of Comments}
278 -- ----------------------------------------------------------------------------
279 Procedure pre_insert(p_rec  in out nocopy ssp_mat_shd.g_rec_type) is
280 --
281   l_proc  varchar2(72) := g_package||'pre_insert';
282 --
283   Cursor C_Sel1 is select ssp_maternities_s.nextval from sys.dual;
284 --
285 Begin
286   hr_utility.set_location('Entering:'||l_proc, 5);
287   --
288   --
289   -- Select the next sequence number
290   --
291   Open C_Sel1;
292   Fetch C_Sel1 Into p_rec.maternity_id;
293   Close C_Sel1;
294   --
295   hr_utility.set_location(' Leaving:'||l_proc, 10);
296 End pre_insert;
297 --
298 -- ----------------------------------------------------------------------------
299 -- |-----------------------------< post_insert >------------------------------|
300 -- ----------------------------------------------------------------------------
301 -- {Start Of Comments}
302 --
303 -- Description:
304 --   This private procedure contains any processing which is required after the
305 --   insert dml.
306 --
307 -- Pre Conditions:
308 --   This is an internal procedure which is called from the ins procedure.
309 --
310 -- In Parameters:
311 --   A Pl/Sql record structre.
312 --
313 -- Post Success:
314 --   Processing continues.
315 --
316 -- Post Failure:
317 --   If an error has occurred, an error message and exception will be raised
318 --   but not handled.
319 --
320 -- Developer Implementation Notes:
321 --   Any post-processing required after the insert dml is issued should be
322 --   coded within this procedure. It is important to note that any 3rd party
323 --   maintenance should be reviewed before placing in this procedure.
324 --
325 -- Access Status:
326 --   Internal Table Handler Use Only.
327 --
328 -- {End Of Comments}
329 -- ----------------------------------------------------------------------------
330 Procedure post_insert(p_rec in ssp_mat_shd.g_rec_type) is
331 --
332   l_proc  varchar2(72) := g_package||'post_insert';
333 --
334 Begin
335   hr_utility.set_location('Entering:'||l_proc, 5);
336   --
337   hr_utility.set_location(' Leaving:'||l_proc, 10);
338 End post_insert;
339 --
340 -- ----------------------------------------------------------------------------
341 -- |---------------------------------< ins >----------------------------------|
342 -- ----------------------------------------------------------------------------
343 Procedure ins
344   (
345   p_rec        in out nocopy ssp_mat_shd.g_rec_type,
346   p_validate   in     boolean default false
347   ) is
348 --
349   l_proc  varchar2(72) := g_package||'ins';
350 --
351 Begin
352   hr_utility.set_location('Entering:'||l_proc, 5);
353   --
354   -- Determine if the business process is to be validated.
355   --
356   If p_validate then
357     --
358     -- Issue the savepoint.
359     --
360     SAVEPOINT ins_ssp_mat;
361   End If;
362   --
363   -- Call the supporting insert validate operations
364   --
365   ssp_mat_bus.insert_validate(p_rec);
366   --
367   -- Call the supporting pre-insert operation
368   --
369   pre_insert(p_rec);
370   --
371   -- Insert the row
372   --
373   insert_dml(p_rec);
377   post_insert(p_rec);
374   --
375   -- Call the supporting post-insert operation
376   --
378   --
379   -- If we are validating then raise the Validate_Enabled exception
380   --
381   If p_validate then
382     Raise HR_Api.Validate_Enabled;
383   End If;
384   --
385   hr_utility.set_location(' Leaving:'||l_proc, 10);
386 Exception
387   When HR_Api.Validate_Enabled Then
388     --
389     -- As the Validate_Enabled exception has been raised
393 end ins;
390     -- we must rollback to the savepoint
391     --
392     ROLLBACK TO ins_ssp_mat;
394 --
395 -- ----------------------------------------------------------------------------
396 -- |---------------------------------< ins >----------------------------------|
397 -- ----------------------------------------------------------------------------
398 Procedure ins
399   (
400   p_maternity_id                 out nocopy number,
401   p_object_version_number        out nocopy number,
402   p_due_date                     in date,
403   p_person_id                    in number,
404   p_start_date_SMA in date	default null,
405   p_notification_of_birth_date   in date	default null,
406   p_unfit_for_scheduled_return   in varchar2	default 'N',
407   p_stated_return_date           in date	default null,
408   p_intend_to_return_flag        in varchar2	default 'Y',
409   p_start_date_with_new_employer in date	default null,
410   p_smp_must_be_paid_by_date     in date	default null,
411   p_pay_smp_as_lump_sum          in varchar2	default 'N',
412   p_live_birth_flag              in varchar2	default 'Y',
413   p_actual_birth_date            in date	default null,
414   p_mpp_start_date               in date	default null,
415   p_attribute_category           in varchar2	default null,
416   p_attribute1                   in varchar2	default null,
417   p_attribute2                   in varchar2	default null,
418   p_attribute3                   in varchar2	default null,
419   p_attribute4                   in varchar2	default null,
420   p_attribute5                   in varchar2	default null,
421   p_attribute6                   in varchar2	default null,
422   p_attribute7                   in varchar2	default null,
423   p_attribute8                   in varchar2	default null,
424   p_attribute9                   in varchar2	default null,
425   p_attribute10                  in varchar2	default null,
426   p_attribute11                  in varchar2	default null,
427   p_attribute12                  in varchar2	default null,
428   p_attribute13                  in varchar2	default null,
429   p_attribute14                  in varchar2	default null,
430   p_attribute15                  in varchar2	default null,
431   p_attribute16                  in varchar2	default null,
432   p_attribute17                  in varchar2	default null,
433   p_attribute18                  in varchar2	default null,
434   p_attribute19                  in varchar2	default null,
435   p_attribute20                  in varchar2	default null,
436   p_LEAVE_TYPE                   in VARCHAR2 default 'MA',
437   p_MATCHING_DATE                in DATE default null,
438   p_PLACEMENT_DATE               in DATE default null,
439   p_DISRUPTED_PLACEMENT_DATE     in DATE default null,
440   p_validate                     in boolean	default false,
441   p_mat_information_category     in varchar2    default null,
442   p_mat_information1             in varchar2    default null,
443   p_mat_information2             in varchar2    default null,
444   p_mat_information3             in varchar2    default null,
445   p_mat_information4             in varchar2    default null,
446   p_mat_information5             in varchar2    default null,
447   p_mat_information6             in varchar2    default null,
448   p_mat_information7             in varchar2    default null,
449   p_mat_information8             in varchar2    default null,
450   p_mat_information9             in varchar2    default null,
451   p_mat_information10            in varchar2    default null,
452   p_mat_information11            in varchar2    default null,
453   p_mat_information12            in varchar2    default null,
454   p_mat_information13            in varchar2    default null,
455   p_mat_information14            in varchar2    default null,
456   p_mat_information15            in varchar2    default null,
457   p_mat_information16            in varchar2    default null,
458   p_mat_information17            in varchar2    default null,
459   p_mat_information18            in varchar2    default null,
460   p_mat_information19            in varchar2    default null,
461   p_mat_information20            in varchar2    default null,
462   p_mat_information21            in varchar2    default null,
463   p_mat_information22            in varchar2    default null,
464   p_mat_information23            in varchar2    default null,
465   p_mat_information24            in varchar2    default null,
466   p_mat_information25            in varchar2    default null,
467   p_mat_information26            in varchar2    default null,
468   p_mat_information27            in varchar2    default null,
469   p_mat_information28            in varchar2    default null,
470   p_mat_information29            in varchar2    default null,
471   p_mat_information30            in varchar2    default null,
472   p_partner_stat_pay_start_date  in date    default null,
473   p_partner_return_to_work  	 in date    default null,
474   p_partner_death_date		  	 in date    default null
475   ) is
476 --
477   l_rec	  ssp_mat_shd.g_rec_type;
478   l_proc  varchar2(72) := g_package||'ins';
479 --
480 Begin
481   hr_utility.set_location('Entering:'||l_proc, 5);
482   --
483   -- Call conversion function to turn arguments into the
484   -- p_rec structure.
485   --
486   l_rec :=
487   ssp_mat_shd.convert_args
488   (
489   null,
490   p_due_date,
491   p_person_id,
492   p_start_date_SMA,
493   p_notification_of_birth_date,
494   p_unfit_for_scheduled_return,
495   p_stated_return_date,
496   p_intend_to_return_flag,
497   p_start_date_with_new_employer,
498   p_smp_must_be_paid_by_date,
499   p_pay_smp_as_lump_sum,
500   p_live_birth_flag,
501   p_actual_birth_date,
502   p_mpp_start_date,
503   null,
504   p_attribute_category,
505   p_attribute1,
509   p_attribute5,
506   p_attribute2,
507   p_attribute3,
508   p_attribute4,
510   p_attribute6,
511   p_attribute7,
512   p_attribute8,
513   p_attribute9,
514   p_attribute10,
515   p_attribute11,
516   p_attribute12,
517   p_attribute13,
518   p_attribute14,
519   p_attribute15,
520   p_attribute16,
521   p_attribute17,
522   p_attribute18,
523   p_attribute19,
524   p_attribute20,
525   p_LEAVE_TYPE,
526   p_MATCHING_DATE,
527   p_PLACEMENT_DATE ,
528   p_DISRUPTED_PLACEMENT_DATE,
529   p_mat_information_category,
530   p_mat_information1,
531   p_mat_information2,
532   p_mat_information3,
533   p_mat_information4,
534   p_mat_information5,
535   p_mat_information6,
536   p_mat_information7,
537   p_mat_information8,
538   p_mat_information9,
539   p_mat_information10,
540   p_mat_information11,
541   p_mat_information12,
542   p_mat_information13,
543   p_mat_information14,
544   p_mat_information15,
545   p_mat_information16,
546   p_mat_information17,
547   p_mat_information18,
548   p_mat_information19,
549   p_mat_information20,
550   p_mat_information21,
551   p_mat_information22,
552   p_mat_information23,
553   p_mat_information24,
554   p_mat_information25,
555   p_mat_information26,
556   p_mat_information27,
557   p_mat_information28,
558   p_mat_information29,
559   p_mat_information30,
560   p_partner_stat_pay_start_date,
561   p_partner_return_to_work ,
562   p_partner_death_date
563    );
564   --
565   -- Having converted the arguments into the ssp_mat_rec
566   -- plsql record structure we call the corresponding record business process.
567   --
568   ins(l_rec, p_validate);
569   --
570   -- As the primary key argument(s)
571   -- are specified as an OUT's we must set these values.
572   --
573   p_maternity_id := l_rec.maternity_id;
574   p_object_version_number := l_rec.object_version_number;
575   --
576   hr_utility.set_location(' Leaving:'||l_proc, 10);
577 End ins;
578 --
579 end ssp_mat_ins;