1 Package Body pay_mgr_ins as
2 /* $Header: pymgrrhi.pkb 120.2 2005/07/10 23:13:53 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_mgr_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 functions of this
17 -- 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 arguments set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Arguments:
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 Development Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy pay_mgr_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 --
60 --
61 pay_mgr_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: pay_magnetic_records
64 --
65 insert into pay_magnetic_records
66 ( formula_id,
67 magnetic_block_id,
68 next_block_id,
69 last_run_executed_mode,
70 overflow_mode,
71 sequence,
72 frequency ,
73 action_level,
74 block_label,
75 block_row_label,
76 xml_proc_name
77 )
78 Values
79 ( p_rec.formula_id,
80 p_rec.magnetic_block_id,
81 p_rec.next_block_id,
82 p_rec.last_run_executed_mode,
83 p_rec.overflow_mode,
84 p_rec.sequence,
85 p_rec.frequency ,
86 p_rec.action_level,
87 p_rec.block_label,
88 p_rec.block_row_label,
89 p_rec.xml_proc_name
90 );
91 --
92 pay_mgr_shd.g_api_dml := false; -- Unset the api dml status
93 --
94 hr_utility.set_location(' Leaving:'||l_proc, 10);
95 Exception
99 pay_mgr_shd.constraint_error
96 When hr_api.check_integrity_violated Then
97 -- A check constraint has been violated
98 pay_mgr_shd.g_api_dml := false; -- Unset the api dml status
100 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
101 When hr_api.parent_integrity_violated Then
102 -- Parent integrity has been violated
103 pay_mgr_shd.g_api_dml := false; -- Unset the api dml status
104 pay_mgr_shd.constraint_error
105 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
106 When hr_api.unique_integrity_violated Then
107 -- Unique integrity has been violated
108 pay_mgr_shd.g_api_dml := false; -- Unset the api dml status
109 pay_mgr_shd.constraint_error
110 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
111 When Others Then
112 pay_mgr_shd.g_api_dml := false; -- Unset the api dml status
113 Raise;
114 End insert_dml;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |------------------------------< pre_insert >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 -- This private procedure contains any processing which is required before
123 -- the insert dml. Presently, if the entity has a corresponding primary
124 -- key which is maintained by an associating sequence, the primary key for
125 -- the entity will be populated with the next sequence value in
126 -- preparation for the insert dml.
127 --
128 -- Pre Conditions:
129 -- This is an internal procedure which is called from the ins procedure.
130 --
131 -- In Arguments:
132 -- A Pl/Sql record structre.
133 --
134 -- Post Success:
135 -- Processing continues.
136 --
137 -- Post Failure:
138 -- If an error has occurred, an error message and exception will be raised
139 -- but not handled.
140 --
141 -- Developer Implementation Notes:
142 -- Any pre-processing required before the insert dml is issued should be
143 -- coded within this procedure. As stated above, a good example is the
144 -- generation of a primary key number via a corresponding sequence.
145 -- It is important to note that any 3rd party maintenance should be reviewed
146 -- before placing in this procedure.
147 --
148 -- Access Status:
149 -- Internal Development Use Only.
150 --
151 -- {End Of Comments}
152 -- ----------------------------------------------------------------------------
153 Procedure pre_insert(p_rec in out nocopy pay_mgr_shd.g_rec_type) is
154 --
155 l_proc varchar2(72) := g_package||'pre_insert';
156 --
157 --
158 --
159 Begin
160 hr_utility.set_location('Entering:'||l_proc, 5);
161 --
162 --
163 --
164 hr_utility.set_location(' Leaving:'||l_proc, 10);
165 End pre_insert;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |-----------------------------< post_insert >------------------------------|
169 -- ----------------------------------------------------------------------------
170 -- {Start Of Comments}
171 --
172 -- Description:
173 -- This private procedure contains any processing which is required after the
174 -- insert dml.
175 --
176 -- Pre Conditions:
177 -- This is an internal procedure which is called from the ins procedure.
178 --
179 -- In Arguments:
180 -- A Pl/Sql record structre.
181 --
182 -- Post Success:
183 -- Processing continues.
184 --
185 -- Post Failure:
186 -- If an error has occurred, an error message and exception will be raised
187 -- but not handled.
188 --
189 -- Developer Implementation Notes:
190 -- Any post-processing required after the insert dml is issued should be
191 -- coded within this procedure. It is important to note that any 3rd party
192 -- maintenance should be reviewed before placing in this procedure.
193 --
194 -- Access Status:
195 -- Internal Development Use Only.
196 --
197 -- {End Of Comments}
198 -- ----------------------------------------------------------------------------
199 Procedure post_insert(p_rec in pay_mgr_shd.g_rec_type) is
200 --
201 l_proc varchar2(72) := g_package||'post_insert';
202 --
203 Begin
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 --
206 hr_utility.set_location(' Leaving:'||l_proc, 10);
207 End post_insert;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |---------------------------------< ins >----------------------------------|
211 -- ----------------------------------------------------------------------------
212 Procedure ins
213 (
214 p_rec in out nocopy pay_mgr_shd.g_rec_type,
215 p_validate in boolean default false
216 ) is
217 --
218 l_proc varchar2(72) := g_package||'ins';
219 --
220 Begin
221 hr_utility.set_location('Entering:'||l_proc, 5);
222 --
223 -- Determine if the business process is to be validated.
224 --
225 If p_validate then
226 --
227 -- Issue the savepoint.
228 --
229 SAVEPOINT ins_pay_mgr;
230 End If;
231 --
232 -- Call the supporting insert validate operations
233 --
234 pay_mgr_bus.insert_validate(p_rec);
235 --
236 -- Call the supporting pre-insert operation
237 --
238 pre_insert(p_rec);
239 --
240 -- Insert the row
241 --
242 insert_dml(p_rec);
243 --
244 -- Call the supporting post-insert operation
248 -- If we are validating then raise the Validate_Enabled exception
245 --
246 post_insert(p_rec);
247 --
249 --
250 If p_validate then
251 Raise HR_Api.Validate_Enabled;
252 End If;
253 --
254 hr_utility.set_location(' Leaving:'||l_proc, 10);
255 Exception
256 When HR_Api.Validate_Enabled Then
257 --
258 -- As the Validate_Enabled exception has been raised
259 -- we must rollback to the savepoint
260 --
261 ROLLBACK TO ins_pay_mgr;
262 end ins;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------------< ins >----------------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure ins
268 (
269 p_formula_id in number,
270 p_magnetic_block_id in number,
271 p_next_block_id in number default null,
272 p_last_run_executed_mode in varchar2,
273 p_overflow_mode in varchar2,
274 p_sequence in number,
275 p_frequency in number default null,
276 p_validate in boolean default false ,
277 p_action_level in varchar2 default null,
278 p_block_label in varchar2 default null,
279 p_block_row_label in varchar2 default null,
280 p_xml_proc_name in varchar2 default null
281 ) is
282 --
283 l_rec pay_mgr_shd.g_rec_type;
284 l_proc varchar2(72) := g_package||'ins';
285 --
286 Begin
287 hr_utility.set_location('Entering:'||l_proc, 5);
288 --
289 -- Call conversion function to turn arguments into the
290 -- p_rec structure.
291 --
292 l_rec :=
293 pay_mgr_shd.convert_args
294 (
295 p_formula_id,
296 p_magnetic_block_id,
297 p_next_block_id,
298 p_last_run_executed_mode,
299 p_overflow_mode,
300 p_sequence,
301 p_frequency,
302 p_action_level,
303 p_block_label,
304 p_block_row_label,
305 p_xml_proc_name
306 );
307 --
308 -- Having converted the arguments into the pay_mgr_rec
309 -- plsql record structure we call the corresponding record business process.
310 --
311 ins(l_rec, p_validate);
312 --
313 -- As the primary key argument(s)
314 -- are specified as an OUT's we must set these values.
315 --
316 -- p_magnetic_block_id := l_rec.magnetic_block_id;
317 -- p_sequence := l_rec.sequence;
318 --
319 --
320 hr_utility.set_location(' Leaving:'||l_proc, 10);
321 End ins;
322 --
323 end pay_mgr_ins;