1 Package Body per_sha_ins as
2 /* $Header: pesharhi.pkb 115.6 2002/12/06 16:54:11 eumenyio ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sha_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 insert the row into the schema.
21 -- 3) To trap any constraint violations that may have occurred.
22 -- 4) To raise any other errors.
23 --
24 -- Prerequisites:
25 -- This is an internal private procedure which must be called from the ins
26 -- procedure and must have all mandatory attributes set (except the
27 -- object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 -- A Pl/Sql record structre.
31 --
32 -- Post Success:
33 -- The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 -- If a check, unique or parent integrity constraint violation is raised the
37 -- constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 -- None.
41 --
42 -- Access Status:
43 -- Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy per_sha_shd.g_rec_type) is
48 --
49 l_proc varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52 hr_utility.set_location('Entering:'||l_proc, 5);
53 p_rec.object_version_number := 1; -- Initialise the object version
54 --
55 --
56 -- Insert the row into: per_std_holiday_absences
57 --
58 insert into per_std_holiday_absences
59 ( std_holiday_absences_id,
60 date_not_taken,
61 person_id,
62 standard_holiday_id,
63 actual_date_taken,
64 reason,
65 expired,
66 attribute_category,
67 attribute1,
68 attribute2,
69 attribute3,
70 attribute4,
71 attribute5,
72 attribute6,
73 attribute7,
74 attribute8,
75 attribute9,
76 attribute10,
77 attribute11,
78 attribute12,
79 attribute13,
80 attribute14,
81 attribute15,
85 attribute19,
82 attribute16,
83 attribute17,
84 attribute18,
86 attribute20,
87 object_version_number
88 )
89 Values
90 ( p_rec.std_holiday_absences_id,
91 p_rec.date_not_taken,
92 p_rec.person_id,
93 p_rec.standard_holiday_id,
94 p_rec.actual_date_taken,
95 p_rec.reason,
96 p_rec.expired,
97 p_rec.attribute_category,
98 p_rec.attribute1,
99 p_rec.attribute2,
100 p_rec.attribute3,
101 p_rec.attribute4,
102 p_rec.attribute5,
103 p_rec.attribute6,
104 p_rec.attribute7,
105 p_rec.attribute8,
106 p_rec.attribute9,
107 p_rec.attribute10,
108 p_rec.attribute11,
109 p_rec.attribute12,
110 p_rec.attribute13,
111 p_rec.attribute14,
112 p_rec.attribute15,
113 p_rec.attribute16,
114 p_rec.attribute17,
115 p_rec.attribute18,
116 p_rec.attribute19,
117 p_rec.attribute20,
118 p_rec.object_version_number
119 );
120 --
121 hr_utility.set_location(' Leaving:'||l_proc, 10);
122 Exception
123 When hr_api.check_integrity_violated Then
124 -- A check constraint has been violated
125 per_sha_shd.constraint_error
126 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
127 When hr_api.parent_integrity_violated Then
128 -- Parent integrity has been violated
129 per_sha_shd.constraint_error
130 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
131 When hr_api.unique_integrity_violated Then
132 -- Unique integrity has been violated
133 per_sha_shd.constraint_error
134 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
135 When Others Then
136 Raise;
137 End insert_dml;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |------------------------------< pre_insert >------------------------------|
141 -- ----------------------------------------------------------------------------
142 -- {Start Of Comments}
143 --
144 -- Description:
145 -- This private procedure contains any processing which is required before
146 -- the insert dml. Presently, if the entity has a corresponding primary
147 -- key which is maintained by an associating sequence, the primary key for
148 -- the entity will be populated with the next sequence value in
149 -- preparation for the insert dml.
150 --
151 -- Prerequisites:
152 -- This is an internal procedure which is called from the ins procedure.
153 --
154 -- In Parameters:
155 -- A Pl/Sql record structre.
156 --
157 -- Post Success:
158 -- Processing continues.
159 --
160 -- Post Failure:
161 -- If an error has occurred, an error message and exception will be raised
162 -- but not handled.
163 --
164 -- Developer Implementation Notes:
165 -- Any pre-processing required before the insert dml is issued should be
166 -- coded within this procedure. As stated above, a good example is the
167 -- generation of a primary key number via a corresponding sequence.
168 -- It is important to note that any 3rd party maintenance should be reviewed
169 -- before placing in this procedure.
170 --
171 -- Access Status:
172 -- Internal Row Handler Use Only.
173 --
174 -- {End Of Comments}
175 -- ----------------------------------------------------------------------------
176 Procedure pre_insert(p_rec in out nocopy per_sha_shd.g_rec_type) is
177 --
178 l_proc varchar2(72) := g_package||'pre_insert';
179 --
180 Cursor C_Sel1 is select per_std_holiday_absences_s.nextval from sys.dual;
181 --
182 Begin
183 hr_utility.set_location('Entering:'||l_proc, 5);
184 --
185 --
186 -- Select the next sequence number
187 --
188 Open C_Sel1;
189 Fetch C_Sel1 Into p_rec.std_holiday_absences_id;
190 Close C_Sel1;
191 --
192 hr_utility.set_location(' Leaving:'||l_proc, 10);
193 End pre_insert;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< post_insert >------------------------------|
197 -- ----------------------------------------------------------------------------
198 -- {Start Of Comments}
199 --
200 -- Description:
201 -- This private procedure contains any processing which is required after the
202 -- insert dml.
203 --
204 -- Prerequisites:
205 -- This is an internal procedure which is called from the ins procedure.
206 --
207 -- In Parameters:
208 -- A Pl/Sql record structre.
209 --
210 -- Post Success:
211 -- Processing continues.
212 --
213 -- Post Failure:
214 -- If an error has occurred, an error message and exception will be raised
215 -- but not handled.
216 --
217 -- Developer Implementation Notes:
218 -- Any post-processing required after the insert dml is issued should be
219 -- coded within this procedure. It is important to note that any 3rd party
220 -- maintenance should be reviewed before placing in this procedure.
221 --
222 -- Access Status:
223 -- Internal Row Handler Use Only.
224 --
225 -- {End Of Comments}
226 -- ----------------------------------------------------------------------------
227 Procedure post_insert(p_rec in per_sha_shd.g_rec_type) is
228 --
229 l_proc varchar2(72) := g_package||'post_insert';
230 --
231 Begin
232 hr_utility.set_location('Entering:'||l_proc, 5);
233 --
234 -- Start of API User Hook for post_insert.
235 begin
236 per_sha_rki.after_insert
237 (p_std_holiday_absences_id => p_rec.std_holiday_absences_id
238 ,p_date_not_taken => p_rec.date_not_taken
239 ,p_person_id => p_rec.person_id
240 ,p_standard_holiday_id => p_rec.standard_holiday_id
241 ,p_actual_date_taken => p_rec.actual_date_taken
242 ,p_reason => p_rec.reason
243 ,p_expired => p_rec.expired
244 ,p_attribute_category => p_rec.attribute_category
245 ,p_attribute1 => p_rec.attribute1
246 ,p_attribute2 => p_rec.attribute2
247 ,p_attribute3 => p_rec.attribute3
248 ,p_attribute4 => p_rec.attribute4
249 ,p_attribute5 => p_rec.attribute5
250 ,p_attribute6 => p_rec.attribute6
251 ,p_attribute7 => p_rec.attribute7
252 ,p_attribute8 => p_rec.attribute8
253 ,p_attribute9 => p_rec.attribute9
254 ,p_attribute10 => p_rec.attribute10
255 ,p_attribute11 => p_rec.attribute11
256 ,p_attribute12 => p_rec.attribute12
257 ,p_attribute13 => p_rec.attribute13
258 ,p_attribute14 => p_rec.attribute14
259 ,p_attribute15 => p_rec.attribute15
260 ,p_attribute16 => p_rec.attribute16
261 ,p_attribute17 => p_rec.attribute17
262 ,p_attribute18 => p_rec.attribute18
263 ,p_attribute19 => p_rec.attribute19
264 ,p_attribute20 => p_rec.attribute20
265 ,p_object_version_number => p_rec.object_version_number
266 );
267 exception
268 when hr_api.cannot_find_prog_unit then
269 hr_api.cannot_find_prog_unit_error
270 (p_module_name => 'PER_STD_HOLIDAY_ABSENCES'
271 ,p_hook_type => 'AI'
272 );
273 end;
274 -- End of API User Hook for post_insert.
275 hr_utility.set_location(' Leaving:'||l_proc, 10);
276 End post_insert;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |---------------------------------< ins >----------------------------------|
280 -- ----------------------------------------------------------------------------
281 Procedure ins
282 (
283 p_rec in out nocopy per_sha_shd.g_rec_type
284 ) is
285 --
286 l_proc varchar2(72) := g_package||'ins';
287 --
288 Begin
289 hr_utility.set_location('Entering:'||l_proc, 5);
290 --
291 -- Call the supporting insert validate operations
292 --
293 per_sha_bus.insert_validate(p_rec);
294 --
295 -- Call the supporting pre-insert operation
296 --
297 pre_insert(p_rec);
298 --
299 -- Insert the row
300 --
301 insert_dml(p_rec);
302 --
303 -- Call the supporting post-insert operation
304 --
305 post_insert(p_rec);
306 end ins;
307 --
308 -- ----------------------------------------------------------------------------
309 -- |---------------------------------< ins >----------------------------------|
310 -- ----------------------------------------------------------------------------
311 Procedure ins
312 (
313 p_std_holiday_absences_id out nocopy number,
314 p_date_not_taken in date,
315 p_person_id in number,
316 p_standard_holiday_id in number,
317 p_actual_date_taken in date default null,
318 p_reason in varchar2 default null,
319 p_expired in varchar2 default null,
320 p_attribute_category in varchar2 default null,
321 p_attribute1 in varchar2 default null,
322 p_attribute2 in varchar2 default null,
323 p_attribute3 in varchar2 default null,
324 p_attribute4 in varchar2 default null,
325 p_attribute5 in varchar2 default null,
326 p_attribute6 in varchar2 default null,
327 p_attribute7 in varchar2 default null,
328 p_attribute8 in varchar2 default null,
329 p_attribute9 in varchar2 default null,
330 p_attribute10 in varchar2 default null,
331 p_attribute11 in varchar2 default null,
332 p_attribute12 in varchar2 default null,
333 p_attribute13 in varchar2 default null,
334 p_attribute14 in varchar2 default null,
335 p_attribute15 in varchar2 default null,
336 p_attribute16 in varchar2 default null,
337 p_attribute17 in varchar2 default null,
338 p_attribute18 in varchar2 default null,
339 p_attribute19 in varchar2 default null,
340 p_attribute20 in varchar2 default null,
341 p_object_version_number out nocopy number
342 ) is
343 --
344 l_rec per_sha_shd.g_rec_type;
345 l_proc varchar2(72) := g_package||'ins';
346 --
347 Begin
348 hr_utility.set_location('Entering:'||l_proc, 5);
349 --
350 -- Call conversion function to turn arguments into the
351 -- p_rec structure.
352 --
353 l_rec :=
354 per_sha_shd.convert_args
355 (
356 null,
357 p_date_not_taken,
358 p_person_id,
359 p_standard_holiday_id,
360 p_actual_date_taken,
361 p_reason,
362 p_expired,
363 p_attribute_category,
364 p_attribute1,
365 p_attribute2,
366 p_attribute3,
367 p_attribute4,
368 p_attribute5,
369 p_attribute6,
370 p_attribute7,
371 p_attribute8,
372 p_attribute9,
373 p_attribute10,
374 p_attribute11,
375 p_attribute12,
376 p_attribute13,
377 p_attribute14,
378 p_attribute15,
379 p_attribute16,
380 p_attribute17,
381 p_attribute18,
382 p_attribute19,
383 p_attribute20,
384 null
385 );
386 --
387 -- Having converted the arguments into the per_sha_rec
388 -- plsql record structure we call the corresponding record business process.
389 --
390 ins(l_rec);
391 --
392 -- As the primary key argument(s)
393 -- are specified as an OUT's we must set these values.
394 --
395 p_std_holiday_absences_id := l_rec.std_holiday_absences_id;
396 p_object_version_number := l_rec.object_version_number;
397 --
398 hr_utility.set_location(' Leaving:'||l_proc, 10);
399 End ins;
400 --
401 end per_sha_ins;