DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBF_INS

Source


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