1 Package Body per_bil_ins as
2 /* $Header: pebilrhi.pkb 115.10 2003/04/10 09:19:39 jheer noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_bil_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 -- 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 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
31 -- In Parameters:
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
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 Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy per_bil_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 per_bil_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: hr_summary
64 --
65 insert into hr_summary
66 ( type,
67 business_group_id,
68 object_version_number,
69 id_value,
70 fk_value1,
71 fk_value2,
72 fk_value3,
73 text_value1,
74 text_value2,
75 text_value3,
76 text_value4,
77 text_value5,
78 text_value6,
79 text_value7,
80 num_value1,
81 num_value2,
82 num_value3,
83 date_value1,
84 date_value2,
85 date_value3
86 )
87 Values
88 ( p_rec.type,
89 p_rec.business_group_id,
90 p_rec.object_version_number,
91 p_rec.id_value,
92 p_rec.fk_value1,
93 p_rec.fk_value2,
94 p_rec.fk_value3,
95 p_rec.text_value1,
96 p_rec.text_value2,
97 p_rec.text_value3,
98 p_rec.text_value4,
99 p_rec.text_value5,
100 p_rec.text_value6,
101 p_rec.text_value7,
102 p_rec.num_value1,
103 p_rec.num_value2,
104 p_rec.num_value3,
105 p_rec.date_value1,
106 p_rec.date_value2,
107 p_rec.date_value3
108 );
109 --
110 per_bil_shd.g_api_dml := false; -- Unset the api dml status
111 --
112 hr_utility.set_location(' Leaving:'||l_proc, 10);
113 Exception
114 When hr_api.check_integrity_violated Then
115 -- A check constraint has been violated
116 per_bil_shd.g_api_dml := false; -- Unset the api dml status
117 per_bil_shd.constraint_error
118 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
119 When hr_api.parent_integrity_violated Then
120 -- Parent integrity has been violated
121 per_bil_shd.g_api_dml := false; -- Unset the api dml status
122 per_bil_shd.constraint_error
123 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
124 When hr_api.unique_integrity_violated Then
125 -- Unique integrity has been violated
126 per_bil_shd.g_api_dml := false; -- Unset the api dml status
127 per_bil_shd.constraint_error
128 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
129 When Others Then
130 per_bil_shd.g_api_dml := false; -- Unset the api dml status
131 Raise;
132 End insert_dml;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |------------------------------< pre_insert >------------------------------|
136 -- ----------------------------------------------------------------------------
137 -- {Start Of Comments}
138 --
139 -- Description:
140 -- This private procedure contains any processing which is required before
141 -- the insert dml. Presently, if the entity has a corresponding primary
142 -- key which is maintained by an associating sequence, the primary key for
143 -- the entity will be populated with the next sequence value in
144 -- preparation for the insert dml.
145 --
146 -- Prerequisites:
147 -- This is an internal procedure which is called from the ins procedure.
148 --
149 -- In Parameters:
150 -- A Pl/Sql record structre.
151 --
152 -- Post Success:
153 -- Processing continues.
154 --
155 -- Post Failure:
156 -- If an error has occurred, an error message and exception will be raised
157 -- but not handled.
158 --
159 -- Developer Implementation Notes:
160 -- Any pre-processing required before the insert dml is issued should be
161 -- coded within this procedure. As stated above, a good example is the
162 -- generation of a primary key number via a corresponding sequence.
163 -- It is important to note that any 3rd party maintenance should be reviewed
164 -- before placing in this procedure.
165 --
166 -- Access Status:
167 -- Internal Row Handler Use Only.
168 --
169 -- {End Of Comments}
170 -- ----------------------------------------------------------------------------
171 Procedure pre_insert(p_rec in out nocopy per_bil_shd.g_rec_type) is
172 --
173 l_proc varchar2(72) := g_package||'pre_insert';
174 --
175 Cursor C_Sel1 is select hr_summary_s.nextval from sys.dual;
176 --
177 Begin
181 -- Select the next sequence number
178 hr_utility.set_location('Entering:'||l_proc, 5);
179 --
180 --
182 --
183 Open C_Sel1;
184 Fetch C_Sel1 Into p_rec.id_value;
185 Close C_Sel1;
186 --
187 hr_utility.set_location(' Leaving:'||l_proc, 10);
188 End pre_insert;
189 --
190 -- ----------------------------------------------------------------------------
191 -- |-----------------------------< post_insert >------------------------------|
192 -- ----------------------------------------------------------------------------
193 -- {Start Of Comments}
194 --
195 -- Description:
196 -- This private procedure contains any processing which is required after the
197 -- insert dml.
198 --
199 -- Prerequisites:
200 -- This is an internal procedure which is called from the ins procedure.
201 --
202 -- In Parameters:
203 -- A Pl/Sql record structre.
204 --
205 -- Post Success:
206 -- Processing continues.
207 --
208 -- Post Failure:
209 -- If an error has occurred, an error message and exception will be raised
210 -- but not handled.
211 --
212 -- Developer Implementation Notes:
213 -- Any post-processing required after the insert dml is issued should be
214 -- coded within this procedure. It is important to note that any 3rd party
215 -- maintenance should be reviewed before placing in this procedure.
216 --
217 -- Access Status:
218 -- Internal Row Handler Use Only.
219 --
220 -- {End Of Comments}
221 -- ----------------------------------------------------------------------------
222 Procedure post_insert(p_rec in per_bil_shd.g_rec_type) is
223 --
224 l_proc varchar2(72) := g_package||'post_insert';
225 --
226 Begin
227 hr_utility.set_location('Entering:'||l_proc, 5);
228 --
229 --
230 -- Start of API User Hook for post_insert.
231 --
232 begin
233 --
234 /*
235 per_bil_rki.after_insert
236 (
237 p_type =>p_rec.type
238 ,p_business_group_id =>p_rec.business_group_id
239 ,p_object_version_number =>p_rec.object_version_number
240 ,p_id_value =>p_rec.id_value
241 ,p_fk_value1 =>p_rec.fk_value1
242 ,p_fk_value2 =>p_rec.fk_value2
243 ,p_fk_value3 =>p_rec.fk_value3
244 ,p_text_value1 =>p_rec.text_value1
245 ,p_text_value2 =>p_rec.text_value2
246 ,p_text_value3 =>p_rec.text_value3
247 ,p_text_value4 =>p_rec.text_value4
248 ,p_text_value5 =>p_rec.text_value5
249 ,p_text_value6 =>p_rec.text_value6
250 ,p_text_value7 =>p_rec.text_value7
251 ,p_num_value1 =>p_rec.num_value1
252 ,p_num_value2 =>p_rec.num_value2
253 ,p_num_value3 =>p_rec.num_value3
254 ,p_date_value1 =>p_rec.date_value1
255 ,p_date_value2 =>p_rec.date_value2
256 ,p_date_value3 =>p_rec.date_value3
257 );
258 */
259 null;
260 --
261 exception
262 --
263 when hr_api.cannot_find_prog_unit then
264 --
265 hr_api.cannot_find_prog_unit_error
266 (p_module_name => 'hr_summary'
267 ,p_hook_type => 'AI');
268 --
269 end;
270 --
271 -- End of API User Hook for post_insert.
272 --
273 --
274 hr_utility.set_location(' Leaving:'||l_proc, 10);
275 End post_insert;
276 --
277 -- ----------------------------------------------------------------------------
278 -- |---------------------------------< ins >----------------------------------|
279 -- ----------------------------------------------------------------------------
280 Procedure ins
281 (
282 p_rec in out nocopy per_bil_shd.g_rec_type
283 ) is
284 --
285 l_proc varchar2(72) := g_package||'ins';
286 --
287 Begin
288 hr_utility.set_location('Entering:'||l_proc, 5);
289 --
290 -- Call the supporting insert validate operations
291 --
292 per_bil_bus.insert_validate(p_rec);
293 --
294 -- Call the supporting pre-insert operation
295 --
296 pre_insert(p_rec);
297 --
298 -- Insert the row
299 --
300 insert_dml(p_rec);
301 --
302 -- Call the supporting post-insert operation
303 --
304 post_insert(p_rec);
305 end ins;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |---------------------------------< ins >----------------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure ins
311 (
312 p_type in varchar2 default null,
313 p_business_group_id in number default null,
314 p_object_version_number out nocopy number,
315 p_id_value out nocopy number,
316 p_fk_value1 in number default null,
317 p_fk_value2 in number default null,
318 p_fk_value3 in number default null,
319 p_text_value1 in varchar2 default null,
320 p_text_value2 in varchar2 default null,
321 p_text_value3 in varchar2 default null,
322 p_text_value4 in varchar2 default null,
323 p_text_value5 in varchar2 default null,
324 p_text_value6 in varchar2 default null,
325 p_text_value7 in varchar2 default null,
326 p_num_value1 in number default null,
327 p_num_value2 in number default null,
328 p_num_value3 in number default null,
329 p_date_value1 in date default null,
330 p_date_value2 in date default null,
331 p_date_value3 in date default null
332 ) is
333 --
334 l_rec per_bil_shd.g_rec_type;
335 l_proc varchar2(72) := g_package||'ins';
336 --
337 Begin
338 hr_utility.set_location('Entering:'||l_proc, 5);
339 --
340 -- Call conversion function to turn arguments into the
341 -- p_rec structure.
342 --
343 l_rec :=
344 per_bil_shd.convert_args
345 (
346 p_type,
347 p_business_group_id,
348 null,
349 null,
350 p_fk_value1,
351 p_fk_value2,
352 p_fk_value3,
353 p_text_value1,
354 p_text_value2,
355 p_text_value3,
356 p_text_value4,
357 p_text_value5,
358 p_text_value6,
359 p_text_value7,
360 p_num_value1,
361 p_num_value2,
362 p_num_value3,
363 p_date_value1,
364 p_date_value2,
365 p_date_value3
366 );
367 --
368 -- Having converted the arguments into the per_bil_rec
369 -- plsql record structure we call the corresponding record business process.
370 --
371 ins(l_rec);
372 --
373 -- As the primary key argument(s)
374 -- are specified as an OUT's we must set these values.
375 --
376 p_id_value := l_rec.id_value;
377 p_object_version_number := l_rec.object_version_number;
378 --
379 hr_utility.set_location(' Leaving:'||l_proc, 10);
380 End ins;
381 --
382 end per_bil_ins;