[Home] [Help]
PACKAGE BODY: APPS.PQH_TJR_INS
Source
1 Package Body pqh_tjr_ins as
2 /* $Header: pqtjrrhi.pkb 115.3 2002/12/12 21:47:19 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_tjr_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
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
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
54 (p_rec in out nocopy pqh_tjr_shd.g_rec_type
55 ) is
56 --
57 l_proc varchar2(72) := g_package||'insert_dml';
58 --
59 Begin
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 p_rec.object_version_number := 1; -- Initialise the object version
62 --
63 --
64 --
65 -- Insert the row into: pqh_txn_job_requirements
66 --
67 insert into pqh_txn_job_requirements
68 (txn_job_requirement_id
69 ,position_transaction_id
70 ,job_requirement_id
71 ,business_group_id
72 ,analysis_criteria_id
73 ,date_from
74 ,date_to
75 ,essential
76 ,job_id
77 ,object_version_number
78 ,request_id
79 ,program_application_id
80 ,program_id
81 ,program_update_date
82 ,attribute_category
83 ,attribute1
84 ,attribute2
85 ,attribute3
86 ,attribute4
87 ,attribute5
88 ,attribute6
89 ,attribute7
90 ,attribute8
91 ,attribute9
92 ,attribute10
93 ,attribute11
94 ,attribute12
95 ,attribute13
96 ,attribute14
97 ,attribute15
98 ,attribute16
99 ,attribute17
100 ,attribute18
101 ,attribute19
102 ,attribute20
103 ,comments
104 )
105 Values
106 (p_rec.txn_job_requirement_id
107 ,p_rec.position_transaction_id
108 ,p_rec.job_requirement_id
109 ,p_rec.business_group_id
110 ,p_rec.analysis_criteria_id
111 ,p_rec.date_from
112 ,p_rec.date_to
113 ,p_rec.essential
114 ,p_rec.job_id
115 ,p_rec.object_version_number
116 ,p_rec.request_id
117 ,p_rec.program_application_id
118 ,p_rec.program_id
119 ,p_rec.program_update_date
120 ,p_rec.attribute_category
121 ,p_rec.attribute1
122 ,p_rec.attribute2
123 ,p_rec.attribute3
124 ,p_rec.attribute4
125 ,p_rec.attribute5
126 ,p_rec.attribute6
127 ,p_rec.attribute7
128 ,p_rec.attribute8
129 ,p_rec.attribute9
130 ,p_rec.attribute10
131 ,p_rec.attribute11
132 ,p_rec.attribute12
133 ,p_rec.attribute13
134 ,p_rec.attribute14
135 ,p_rec.attribute15
136 ,p_rec.attribute16
137 ,p_rec.attribute17
138 ,p_rec.attribute18
139 ,p_rec.attribute19
140 ,p_rec.attribute20
141 ,p_rec.comments
142 );
143 --
144 --
145 --
146 hr_utility.set_location(' Leaving:'||l_proc, 10);
147 Exception
148 When hr_api.check_integrity_violated Then
149 -- A check constraint has been violated
150 --
151 pqh_tjr_shd.constraint_error
152 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153 When hr_api.parent_integrity_violated Then
154 -- Parent integrity has been violated
155 --
156 pqh_tjr_shd.constraint_error
157 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158 When hr_api.unique_integrity_violated Then
159 -- Unique integrity has been violated
160 --
161 pqh_tjr_shd.constraint_error
162 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163 When Others Then
164 --
165 Raise;
166 End insert_dml;
167 --
168 -- ----------------------------------------------------------------------------
169 -- |------------------------------< pre_insert >------------------------------|
170 -- ----------------------------------------------------------------------------
171 -- {Start Of Comments}
172 --
173 -- Description:
174 -- This private procedure contains any processing which is required before
175 -- the insert dml. Presently, if the entity has a corresponding primary
176 -- key which is maintained by an associating sequence, the primary key for
177 -- the entity will be populated with the next sequence value in
178 -- preparation for the insert dml.
179 --
180 -- Prerequisites:
181 -- This is an internal procedure which is called from the ins procedure.
182 --
183 -- In Parameters:
184 -- A Pl/Sql record structre.
185 --
186 -- Post Success:
187 -- Processing continues.
188 --
189 -- Post Failure:
190 -- If an error has occurred, an error message and exception will be raised
191 -- but not handled.
192 --
193 -- Developer Implementation Notes:
194 -- Any pre-processing required before the insert dml is issued should be
195 -- coded within this procedure. As stated above, a good example is the
196 -- generation of a primary key number via a corresponding sequence.
197 -- It is important to note that any 3rd party maintenance should be reviewed
198 -- before placing in this procedure.
199 --
200 -- Access Status:
201 -- Internal Row Handler Use Only.
202 --
203 -- {End Of Comments}
204 -- ----------------------------------------------------------------------------
205 Procedure pre_insert
206 (p_rec in out nocopy pqh_tjr_shd.g_rec_type
207 ) is
208 --
209 l_proc varchar2(72) := g_package||'pre_insert';
210 --
211 Cursor C_Sel1 is select pqh_txn_job_requirements_s.nextval from sys.dual;
212 --
213 Begin
214 hr_utility.set_location('Entering:'||l_proc, 5);
215 --
216 --
217 -- Select the next sequence number
218 --
219 Open C_Sel1;
220 Fetch C_Sel1 Into p_rec.txn_job_requirement_id;
221 Close C_Sel1;
222 --
223 hr_utility.set_location(' Leaving:'||l_proc, 10);
224 End pre_insert;
225 --
226 -- ----------------------------------------------------------------------------
227 -- |-----------------------------< post_insert >------------------------------|
228 -- ----------------------------------------------------------------------------
229 -- {Start Of Comments}
230 --
231 -- Description:
232 -- This private procedure contains any processing which is required after
233 -- the insert dml.
234 --
235 -- Prerequisites:
236 -- This is an internal procedure which is called from the ins procedure.
237 --
238 -- In Parameters:
239 -- A Pl/Sql record structre.
240 --
241 -- Post Success:
242 -- Processing continues.
243 --
244 -- Post Failure:
245 -- If an error has occurred, an error message and exception will be raised
246 -- but not handled.
247 --
248 -- Developer Implementation Notes:
249 -- Any post-processing required after the insert dml is issued should be
250 -- coded within this procedure. It is important to note that any 3rd party
251 -- maintenance should be reviewed before placing in this procedure.
252 --
253 -- Access Status:
254 -- Internal Row Handler Use Only.
255 --
256 -- {End Of Comments}
257 -- ----------------------------------------------------------------------------
258 Procedure post_insert
259 (p_rec in pqh_tjr_shd.g_rec_type
260 ) is
261 --
262 l_proc varchar2(72) := g_package||'post_insert';
263 --
264 Begin
265 hr_utility.set_location('Entering:'||l_proc, 5);
266 begin
267 --
268 pqh_tjr_rki.after_insert
269 (p_txn_job_requirement_id
270 => p_rec.txn_job_requirement_id
271 ,p_position_transaction_id
272 => p_rec.position_transaction_id
273 ,p_job_requirement_id
274 => p_rec.job_requirement_id
275 ,p_business_group_id
276 => p_rec.business_group_id
277 ,p_analysis_criteria_id
278 => p_rec.analysis_criteria_id
279 ,p_date_from
280 => p_rec.date_from
281 ,p_date_to
282 => p_rec.date_to
283 ,p_essential
284 => p_rec.essential
285 ,p_job_id
286 => p_rec.job_id
287 ,p_object_version_number
288 => p_rec.object_version_number
289 ,p_request_id
290 => p_rec.request_id
291 ,p_program_application_id
292 => p_rec.program_application_id
293 ,p_program_id
294 => p_rec.program_id
295 ,p_program_update_date
296 => p_rec.program_update_date
297 ,p_attribute_category
298 => p_rec.attribute_category
299 ,p_attribute1
300 => p_rec.attribute1
301 ,p_attribute2
302 => p_rec.attribute2
303 ,p_attribute3
304 => p_rec.attribute3
305 ,p_attribute4
306 => p_rec.attribute4
307 ,p_attribute5
308 => p_rec.attribute5
309 ,p_attribute6
310 => p_rec.attribute6
311 ,p_attribute7
312 => p_rec.attribute7
313 ,p_attribute8
314 => p_rec.attribute8
315 ,p_attribute9
316 => p_rec.attribute9
317 ,p_attribute10
318 => p_rec.attribute10
319 ,p_attribute11
320 => p_rec.attribute11
321 ,p_attribute12
322 => p_rec.attribute12
323 ,p_attribute13
324 => p_rec.attribute13
325 ,p_attribute14
326 => p_rec.attribute14
327 ,p_attribute15
328 => p_rec.attribute15
329 ,p_attribute16
330 => p_rec.attribute16
331 ,p_attribute17
332 => p_rec.attribute17
333 ,p_attribute18
334 => p_rec.attribute18
335 ,p_attribute19
336 => p_rec.attribute19
337 ,p_attribute20
338 => p_rec.attribute20
339 ,p_comments
340 => p_rec.comments
341 );
342 --
343 exception
344 --
345 when hr_api.cannot_find_prog_unit then
346 --
347 hr_api.cannot_find_prog_unit_error
348 (p_module_name => 'PQH_TXN_JOB_REQUIREMENTS'
349 ,p_hook_type => 'AI');
350 --
351 end;
352 --
353 hr_utility.set_location(' Leaving:'||l_proc, 10);
354 End post_insert;
355 --
356 -- ----------------------------------------------------------------------------
357 -- |---------------------------------< ins >----------------------------------|
358 -- ----------------------------------------------------------------------------
359 Procedure ins
360 (p_rec in out nocopy pqh_tjr_shd.g_rec_type
361 ) is
362 --
363 l_proc varchar2(72) := g_package||'ins';
364 --
365 Begin
366 hr_utility.set_location('Entering:'||l_proc, 5);
367 --
368 -- Call the supporting insert validate operations
369 --
370 pqh_tjr_bus.insert_validate
371 (p_rec
372 );
373 --
374 -- Call the supporting pre-insert operation
375 --
376 pqh_tjr_ins.pre_insert(p_rec);
377 --
378 -- Insert the row
379 --
380 pqh_tjr_ins.insert_dml(p_rec);
381 --
382 -- Call the supporting post-insert operation
383 --
384 pqh_tjr_ins.post_insert
385 (p_rec
386 );
387 --
388 hr_utility.set_location('Leaving:'||l_proc, 20);
389 end ins;
390 --
391 -- ----------------------------------------------------------------------------
392 -- |---------------------------------< ins >----------------------------------|
393 -- ----------------------------------------------------------------------------
394 Procedure ins
395 (p_business_group_id in number
396 ,p_analysis_criteria_id in number
397 ,p_position_transaction_id in number default null
398 ,p_job_requirement_id in number default null
399 ,p_date_from in date default null
400 ,p_date_to in date default null
401 ,p_essential in varchar2 default null
402 ,p_job_id in number default null
403 ,p_request_id in number default null
404 ,p_program_application_id in number default null
405 ,p_program_id in number default null
406 ,p_program_update_date in date default null
407 ,p_attribute_category in varchar2 default null
408 ,p_attribute1 in varchar2 default null
409 ,p_attribute2 in varchar2 default null
410 ,p_attribute3 in varchar2 default null
411 ,p_attribute4 in varchar2 default null
412 ,p_attribute5 in varchar2 default null
413 ,p_attribute6 in varchar2 default null
414 ,p_attribute7 in varchar2 default null
415 ,p_attribute8 in varchar2 default null
416 ,p_attribute9 in varchar2 default null
417 ,p_attribute10 in varchar2 default null
418 ,p_attribute11 in varchar2 default null
419 ,p_attribute12 in varchar2 default null
420 ,p_attribute13 in varchar2 default null
421 ,p_attribute14 in varchar2 default null
422 ,p_attribute15 in varchar2 default null
423 ,p_attribute16 in varchar2 default null
424 ,p_attribute17 in varchar2 default null
425 ,p_attribute18 in varchar2 default null
426 ,p_attribute19 in varchar2 default null
427 ,p_attribute20 in varchar2 default null
428 ,p_comments in varchar2 default null
429 ,p_txn_job_requirement_id out nocopy number
430 ,p_object_version_number out nocopy number
431 ) is
432 --
433 l_rec pqh_tjr_shd.g_rec_type;
434 l_proc varchar2(72) := g_package||'ins';
435 --
436 Begin
437 hr_utility.set_location('Entering:'||l_proc, 5);
438 --
439 -- Call conversion function to turn arguments into the
440 -- p_rec structure.
441 --
442 l_rec :=
443 pqh_tjr_shd.convert_args
444 (null
445 ,p_position_transaction_id
446 ,p_job_requirement_id
447 ,p_business_group_id
448 ,p_analysis_criteria_id
449 ,p_date_from
450 ,p_date_to
451 ,p_essential
452 ,p_job_id
453 ,null
454 ,p_request_id
455 ,p_program_application_id
456 ,p_program_id
457 ,p_program_update_date
458 ,p_attribute_category
459 ,p_attribute1
460 ,p_attribute2
461 ,p_attribute3
462 ,p_attribute4
463 ,p_attribute5
464 ,p_attribute6
465 ,p_attribute7
466 ,p_attribute8
467 ,p_attribute9
468 ,p_attribute10
469 ,p_attribute11
470 ,p_attribute12
471 ,p_attribute13
472 ,p_attribute14
473 ,p_attribute15
474 ,p_attribute16
475 ,p_attribute17
476 ,p_attribute18
477 ,p_attribute19
478 ,p_attribute20
479 ,p_comments
480 );
481 --
482 -- Having converted the arguments into the pqh_tjr_rec
483 -- plsql record structure we call the corresponding record business process.
484 --
485 pqh_tjr_ins.ins
486 (l_rec
487 );
488 --
489 -- As the primary key argument(s)
490 -- are specified as an OUT's we must set these values.
491 --
492 p_txn_job_requirement_id := l_rec.txn_job_requirement_id;
493 p_object_version_number := l_rec.object_version_number;
494 --
495 hr_utility.set_location(' Leaving:'||l_proc, 10);
496 End ins;
497 --
498 end pqh_tjr_ins;