DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBC_INS

Source


1 Package Body pay_sbc_ins as
2 /* $Header: pysbcrhi.pkb 120.0 2005/05/29 08:33:44 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_sbc_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 --      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 pay_sbc_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: pay_shadow_balance_classi
60   --
61   insert into pay_shadow_balance_classi
62   (	balance_classification_id,
63 	balance_type_id,
64 	element_classification,
65 	scale,
66 	object_version_number
67        ,exclusion_rule_id
68   )
69   Values
70   (	p_rec.balance_classification_id,
71 	p_rec.balance_type_id,
72 	p_rec.element_classification,
73 	p_rec.scale,
74 	p_rec.object_version_number
75        ,p_rec.exclusion_rule_id
76   );
77   --
78   --
79   hr_utility.set_location(' Leaving:'||l_proc, 10);
80 Exception
81   When hr_api.check_integrity_violated Then
82     -- A check constraint has been violated
83     pay_sbc_shd.constraint_error
84       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
85   When hr_api.parent_integrity_violated Then
86     -- Parent integrity has been violated
87     pay_sbc_shd.constraint_error
88       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
89   When hr_api.unique_integrity_violated Then
90     -- Unique integrity has been violated
91     pay_sbc_shd.constraint_error
92       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
93   When Others Then
94     Raise;
95 End insert_dml;
96 --
97 -- ----------------------------------------------------------------------------
98 -- |------------------------------< pre_insert >------------------------------|
99 -- ----------------------------------------------------------------------------
100 -- {Start Of Comments}
101 --
102 -- Description:
103 --   This private procedure contains any processing which is required before
104 --   the insert dml. Presently, if the entity has a corresponding primary
105 --   key which is maintained by an associating sequence, the primary key for
106 --   the entity will be populated with the next sequence value in
107 --   preparation for the insert dml.
108 --
109 -- Prerequisites:
110 --   This is an internal procedure which is called from the ins procedure.
111 --
112 -- In Parameters:
113 --   A Pl/Sql record structre.
114 --
115 -- Post Success:
116 --   Processing continues.
117 --
118 -- Post Failure:
119 --   If an error has occurred, an error message and exception will be raised
120 --   but not handled.
121 --
122 -- Developer Implementation Notes:
123 --   Any pre-processing required before the insert dml is issued should be
124 --   coded within this procedure. As stated above, a good example is the
125 --   generation of a primary key number via a corresponding sequence.
126 --   It is important to note that any 3rd party maintenance should be reviewed
127 --   before placing in this procedure.
128 --
129 -- Access Status:
130 --   Internal Row Handler Use Only.
131 --
132 -- {End Of Comments}
133 -- ----------------------------------------------------------------------------
134 Procedure pre_insert(p_rec  in out nocopy pay_sbc_shd.g_rec_type) is
135 --
136   l_proc  varchar2(72) := g_package||'pre_insert';
137 --
138   Cursor C_Sel1 is select pay_shadow_balance_classi_s.nextval from sys.dual;
139 --
140 Begin
141   hr_utility.set_location('Entering:'||l_proc, 5);
142   --
143   --
144   -- Select the next sequence number
145   --
146   Open C_Sel1;
147   Fetch C_Sel1 Into p_rec.balance_classification_id;
148   Close C_Sel1;
149   --
150   hr_utility.set_location(' Leaving:'||l_proc, 10);
151 End pre_insert;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |-----------------------------< post_insert >------------------------------|
155 -- ----------------------------------------------------------------------------
156 -- {Start Of Comments}
157 --
158 -- Description:
159 --   This private procedure contains any processing which is required after the
160 --   insert dml.
161 --
162 -- Prerequisites:
163 --   This is an internal procedure which is called from the ins procedure.
164 --
165 -- In Parameters:
166 --   A Pl/Sql record structre.
167 --
168 -- Post Success:
169 --   Processing continues.
170 --
171 -- Post Failure:
172 --   If an error has occurred, an error message and exception will be raised
173 --   but not handled.
174 --
175 -- Developer Implementation Notes:
176 --   Any post-processing required after the insert dml is issued should be
177 --   coded within this procedure. It is important to note that any 3rd party
178 --   maintenance should be reviewed before placing in this procedure.
179 --
180 -- Access Status:
181 --   Internal Row Handler Use Only.
182 --
183 -- {End Of Comments}
184 -- ----------------------------------------------------------------------------
185 Procedure post_insert(p_rec in pay_sbc_shd.g_rec_type) is
186 --
187   l_proc  varchar2(72) := g_package||'post_insert';
188 --
189 Begin
190   hr_utility.set_location('Entering:'||l_proc, 5);
191   --
192   hr_utility.set_location(' Leaving:'||l_proc, 10);
193 End post_insert;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |---------------------------------< ins >----------------------------------|
197 -- ----------------------------------------------------------------------------
198 Procedure ins
199   (p_effective_date in date,
200   p_rec        in out nocopy pay_sbc_shd.g_rec_type
201   ) is
202 --
203   l_proc  varchar2(72) := g_package||'ins';
204 --
205 Begin
206   hr_utility.set_location('Entering:'||l_proc, 5);
207   --
208   -- Call the supporting insert validate operations
209   --
210   pay_sbc_bus.insert_validate(p_rec);
211   --
212   -- Call the supporting pre-insert operation
213   --
214   pre_insert(p_rec);
215   --
216   -- Insert the row
217   --
218   insert_dml(p_rec);
219   --
220   -- Call the supporting post-insert operation
221   --
222   post_insert(p_rec);
223 end ins;
224 --
225 -- ----------------------------------------------------------------------------
226 -- |---------------------------------< ins >----------------------------------|
227 -- ----------------------------------------------------------------------------
228 Procedure ins
229   (
230   p_effective_date               in date,
231   p_balance_classification_id    out nocopy number,
232   p_balance_type_id              in number,
233   p_element_classification       in varchar2,
234   p_scale                        in number,
235   p_object_version_number        out nocopy number
236  ,p_exclusion_rule_id            in number default null
237   ) is
238 --
239   l_rec	  pay_sbc_shd.g_rec_type;
240   l_proc  varchar2(72) := g_package||'ins';
241 --
242 Begin
243   hr_utility.set_location('Entering:'||l_proc, 5);
244   --
245   -- Call conversion function to turn arguments into the
246   -- p_rec structure.
247   --
248   l_rec :=
249   pay_sbc_shd.convert_args
250   (
251   null,
252   p_balance_type_id,
253   p_element_classification,
254   p_scale,
255   null
256  ,p_exclusion_rule_id
257   );
258   --
259   -- Having converted the arguments into the pay_sbc_rec
260   -- plsql record structure we call the corresponding record business process.
261   --
262   ins(p_effective_date, l_rec);
263   --
264   -- As the primary key argument(s)
265   -- are specified as an OUT's we must set these values.
266   --
267   p_balance_classification_id := l_rec.balance_classification_id;
268   p_object_version_number := l_rec.object_version_number;
269   --
270   hr_utility.set_location(' Leaving:'||l_proc, 10);
271 End ins;
272 --
273 end pay_sbc_ins;