DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SFR_INS

Source


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