DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_PE_ATHLETIC_DTL_PKG

Source


1 PACKAGE BODY igs_pe_athletic_dtl_pkg AS
2 /* $Header: IGSNI95B.pls 120.1 2005/06/28 05:07:22 appldev ship $ */
3 
4   l_rowid VARCHAR2(25);
5   old_references igs_pe_athletic_dtl%ROWTYPE;
6   new_references igs_pe_athletic_dtl%ROWTYPE;
7 
8   PROCEDURE set_column_values (
9     p_action                            IN     VARCHAR2,
10     x_rowid                             IN     VARCHAR2  ,
11     x_athletic_details_id               IN     NUMBER    ,
12     x_person_id                         IN     NUMBER    ,
13     x_athletic_gpa                      IN     NUMBER    ,
14     x_eligibility_status_cd             IN     VARCHAR2  ,
15     x_predict_elig_code                 IN     VARCHAR2  ,
16     x_tentative_adm_code                IN     VARCHAR2  ,
17     x_review_date                       IN     DATE      ,
18     x_comments                          IN     VARCHAR2  ,
19     x_creation_date                     IN     DATE      ,
20     x_created_by                        IN     NUMBER    ,
21     x_last_update_date                  IN     DATE      ,
22     x_last_updated_by                   IN     NUMBER    ,
23     x_last_update_login                 IN     NUMBER
24   ) AS
25   /*
26   ||  Created By : cdcruz
27   ||  Created On : 21-SEP-2001
28   ||  Purpose : Initialises the Old and New references for the columns of the table.
29   ||  Known limitations, enhancements or remarks :
30   ||  Change History :
31   ||  Who             When            What
32   ||  (reverse chronological order - newest change first)
33   */
34 
35     CURSOR cur_old_ref_values IS
36       SELECT   *
37       FROM     igs_pe_athletic_dtl
38       WHERE    rowid = x_rowid;
39 
40   BEGIN
41 
42     l_rowid := x_rowid;
43 
44     -- Code for setting the Old and New Reference Values.
45     -- Populate Old Values.
46     OPEN cur_old_ref_values;
47     FETCH cur_old_ref_values INTO old_references;
48     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
49       CLOSE cur_old_ref_values;
50       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
51       igs_ge_msg_stack.add;
52       app_exception.raise_exception;
53       RETURN;
54     END IF;
55     CLOSE cur_old_ref_values;
56 
57     -- Populate New Values.
58     new_references.athletic_details_id               := x_athletic_details_id;
59     new_references.person_id                         := x_person_id;
60     new_references.athletic_gpa                      := x_athletic_gpa;
61     new_references.eligibility_status_cd             := x_eligibility_status_cd;
62     new_references.predict_elig_code                 := x_predict_elig_code;
63     new_references.tentative_adm_code                := x_tentative_adm_code;
64     new_references.review_date                       := x_review_date;
65     new_references.comments                          := x_comments;
66 
67     IF (p_action = 'UPDATE') THEN
68       new_references.creation_date                   := old_references.creation_date;
69       new_references.created_by                      := old_references.created_by;
70     ELSE
71       new_references.creation_date                   := x_creation_date;
72       new_references.created_by                      := x_created_by;
73     END IF;
74 
75     new_references.last_update_date                  := x_last_update_date;
76     new_references.last_updated_by                   := x_last_updated_by;
77     new_references.last_update_login                 := x_last_update_login;
78 
79   END set_column_values;
80 
81 
82   PROCEDURE check_uniqueness AS
83   /*
84   ||  Created By : cdcruz
85   ||  Created On : 21-SEP-2001
86   ||  Purpose : Handles the Unique Constraint logic defined for the columns.
87   ||  Known limitations, enhancements or remarks :
88   ||  Change History :
89   ||  Who             When            What
90   ||  (reverse chronological order - newest change first)
91   */
92   BEGIN
93 
94     IF ( get_uk_for_validation (
95            new_references.person_id
96          )
97        ) THEN
98       fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
99       igs_ge_msg_stack.add;
100       app_exception.raise_exception;
101     END IF;
102 
103   END check_uniqueness;
104 
105 
106   PROCEDURE check_parent_existance AS
107   /*
108   ||  Created By : cdcruz
109   ||  Created On : 21-SEP-2001
110   ||  Purpose : Checks for the existance of Parent records.
111   ||  Known limitations, enhancements or remarks :
112   ||  Change History :
113   ||  Who             When            What
114   ||  (reverse chronological order - newest change first)
115   */
116   BEGIN
117 
118     IF (((old_references.eligibility_status_cd = new_references.eligibility_status_cd)) OR
119         ((new_references.eligibility_status_cd IS NULL))) THEN
120       NULL;
121 
122       --kumma, 2608360 replaced igs_ad_code_classes_pkg with the igs_lookups_view_pkg
123     ELSIF NOT IGS_LOOKUPS_view_Pkg.Get_PK_For_Validation(
124                 'PE_ATH_ELG_STATUS',
125                 new_references.eligibility_status_cd
126               ) THEN
127       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
128       igs_ge_msg_stack.add;
129       app_exception.raise_exception;
130 
131     END IF;
132 
133     IF (((old_references.person_id = new_references.person_id)) OR
134         ((new_references.person_id IS NULL))) THEN
135       NULL;
136     ELSIF NOT igs_pe_hz_parties_pkg.get_pk_for_validation (
137                 new_references.person_id
138               ) THEN
139       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
140       igs_ge_msg_stack.add;
141       app_exception.raise_exception;
142     END IF;
143 
144   END check_parent_existance;
145 
146 
147   FUNCTION get_pk_for_validation (
148     x_athletic_details_id               IN     NUMBER
149   ) RETURN BOOLEAN AS
150   /*
151   ||  Created By : cdcruz
152   ||  Created On : 21-SEP-2001
153   ||  Purpose : Validates the Primary Key of the table.
154   ||  Known limitations, enhancements or remarks :
155   ||  Change History :
156   ||  Who             When            What
157   ||  (reverse chronological order - newest change first)
158   */
159     CURSOR cur_rowid IS
160       SELECT   rowid
161       FROM     igs_pe_athletic_dtl
162       WHERE    athletic_details_id = x_athletic_details_id
163       FOR UPDATE NOWAIT;
164 
165     lv_rowid cur_rowid%RowType;
166 
167   BEGIN
168 
169     OPEN cur_rowid;
170     FETCH cur_rowid INTO lv_rowid;
171     IF (cur_rowid%FOUND) THEN
172       CLOSE cur_rowid;
173       RETURN(TRUE);
174     ELSE
175       CLOSE cur_rowid;
176       RETURN(FALSE);
177     END IF;
178 
179   END get_pk_for_validation;
180 
181 
182   FUNCTION get_uk_for_validation (
183     x_person_id                         IN     NUMBER
184   ) RETURN BOOLEAN AS
185   /*
186   ||  Created By : cdcruz
187   ||  Created On : 21-SEP-2001
188   ||  Purpose : Validates the Unique Keys of the table.
189   ||  Known limitations, enhancements or remarks :
190   ||  Change History :
191   ||  Who             When            What
192   ||  (reverse chronological order - newest change first)
193   */
194     CURSOR cur_rowid IS
195       SELECT   rowid
196       FROM     igs_pe_athletic_dtl
197       WHERE    person_id = x_person_id
198       AND      ((l_rowid IS NULL) OR (rowid <> l_rowid));
199 
200     lv_rowid cur_rowid%RowType;
201 
202   BEGIN
203 
204     OPEN cur_rowid;
205     FETCH cur_rowid INTO lv_rowid;
206     IF (cur_rowid%FOUND) THEN
207       CLOSE cur_rowid;
208         RETURN (true);
209         ELSE
210        CLOSE cur_rowid;
211       RETURN(FALSE);
212     END IF;
213 
214   END get_uk_for_validation ;
215 
216 
217   PROCEDURE get_fk_igs_ad_code_classes (
218     x_code_id                           IN     VARCHAR2
219   ) AS
220   /*
221   ||  Created By : cdcruz
222   ||  Created On : 21-SEP-2001
223   ||  Purpose : Validates the Foreign Keys for the table.
224   ||  Known limitations, enhancements or remarks :
225   ||  Change History :
226   ||  Who             When            What
227   ||  (reverse chronological order - newest change first)
228   */
229     CURSOR cur_rowid IS
230       SELECT   rowid
231       FROM     igs_pe_athletic_dtl
232       WHERE   ((eligibility_status_cd = x_code_id));
233 
234     lv_rowid cur_rowid%RowType;
235 
236   BEGIN
237 
238     OPEN cur_rowid;
239     FETCH cur_rowid INTO lv_rowid;
240     IF (cur_rowid%FOUND) THEN
241       CLOSE cur_rowid;
242       fnd_message.set_name ('IGS', 'IGS_PE_PAD_ADCC_FK');
243       igs_ge_msg_stack.add;
244       app_exception.raise_exception;
245       RETURN;
246     END IF;
247     CLOSE cur_rowid;
248 
249   END get_fk_igs_ad_code_classes;
250 
251 
252   PROCEDURE get_fk_hz_parties (
253     x_party_id                          IN     NUMBER
254   ) AS
255   /*
256   ||  Created By : cdcruz
257   ||  Created On : 21-SEP-2001
258   ||  Purpose : Validates the Foreign Keys for the table.
259   ||  Known limitations, enhancements or remarks :
260   ||  Change History :
261   ||  Who             When            What
262   ||  (reverse chronological order - newest change first)
263   */
264     CURSOR cur_rowid IS
265       SELECT   rowid
266       FROM     igs_pe_athletic_dtl
267       WHERE   ((person_id = x_party_id));
268 
269     lv_rowid cur_rowid%RowType;
270 
271   BEGIN
272 
273     OPEN cur_rowid;
274     FETCH cur_rowid INTO lv_rowid;
275     IF (cur_rowid%FOUND) THEN
276       CLOSE cur_rowid;
277       fnd_message.set_name ('IGS', 'IGS_PE_PAD_HZ_FK');
278       igs_ge_msg_stack.add;
279       app_exception.raise_exception;
280       RETURN;
281     END IF;
282     CLOSE cur_rowid;
283 
284   END get_fk_hz_parties;
285 
286 
287   PROCEDURE before_dml (
288     p_action                            IN     VARCHAR2,
289     x_rowid                             IN     VARCHAR2  ,
290     x_athletic_details_id               IN     NUMBER    ,
291     x_person_id                         IN     NUMBER    ,
292     x_athletic_gpa                      IN     NUMBER    ,
293     x_eligibility_status_cd             IN     VARCHAR2  ,
294     x_predict_elig_code                 IN     VARCHAR2  ,
295     x_tentative_adm_code                IN     VARCHAR2  ,
296     x_review_date                       IN     DATE      ,
297     x_comments                          IN     VARCHAR2  ,
298     x_creation_date                     IN     DATE      ,
299     x_created_by                        IN     NUMBER    ,
300     x_last_update_date                  IN     DATE      ,
301     x_last_updated_by                   IN     NUMBER    ,
302     x_last_update_login                 IN     NUMBER
303   ) AS
304   /*
305   ||  Created By : cdcruz
306   ||  Created On : 21-SEP-2001
307   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
308   ||            Trigger Handlers for the table, before any DML operation.
309   ||  Known limitations, enhancements or remarks :
310   ||  Change History :
311   ||  Who             When            What
312   ||  (reverse chronological order - newest change first)
313   */
314   BEGIN
315 
316     set_column_values (
317       p_action,
318       x_rowid,
319       x_athletic_details_id,
320       x_person_id,
321       x_athletic_gpa,
322       x_eligibility_status_cd,
323       x_predict_elig_code,
324       x_tentative_adm_code,
325       x_review_date,
326       x_comments,
327       x_creation_date,
328       x_created_by,
329       x_last_update_date,
330       x_last_updated_by,
331       x_last_update_login
332     );
333 
334     IF (p_action = 'INSERT') THEN
335       -- Call all the procedures related to Before Insert.
336       IF ( get_pk_for_validation(
337              new_references.athletic_details_id
338            )
339          ) THEN
340         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
341         igs_ge_msg_stack.add;
342         app_exception.raise_exception;
343       END IF;
344       check_uniqueness;
345       check_parent_existance;
346     ELSIF (p_action = 'UPDATE') THEN
347       -- Call all the procedures related to Before Update.
348       check_uniqueness;
349       check_parent_existance;
350     ELSIF (p_action = 'VALIDATE_INSERT') THEN
351       -- Call all the procedures related to Before Insert.
352       IF ( get_pk_for_validation (
353              new_references.athletic_details_id
354            )
355          ) THEN
356         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
357         igs_ge_msg_stack.add;
358         app_exception.raise_exception;
359       END IF;
360       check_uniqueness;
361     ELSIF (p_action = 'VALIDATE_UPDATE') THEN
362       check_uniqueness;
363     END IF;
364 
365   END before_dml;
366 
367 
368   PROCEDURE insert_row (
369     x_rowid                             IN OUT NOCOPY VARCHAR2,
370     x_athletic_details_id               IN OUT NOCOPY NUMBER,
371     x_person_id                         IN     NUMBER,
372     x_athletic_gpa                      IN     NUMBER,
373     x_eligibility_status_cd             IN     VARCHAR2,
374     x_predict_elig_code                 IN     VARCHAR2,
375     x_tentative_adm_code                IN     VARCHAR2,
376     x_review_date                       IN     DATE,
377     x_comments                          IN     VARCHAR2,
378     x_mode                              IN     VARCHAR2
379   ) AS
380   /*
381   ||  Created By : cdcruz
382   ||  Created On : 21-SEP-2001
383   ||  Purpose : Handles the INSERT DML logic for the table.
384   ||  Known limitations, enhancements or remarks :
385   ||  Change History :
386   ||  Who             When            What
387   ||  (reverse chronological order - newest change first)
388   */
389     CURSOR c IS
390       SELECT   rowid
391       FROM     igs_pe_athletic_dtl
392       WHERE    athletic_details_id               = x_athletic_details_id;
393 
394     x_last_update_date           DATE;
395     x_last_updated_by            NUMBER;
396     x_last_update_login          NUMBER;
397 
398   BEGIN
399 
400     x_last_update_date := SYSDATE;
401     IF (x_mode = 'I') THEN
402       x_last_updated_by := 1;
403       x_last_update_login := 0;
404     ELSIF (X_MODE IN ('R', 'S')) THEN
405       x_last_updated_by := fnd_global.user_id;
406       IF (x_last_updated_by IS NULL) THEN
407         x_last_updated_by := -1;
408       END IF;
409       x_last_update_login := fnd_global.login_id;
410       IF (x_last_update_login IS NULL) THEN
411         x_last_update_login := -1;
412       END IF;
413     ELSE
414       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
415       igs_ge_msg_stack.add;
416       app_exception.raise_exception;
417     END IF;
418 
419     SELECT    igs_pe_athletic_dtl_s.NEXTVAL
420     INTO      x_athletic_details_id
421     FROM      dual;
422 
423     before_dml(
424       p_action                            => 'INSERT',
425       x_rowid                             => x_rowid,
426       x_athletic_details_id               => x_athletic_details_id,
427       x_person_id                         => x_person_id,
428       x_athletic_gpa                      => x_athletic_gpa,
429       x_eligibility_status_cd             => x_eligibility_status_cd,
430       x_predict_elig_code                 => x_predict_elig_code,
431       x_tentative_adm_code                => x_tentative_adm_code,
432       x_review_date                       => x_review_date,
433       x_comments                          => x_comments,
434       x_creation_date                     => x_last_update_date,
435       x_created_by                        => x_last_updated_by,
436       x_last_update_date                  => x_last_update_date,
437       x_last_updated_by                   => x_last_updated_by,
438       x_last_update_login                 => x_last_update_login
439     );
440 
441      IF (x_mode = 'S') THEN
442     igs_sc_gen_001.set_ctx('R');
443   END IF;
444  INSERT INTO igs_pe_athletic_dtl (
445       athletic_details_id,
446       person_id,
447       athletic_gpa,
448       eligibility_status_cd,
449       predict_elig_code,
450       tentative_adm_code,
451       review_date,
452       comments,
453       creation_date,
454       created_by,
455       last_update_date,
456       last_updated_by,
457       last_update_login
458     ) VALUES (
459       new_references.athletic_details_id,
460       new_references.person_id,
461       new_references.athletic_gpa,
462       new_references.eligibility_status_cd,
463       new_references.predict_elig_code,
464       new_references.tentative_adm_code,
465       new_references.review_date,
466       new_references.comments,
467       x_last_update_date,
468       x_last_updated_by,
469       x_last_update_date,
470       x_last_updated_by,
471       x_last_update_login
472     );
473  IF (x_mode = 'S') THEN
474     igs_sc_gen_001.unset_ctx('R');
475   END IF;
476 
477 
478     OPEN c;
479     FETCH c INTO x_rowid;
480     IF (c%NOTFOUND) THEN
481       CLOSE c;
482       RAISE NO_DATA_FOUND;
483     END IF;
484     CLOSE c;
485 
486 
487 EXCEPTION
488   WHEN OTHERS THEN
489     IF (SQLCODE IN (-28115, -28113, -28111)) THEN
490       fnd_message.set_name ('IGS', 'IGS_SC_POLICY_EXCEPTION');
491       fnd_message.set_token ('ERR_CD', SQLCODE);
492       igs_ge_msg_stack.add;
493       igs_sc_gen_001.unset_ctx('R');
494       app_exception.raise_exception;
495     ELSE
496       igs_sc_gen_001.unset_ctx('R');
497       RAISE;
498     END IF;
499  END insert_row;
500 
501 
502   PROCEDURE lock_row (
503     x_rowid                             IN     VARCHAR2,
504     x_athletic_details_id               IN     NUMBER,
505     x_person_id                         IN     NUMBER,
506     x_athletic_gpa                      IN     NUMBER,
507     x_eligibility_status_cd             IN     VARCHAR2,
508     x_predict_elig_code                 IN     VARCHAR2,
509     x_tentative_adm_code                IN     VARCHAR2,
510     x_review_date                       IN     DATE,
511     x_comments                          IN     VARCHAR2
512   ) AS
513   /*
514   ||  Created By : cdcruz
515   ||  Created On : 21-SEP-2001
516   ||  Purpose : Handles the LOCK mechanism for the table.
517   ||  Known limitations, enhancements or remarks :
518   ||  Change History :
519   ||  Who             When            What
520   ||  (reverse chronological order - newest change first)
521   */
522     CURSOR c1 IS
523       SELECT
524         person_id,
525         athletic_gpa,
526         eligibility_status_cd,
527         predict_elig_code,
528         tentative_adm_code,
529         review_date,
530         comments
531       FROM  igs_pe_athletic_dtl
532       WHERE rowid = x_rowid
533       FOR UPDATE NOWAIT;
534 
535     tlinfo c1%ROWTYPE;
536 
537   BEGIN
538 
539     OPEN c1;
540     FETCH c1 INTO tlinfo;
541     IF (c1%notfound) THEN
542       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
543       igs_ge_msg_stack.add;
544       CLOSE c1;
545       app_exception.raise_exception;
546       RETURN;
547     END IF;
548     CLOSE c1;
549 
550     IF (
551         (tlinfo.person_id = x_person_id)
552         AND ((tlinfo.athletic_gpa = x_athletic_gpa) OR ((tlinfo.athletic_gpa IS NULL) AND (X_athletic_gpa IS NULL)))
553         AND ((tlinfo.eligibility_status_cd = x_eligibility_status_cd) OR ((tlinfo.eligibility_status_cd IS NULL) AND (X_eligibility_status_cd IS NULL)))
554         AND ((tlinfo.predict_elig_code = x_predict_elig_code) OR ((tlinfo.predict_elig_code IS NULL) AND (X_predict_elig_code IS NULL)))
555         AND ((tlinfo.tentative_adm_code = x_tentative_adm_code) OR ((tlinfo.tentative_adm_code IS NULL) AND (X_tentative_adm_code IS NULL)))
556         AND ((tlinfo.review_date = x_review_date) OR ((tlinfo.review_date IS NULL) AND (X_review_date IS NULL)))
557         AND ((tlinfo.comments = x_comments) OR ((tlinfo.comments IS NULL) AND (X_comments IS NULL)))
558        ) THEN
559       NULL;
560     ELSE
561       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
562       igs_ge_msg_stack.add;
563       app_exception.raise_exception;
564     END IF;
565 
566     RETURN;
567 
568   END lock_row;
569 
570 
571   PROCEDURE update_row (
572     x_rowid                             IN     VARCHAR2,
573     x_athletic_details_id               IN     NUMBER,
574     x_person_id                         IN     NUMBER,
575     x_athletic_gpa                      IN     NUMBER,
576     x_eligibility_status_cd             IN     VARCHAR2,
577     x_predict_elig_code                 IN     VARCHAR2,
578     x_tentative_adm_code                IN     VARCHAR2,
579     x_review_date                       IN     DATE,
580     x_comments                          IN     VARCHAR2,
581     x_mode                              IN     VARCHAR2
582   ) AS
583   /*
584   ||  Created By : cdcruz
585   ||  Created On : 21-SEP-2001
586   ||  Purpose : Handles the UPDATE DML logic for the table.
587   ||  Known limitations, enhancements or remarks :
588   ||  Change History :
589   ||  Who             When            What
590   ||  (reverse chronological order - newest change first)
591   */
592     x_last_update_date           DATE ;
593     x_last_updated_by            NUMBER;
594     x_last_update_login          NUMBER;
595 
596   BEGIN
597 
598     x_last_update_date := SYSDATE;
599     IF (X_MODE = 'I') THEN
600       x_last_updated_by := 1;
601       x_last_update_login := 0;
602     ELSIF (X_MODE IN ('R', 'S')) THEN
603       x_last_updated_by := fnd_global.user_id;
604       IF x_last_updated_by IS NULL THEN
605         x_last_updated_by := -1;
606       END IF;
607       x_last_update_login := fnd_global.login_id;
608       IF (x_last_update_login IS NULL) THEN
609         x_last_update_login := -1;
610       END IF;
611     ELSE
612       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
613       igs_ge_msg_stack.add;
614       app_exception.raise_exception;
615     END IF;
616 
617     before_dml(
618       p_action                            => 'UPDATE',
619       x_rowid                             => x_rowid,
620       x_athletic_details_id               => x_athletic_details_id,
621       x_person_id                         => x_person_id,
622       x_athletic_gpa                      => x_athletic_gpa,
623       x_eligibility_status_cd             => x_eligibility_status_cd,
624       x_predict_elig_code                 => x_predict_elig_code,
625       x_tentative_adm_code                => x_tentative_adm_code,
626       x_review_date                       => x_review_date,
627       x_comments                          => x_comments,
628       x_creation_date                     => x_last_update_date,
629       x_created_by                        => x_last_updated_by,
630       x_last_update_date                  => x_last_update_date,
631       x_last_updated_by                   => x_last_updated_by,
632       x_last_update_login                 => x_last_update_login
633     );
634 
635      IF (x_mode = 'S') THEN
636     igs_sc_gen_001.set_ctx('R');
637   END IF;
638  UPDATE igs_pe_athletic_dtl
639       SET
640         person_id                         = new_references.person_id,
641         athletic_gpa                      = new_references.athletic_gpa,
642         eligibility_status_cd             = new_references.eligibility_status_cd,
643         predict_elig_code                 = new_references.predict_elig_code,
644         tentative_adm_code                = new_references.tentative_adm_code,
645         review_date                       = new_references.review_date,
646         comments                          = new_references.comments,
647         last_update_date                  = x_last_update_date,
648         last_updated_by                   = x_last_updated_by,
649         last_update_login                 = x_last_update_login
650       WHERE rowid = x_rowid;
651 
652     IF (SQL%NOTFOUND) THEN
653      fnd_message.set_name ('IGS', 'IGS_SC_POLICY_UPD_DEL_EXCEP');
654      igs_ge_msg_stack.add;
655      igs_sc_gen_001.unset_ctx('R');
656      app_exception.raise_exception;
657  END IF;
658  IF (x_mode = 'S') THEN
659     igs_sc_gen_001.unset_ctx('R');
660   END IF;
661 
662 
663 
664 EXCEPTION
665   WHEN OTHERS THEN
666     IF (SQLCODE = (-28115)) THEN
667       fnd_message.set_name ('IGS', 'IGS_SC_UPD_POLICY_EXCP');
668       fnd_message.set_token ('ERR_CD', SQLCODE);
669       igs_ge_msg_stack.add;
670       igs_sc_gen_001.unset_ctx('R');
671       app_exception.raise_exception;
672     ELSE
673       igs_sc_gen_001.unset_ctx('R');
674       RAISE;
675     END IF;
676  END update_row;
677 
678 
679   PROCEDURE add_row (
680     x_rowid                             IN OUT NOCOPY VARCHAR2,
681     x_athletic_details_id               IN OUT NOCOPY NUMBER,
682     x_person_id                         IN     NUMBER,
683     x_athletic_gpa                      IN     NUMBER,
684     x_eligibility_status_cd             IN     VARCHAR2,
685     x_predict_elig_code                 IN     VARCHAR2,
686     x_tentative_adm_code                IN     VARCHAR2,
687     x_review_date                       IN     DATE,
688     x_comments                          IN     VARCHAR2,
689     x_mode                              IN     VARCHAR2
690   ) AS
691   /*
692   ||  Created By : cdcruz
693   ||  Created On : 21-SEP-2001
694   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
695   ||  Known limitations, enhancements or remarks :
696   ||  Change History :
697   ||  Who             When            What
698   ||  (reverse chronological order - newest change first)
699   */
700     CURSOR c1 IS
701       SELECT   rowid
702       FROM     igs_pe_athletic_dtl
703       WHERE    athletic_details_id               = x_athletic_details_id;
704 
705   BEGIN
706 
707     OPEN c1;
708     FETCH c1 INTO x_rowid;
709     IF (c1%NOTFOUND) THEN
710       CLOSE c1;
711 
712       insert_row (
713         x_rowid,
714         x_athletic_details_id,
715         x_person_id,
716         x_athletic_gpa,
717         x_eligibility_status_cd,
718         x_predict_elig_code,
719         x_tentative_adm_code,
720         x_review_date,
721         x_comments,
722         x_mode
723       );
724       RETURN;
725     END IF;
726     CLOSE c1;
727 
728     update_row (
729       x_rowid,
730       x_athletic_details_id,
731       x_person_id,
732       x_athletic_gpa,
733       x_eligibility_status_cd,
734       x_predict_elig_code,
735       x_tentative_adm_code,
736       x_review_date,
737       x_comments,
738       x_mode
739     );
740 
741   END add_row;
742 
743 
744   PROCEDURE delete_row (
745     x_rowid IN VARCHAR2,
746   x_mode IN VARCHAR2
747   ) AS
748   /*
749   ||  Created By : cdcruz
750   ||  Created On : 21-SEP-2001
751   ||  Purpose : Handles the DELETE DML logic for the table.
752   ||  Known limitations, enhancements or remarks :
753   ||  Change History :
754   ||  Who             When            What
755   ||  (reverse chronological order - newest change first)
756   */
757   BEGIN
758 
759     before_dml (
760       p_action => 'DELETE',
761       x_rowid => x_rowid
762     );
763 
764      IF (x_mode = 'S') THEN
765     igs_sc_gen_001.set_ctx('R');
766   END IF;
767  DELETE FROM igs_pe_athletic_dtl
768     WHERE rowid = x_rowid;
769 
770     IF (SQL%NOTFOUND) THEN
771      fnd_message.set_name ('IGS', 'IGS_SC_POLICY_UPD_DEL_EXCEP');
772      igs_ge_msg_stack.add;
773      igs_sc_gen_001.unset_ctx('R');
774      app_exception.raise_exception;
775  END IF;
776  IF (x_mode = 'S') THEN
777     igs_sc_gen_001.unset_ctx('R');
778   END IF;
779 
780 
781   END delete_row;
782 
783 
784 END igs_pe_athletic_dtl_pkg;