[Home] [Help]
PACKAGE BODY: APPS.IGF_AW_FISAP_II_H_PKG
Source
1 PACKAGE BODY igf_aw_fisap_ii_h_pkg AS
2 /* $Header: IGFWI44B.pls 115.5 2002/11/28 14:42:52 nsidana noship $ */
3
4 l_rowid VARCHAR2(25);
5 old_references igf_aw_fisap_ii_h%ROWTYPE;
6 new_references igf_aw_fisap_ii_h%ROWTYPE;
7
8 PROCEDURE set_column_values (
9 p_action IN VARCHAR2,
10 x_rowid IN VARCHAR2 DEFAULT NULL,
11 x_fisap_id IN NUMBER DEFAULT NULL,
12 x_category_id IN NUMBER DEFAULT NULL,
13 x_fisap_section IN VARCHAR2 DEFAULT NULL,
14 x_depend_stat IN VARCHAR2 DEFAULT NULL,
15 x_class_standing IN VARCHAR2 DEFAULT NULL,
16 x_student_count IN NUMBER DEFAULT NULL,
17 x_auto_efc IN VARCHAR2 DEFAULT NULL,
18 x_minvalue IN NUMBER DEFAULT NULL,
19 x_maxvalue IN NUMBER DEFAULT NULL,
20 x_ci_cal_type IN VARCHAR2 DEFAULT NULL,
21 x_ci_sequence_number IN NUMBER DEFAULT NULL,
22 x_creation_date IN DATE DEFAULT NULL,
23 x_created_by IN NUMBER DEFAULT NULL,
24 x_last_update_date IN DATE DEFAULT NULL,
25 x_last_updated_by IN NUMBER DEFAULT NULL,
26 x_last_update_login IN NUMBER DEFAULT NULL
27 ) AS
28 /*
29 || Created By : ssawhney
30 || Created On : 22-OCT-2001
31 || Purpose : Initialises the Old and New references for the columns of the table.
32 || Known limitations, enhancements or remarks :
33 || Change History :
34 || Who When What
35 || (reverse chronological order - newest change first)
36 */
37
38 CURSOR cur_old_ref_values IS
39 SELECT *
40 FROM IGF_AW_FISAP_II_H
41 WHERE rowid = x_rowid;
42
43 BEGIN
44
45 l_rowid := x_rowid;
46
47 -- Code for setting the Old and New Reference Values.
48 -- Populate Old Values.
49 OPEN cur_old_ref_values;
50 FETCH cur_old_ref_values INTO old_references;
51 IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
52 CLOSE cur_old_ref_values;
53 fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
54 igs_ge_msg_stack.add;
55 app_exception.raise_exception;
56 RETURN;
57 END IF;
58 CLOSE cur_old_ref_values;
59
60 -- Populate New Values.
61 new_references.fisap_id := x_fisap_id;
62 new_references.category_id := x_category_id;
63 new_references.fisap_section := x_fisap_section;
64 new_references.depend_stat := x_depend_stat;
65 new_references.class_standing := x_class_standing;
66 new_references.student_count := x_student_count;
67 new_references.auto_efc := x_auto_efc;
68 new_references.minvalue := x_minvalue;
69 new_references.maxvalue := x_maxvalue;
70 new_references.ci_cal_type := x_ci_cal_type;
71 new_references.ci_sequence_number := x_ci_sequence_number;
72
73 IF (p_action = 'UPDATE') THEN
74 new_references.creation_date := old_references.creation_date;
75 new_references.created_by := old_references.created_by;
76 ELSE
77 new_references.creation_date := x_creation_date;
78 new_references.created_by := x_created_by;
79 END IF;
80
81 new_references.last_update_date := x_last_update_date;
82 new_references.last_updated_by := x_last_updated_by;
83 new_references.last_update_login := x_last_update_login;
84
85 END set_column_values;
86
87
88 PROCEDURE check_parent_existance AS
89 /*
90 || Created By : ssawhney
91 || Created On : 22-OCT-2001
92 || Purpose : Checks for the existance of Parent records.
93 || Known limitations, enhancements or remarks :
94 || Change History :
95 || Who When What
96 || (reverse chronological order - newest change first)
97 */
98 BEGIN
99
100 IF (((old_references.category_id = new_references.category_id)) OR
101 ((new_references.category_id IS NULL))) THEN
102 NULL;
103 ELSIF NOT igf_aw_fisap_repset_pkg.get_pk_for_validation (
104 new_references.category_id
105 ) THEN
106 fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
107 igs_ge_msg_stack.add;
108 app_exception.raise_exception;
109 END IF;
110
111 END check_parent_existance;
112
113
114 FUNCTION get_pk_for_validation (
115 x_fisap_id IN NUMBER
116 ) RETURN BOOLEAN AS
117 /*
118 || Created By : ssawhney
119 || Created On : 22-OCT-2001
120 || Purpose : Validates the Primary Key of the table.
121 || Known limitations, enhancements or remarks :
122 || Change History :
123 || Who When What
124 || (reverse chronological order - newest change first)
125 */
126 CURSOR cur_rowid IS
127 SELECT rowid
128 FROM igf_aw_fisap_ii_h
129 WHERE fisap_id = x_fisap_id
130 FOR UPDATE NOWAIT;
131
132 lv_rowid cur_rowid%RowType;
133
134 BEGIN
135
136 OPEN cur_rowid;
137 FETCH cur_rowid INTO lv_rowid;
138 IF (cur_rowid%FOUND) THEN
139 CLOSE cur_rowid;
140 RETURN(TRUE);
141 ELSE
142 CLOSE cur_rowid;
143 RETURN(FALSE);
144 END IF;
145
146 END get_pk_for_validation;
147
148
149 PROCEDURE get_fk_igf_aw_fisap_repset (
150 x_category_id IN NUMBER
151 ) AS
152 /*
153 || Created By : ssawhney
154 || Created On : 22-OCT-2001
155 || Purpose : Validates the Foreign Keys for the table.
156 || Known limitations, enhancements or remarks :
157 || Change History :
158 || Who When What
159 || (reverse chronological order - newest change first)
160 */
161 CURSOR cur_rowid IS
162 SELECT rowid
163 FROM igf_aw_fisap_ii_h
164 WHERE ((category_id = x_category_id));
165
166 lv_rowid cur_rowid%RowType;
167
168 BEGIN
169
170 OPEN cur_rowid;
171 FETCH cur_rowid INTO lv_rowid;
172 IF (cur_rowid%FOUND) THEN
173 CLOSE cur_rowid;
174 fnd_message.set_name ('IGF', 'IGF_AW_FISIIH_FISET_FK');
175 igs_ge_msg_stack.add;
176 app_exception.raise_exception;
177 RETURN;
178 END IF;
179 CLOSE cur_rowid;
180
181 END get_fk_igf_aw_fisap_repset;
182
183
184 PROCEDURE before_dml (
185 p_action IN VARCHAR2,
186 x_rowid IN VARCHAR2 DEFAULT NULL,
187 x_fisap_id IN NUMBER DEFAULT NULL,
188 x_category_id IN NUMBER DEFAULT NULL,
189 x_fisap_section IN VARCHAR2 DEFAULT NULL,
190 x_depend_stat IN VARCHAR2 DEFAULT NULL,
191 x_class_standing IN VARCHAR2 DEFAULT NULL,
192 x_student_count IN NUMBER DEFAULT NULL,
193 x_auto_efc IN VARCHAR2 DEFAULT NULL,
194 x_minvalue IN NUMBER DEFAULT NULL,
195 x_maxvalue IN NUMBER DEFAULT NULL,
196 x_ci_cal_type IN VARCHAR2 DEFAULT NULL,
197 x_ci_sequence_number IN NUMBER DEFAULT NULL,
198 x_creation_date IN DATE DEFAULT NULL,
199 x_created_by IN NUMBER DEFAULT NULL,
200 x_last_update_date IN DATE DEFAULT NULL,
201 x_last_updated_by IN NUMBER DEFAULT NULL,
202 x_last_update_login IN NUMBER DEFAULT NULL
203 ) AS
204 /*
205 || Created By : ssawhney
206 || Created On : 22-OCT-2001
207 || Purpose : Initialises the columns, Checks Constraints, Calls the
208 || Trigger Handlers for the table, before any DML operation.
209 || Known limitations, enhancements or remarks :
210 || Change History :
211 || Who When What
212 || (reverse chronological order - newest change first)
213 */
214 BEGIN
215
216 set_column_values (
217 p_action,
218 x_rowid,
219 x_fisap_id,
220 x_category_id,
221 x_fisap_section,
222 x_depend_stat,
223 x_class_standing,
224 x_student_count,
225 x_auto_efc,
226 x_minvalue,
227 x_maxvalue,
228 x_ci_cal_type,
229 x_ci_sequence_number,
230 x_creation_date,
231 x_created_by,
232 x_last_update_date,
233 x_last_updated_by,
234 x_last_update_login
235 );
236
237 IF (p_action = 'INSERT') THEN
238 -- Call all the procedures related to Before Insert.
239 IF ( get_pk_for_validation(
240 new_references.fisap_id
241 )
242 ) THEN
243 fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
244 igs_ge_msg_stack.add;
245 app_exception.raise_exception;
246 END IF;
247 check_parent_existance;
248 ELSIF (p_action = 'UPDATE') THEN
249 -- Call all the procedures related to Before Update.
250 check_parent_existance;
251 ELSIF (p_action = 'VALIDATE_INSERT') THEN
252 -- Call all the procedures related to Before Insert.
253 IF ( get_pk_for_validation (
254 new_references.fisap_id
255 )
256 ) THEN
257 fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
258 igs_ge_msg_stack.add;
259 app_exception.raise_exception;
260 END IF;
261 END IF;
262
263 END before_dml;
264
265
266 PROCEDURE insert_row (
267 x_rowid IN OUT NOCOPY VARCHAR2,
268 x_fisap_id IN OUT NOCOPY NUMBER,
269 x_category_id IN NUMBER,
270 x_fisap_section IN VARCHAR2,
271 x_depend_stat IN VARCHAR2,
272 x_class_standing IN VARCHAR2,
273 x_student_count IN NUMBER,
274 x_auto_efc IN VARCHAR2,
275 x_minvalue IN NUMBER,
276 x_maxvalue IN NUMBER,
277 x_ci_cal_type IN VARCHAR2,
278 x_ci_sequence_number IN NUMBER,
279 x_mode IN VARCHAR2 DEFAULT 'R'
280 ) AS
281 /*
282 || Created By : ssawhney
283 || Created On : 22-OCT-2001
284 || Purpose : Handles the INSERT DML logic for the table.
285 || Known limitations, enhancements or remarks :
286 || Change History :
287 || Who When What
288 || (reverse chronological order - newest change first)
289 */
290 CURSOR c IS
291 SELECT rowid
292 FROM igf_aw_fisap_ii_h
293 WHERE fisap_id = x_fisap_id;
294
295 x_last_update_date DATE;
296 x_last_updated_by NUMBER;
297 x_last_update_login NUMBER;
298
299 BEGIN
300
301 x_last_update_date := SYSDATE;
302 IF (x_mode = 'I') THEN
303 x_last_updated_by := 1;
304 x_last_update_login := 0;
305 ELSIF (x_mode = 'R') THEN
306 x_last_updated_by := fnd_global.user_id;
307 IF (x_last_updated_by IS NULL) THEN
308 x_last_updated_by := -1;
309 END IF;
310 x_last_update_login := fnd_global.login_id;
311 IF (x_last_update_login IS NULL) THEN
312 x_last_update_login := -1;
313 END IF;
314 ELSE
315 fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
316 igs_ge_msg_stack.add;
317 app_exception.raise_exception;
318 END IF;
319
320 SELECT igf_aw_fisap_ii_h_s.NEXTVAL
321 INTO x_fisap_id
322 FROM dual;
323
324 before_dml(
325 p_action => 'INSERT',
326 x_rowid => x_rowid,
327 x_fisap_id => x_fisap_id,
328 x_category_id => x_category_id,
329 x_fisap_section => x_fisap_section,
330 x_depend_stat => x_depend_stat,
331 x_class_standing => x_class_standing,
332 x_student_count => x_student_count,
333 x_auto_efc => x_auto_efc,
334 x_minvalue => x_minvalue,
335 x_maxvalue => x_maxvalue,
336 x_ci_cal_type => x_ci_cal_type,
337 x_ci_sequence_number => x_ci_sequence_number,
338 x_creation_date => x_last_update_date,
339 x_created_by => x_last_updated_by,
340 x_last_update_date => x_last_update_date,
341 x_last_updated_by => x_last_updated_by,
342 x_last_update_login => x_last_update_login
343 );
344
345 INSERT INTO igf_aw_fisap_ii_h (
346 fisap_id,
347 category_id,
348 fisap_section,
349 depend_stat,
350 class_standing,
351 student_count,
352 auto_efc,
353 minvalue,
354 maxvalue,
355 ci_cal_type,
356 ci_sequence_number,
357 creation_date,
358 created_by,
359 last_update_date,
360 last_updated_by,
361 last_update_login
362 ) VALUES (
363 new_references.fisap_id,
364 new_references.category_id,
365 new_references.fisap_section,
366 new_references.depend_stat,
367 new_references.class_standing,
368 new_references.student_count,
369 new_references.auto_efc,
370 new_references.minvalue,
371 new_references.maxvalue,
372 new_references.ci_cal_type,
373 new_references.ci_sequence_number,
374 x_last_update_date,
375 x_last_updated_by,
376 x_last_update_date,
377 x_last_updated_by,
378 x_last_update_login
379 );
380
381 OPEN c;
382 FETCH c INTO x_rowid;
383 IF (c%NOTFOUND) THEN
384 CLOSE c;
385 RAISE NO_DATA_FOUND;
386 END IF;
387 CLOSE c;
388
389 END insert_row;
390
391
392 PROCEDURE lock_row (
393 x_rowid IN VARCHAR2,
394 x_fisap_id IN NUMBER,
395 x_category_id IN NUMBER,
396 x_fisap_section IN VARCHAR2,
397 x_depend_stat IN VARCHAR2,
398 x_class_standing IN VARCHAR2,
399 x_student_count IN NUMBER,
400 x_auto_efc IN VARCHAR2,
404 x_ci_sequence_number IN NUMBER
401 x_minvalue IN NUMBER,
402 x_maxvalue IN NUMBER,
403 x_ci_cal_type IN VARCHAR2,
405 ) AS
406 /*
407 || Created By : ssawhney
408 || Created On : 22-OCT-2001
409 || Purpose : Handles the LOCK mechanism for the table.
410 || Known limitations, enhancements or remarks :
411 || Change History :
412 || Who When What
413 || (reverse chronological order - newest change first)
414 */
415 CURSOR c1 IS
416 SELECT
417 category_id,
418 fisap_section,
419 depend_stat,
420 class_standing,
421 student_count,
422 auto_efc,
423 minvalue,
424 maxvalue,
425 ci_cal_type,
426 ci_sequence_number
427 FROM igf_aw_fisap_ii_h
428 WHERE rowid = x_rowid
429 FOR UPDATE NOWAIT;
430
431 tlinfo c1%ROWTYPE;
432
433 BEGIN
434
435 OPEN c1;
436 FETCH c1 INTO tlinfo;
437 IF (c1%notfound) THEN
438 fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
439 igs_ge_msg_stack.add;
440 CLOSE c1;
441 app_exception.raise_exception;
442 RETURN;
443 END IF;
444 CLOSE c1;
445
446 IF (
447 ((tlinfo.category_id = x_category_id) OR ((tlinfo.category_id IS NULL) AND (X_category_id IS NULL)))
448 AND ((tlinfo.fisap_section = x_fisap_section) OR ((tlinfo.fisap_section IS NULL) AND (X_fisap_section IS NULL)))
449 AND ((tlinfo.depend_stat = x_depend_stat) OR ((tlinfo.depend_stat IS NULL) AND (X_depend_stat IS NULL)))
450 AND ((tlinfo.class_standing = x_class_standing) OR ((tlinfo.class_standing IS NULL) AND (X_class_standing IS NULL)))
451 AND ((tlinfo.student_count = x_student_count) OR ((tlinfo.student_count IS NULL) AND (X_student_count IS NULL)))
452 AND (tlinfo.auto_efc = x_auto_efc)
453 AND ((tlinfo.minvalue = x_minvalue) OR ((tlinfo.minvalue IS NULL) AND (X_minvalue IS NULL)))
454 AND ((tlinfo.maxvalue = x_maxvalue) OR ((tlinfo.maxvalue IS NULL) AND (X_maxvalue IS NULL)))
455 AND (tlinfo.ci_cal_type = x_ci_cal_type)
456 AND (tlinfo.ci_sequence_number = x_ci_sequence_number)
457 ) THEN
458 NULL;
459 ELSE
460 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
461 igs_ge_msg_stack.add;
462 app_exception.raise_exception;
463 END IF;
464
465 RETURN;
466
467 END lock_row;
468
469
470 PROCEDURE update_row (
471 x_rowid IN VARCHAR2,
472 x_fisap_id IN NUMBER,
473 x_category_id IN NUMBER,
474 x_fisap_section IN VARCHAR2,
475 x_depend_stat IN VARCHAR2,
476 x_class_standing IN VARCHAR2,
477 x_student_count IN NUMBER,
478 x_auto_efc IN VARCHAR2,
479 x_minvalue IN NUMBER,
480 x_maxvalue IN NUMBER,
481 x_ci_cal_type IN VARCHAR2,
482 x_ci_sequence_number IN NUMBER,
483 x_mode IN VARCHAR2 DEFAULT 'R'
484 ) AS
485 /*
486 || Created By : ssawhney
487 || Created On : 22-OCT-2001
488 || Purpose : Handles the UPDATE DML logic for the table.
489 || Known limitations, enhancements or remarks :
490 || Change History :
491 || Who When What
492 || (reverse chronological order - newest change first)
493 */
494 x_last_update_date DATE ;
495 x_last_updated_by NUMBER;
496 x_last_update_login NUMBER;
497
498 BEGIN
499
500 x_last_update_date := SYSDATE;
501 IF (X_MODE = 'I') THEN
502 x_last_updated_by := 1;
503 x_last_update_login := 0;
504 ELSIF (x_mode = 'R') THEN
505 x_last_updated_by := fnd_global.user_id;
506 IF x_last_updated_by IS NULL THEN
507 x_last_updated_by := -1;
508 END IF;
509 x_last_update_login := fnd_global.login_id;
510 IF (x_last_update_login IS NULL) THEN
511 x_last_update_login := -1;
512 END IF;
513 ELSE
514 fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
515 igs_ge_msg_stack.add;
516 app_exception.raise_exception;
517 END IF;
518
519 before_dml(
520 p_action => 'UPDATE',
521 x_rowid => x_rowid,
522 x_fisap_id => x_fisap_id,
523 x_category_id => x_category_id,
524 x_fisap_section => x_fisap_section,
525 x_depend_stat => x_depend_stat,
526 x_class_standing => x_class_standing,
527 x_student_count => x_student_count,
528 x_auto_efc => x_auto_efc,
529 x_minvalue => x_minvalue,
530 x_maxvalue => x_maxvalue,
534 x_created_by => x_last_updated_by,
531 x_ci_cal_type => x_ci_cal_type,
532 x_ci_sequence_number => x_ci_sequence_number,
533 x_creation_date => x_last_update_date,
535 x_last_update_date => x_last_update_date,
536 x_last_updated_by => x_last_updated_by,
537 x_last_update_login => x_last_update_login
538 );
539
540 UPDATE igf_aw_fisap_ii_h
541 SET
542 category_id = new_references.category_id,
543 fisap_section = new_references.fisap_section,
544 depend_stat = new_references.depend_stat,
545 class_standing = new_references.class_standing,
546 student_count = new_references.student_count,
547 auto_efc = new_references.auto_efc,
548 minvalue = new_references.minvalue,
549 maxvalue = new_references.maxvalue,
550 ci_cal_type = new_references.ci_cal_type,
551 ci_sequence_number = new_references.ci_sequence_number,
552 last_update_date = x_last_update_date,
553 last_updated_by = x_last_updated_by,
554 last_update_login = x_last_update_login
555 WHERE rowid = x_rowid;
556
557 IF (SQL%NOTFOUND) THEN
558 RAISE NO_DATA_FOUND;
559 END IF;
560
561 END update_row;
562
563
564 PROCEDURE add_row (
565 x_rowid IN OUT NOCOPY VARCHAR2,
566 x_fisap_id IN OUT NOCOPY NUMBER,
567 x_category_id IN NUMBER,
568 x_fisap_section IN VARCHAR2,
569 x_depend_stat IN VARCHAR2,
570 x_class_standing IN VARCHAR2,
571 x_student_count IN NUMBER,
572 x_auto_efc IN VARCHAR2,
573 x_minvalue IN NUMBER,
574 x_maxvalue IN NUMBER,
575 x_ci_cal_type IN VARCHAR2,
576 x_ci_sequence_number IN NUMBER,
577 x_mode IN VARCHAR2 DEFAULT 'R'
578 ) AS
579 /*
580 || Created By : ssawhney
581 || Created On : 22-OCT-2001
582 || Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
583 || Known limitations, enhancements or remarks :
584 || Change History :
585 || Who When What
586 || (reverse chronological order - newest change first)
587 */
588 CURSOR c1 IS
589 SELECT rowid
590 FROM igf_aw_fisap_ii_h
591 WHERE fisap_id = x_fisap_id;
592
593 BEGIN
594
595 OPEN c1;
596 FETCH c1 INTO x_rowid;
597 IF (c1%NOTFOUND) THEN
598 CLOSE c1;
599
600 insert_row (
601 x_rowid,
602 x_fisap_id,
603 x_category_id,
604 x_fisap_section,
605 x_depend_stat,
606 x_class_standing,
607 x_student_count,
608 x_auto_efc,
609 x_minvalue,
610 x_maxvalue,
611 x_ci_cal_type,
612 x_ci_sequence_number,
613 x_mode
614 );
615 RETURN;
616 END IF;
617 CLOSE c1;
618
619 update_row (
620 x_rowid,
621 x_fisap_id,
622 x_category_id,
623 x_fisap_section,
624 x_depend_stat,
625 x_class_standing,
626 x_student_count,
627 x_auto_efc,
628 x_minvalue,
629 x_maxvalue,
630 x_ci_cal_type,
631 x_ci_sequence_number,
632 x_mode
633 );
634
635 END add_row;
636
637
638 PROCEDURE delete_row (
639 x_rowid IN VARCHAR2
640 ) AS
641 /*
642 || Created By : ssawhney
643 || Created On : 22-OCT-2001
644 || Purpose : Handles the DELETE DML logic for the table.
645 || Known limitations, enhancements or remarks :
646 || Change History :
647 || Who When What
648 || (reverse chronological order - newest change first)
649 */
650 BEGIN
651
652 before_dml (
653 p_action => 'DELETE',
654 x_rowid => x_rowid
655 );
656
657 DELETE FROM igf_aw_fisap_ii_h
658 WHERE rowid = x_rowid;
659
660 IF (SQL%NOTFOUND) THEN
661 RAISE NO_DATA_FOUND;
662 END IF;
663
664 END delete_row;
665
666
667 END igf_aw_fisap_ii_h_pkg;