DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_GR_PELL_SETUP_PKG

Source


1 PACKAGE BODY igf_gr_pell_setup_pkg AS
2 /* $Header: IGFGI02B.pls 120.1 2006/04/18 04:45:13 akomurav noship $ */
3 
4   l_rowid VARCHAR2(25);
5   old_references igf_gr_pell_setup_all%ROWTYPE;
6   new_references igf_gr_pell_setup_all%ROWTYPE;
7 
8   PROCEDURE set_column_values (
9     p_action                            IN     VARCHAR2,
10     x_rowid                             IN     VARCHAR2,
11     x_pell_seq_id                       IN     NUMBER  ,
12     x_ci_cal_type                       IN     VARCHAR2,
13     x_ci_sequence_number                IN     NUMBER  ,
14     x_rep_pell_id                       IN     VARCHAR2,
15     x_pell_profile                      IN     VARCHAR2,
16     x_branch_campus                     IN     VARCHAR2,
17     x_attend_campus_id                  IN     VARCHAR2,
18     x_use_census_dts                    IN     VARCHAR2,
19     x_funding_method                    IN     VARCHAR2,
20     x_inst_cross_ref_code               IN     VARCHAR2,
21     x_low_tution_fee                    IN     VARCHAR2,
22     x_academic_cal                      IN     VARCHAR2,
23     x_payment_method                    IN     VARCHAR2,
24     x_wk_inst_time_calc_pymt            IN     NUMBER  ,
25     x_wk_int_time_prg_def_yr            IN     NUMBER  ,
26     x_cr_clk_hrs_prds_sch_yr            IN     NUMBER  ,
27     x_cr_clk_hrs_acad_yr                IN     NUMBER  ,
28     x_alt_coa_limit                     IN     NUMBER  ,
29     x_efc_max                           IN     NUMBER  ,
30     x_pell_alt_exp_max                  IN     NUMBER  ,
31     x_creation_date                     IN     DATE    ,
32     x_created_by                        IN     NUMBER  ,
33     x_last_update_date                  IN     DATE    ,
34     x_last_updated_by                   IN     NUMBER  ,
35     x_last_update_login                 IN     NUMBER  ,
36     x_course_cd                         IN     VARCHAR2,
37     x_version_number                    IN     NUMBER  ,
38     x_payment_periods_num               IN     NUMBER  ,
39     x_enr_before_ts_code                IN     VARCHAR2,
40     x_enr_in_mt_code                    IN     VARCHAR2,
41     x_enr_after_tc_code                 IN     VARCHAR2,
42     x_rep_entity_id_txt                 IN     VARCHAR2,
43     x_response_option_code              IN     VARCHAR2,
44     x_term_start_offset_num             IN     NUMBER
45 
46   ) AS
47   /*
48   ||  Created By : avenkatr
49   ||  Created On : 04-JAN-2001
50   ||  Purpose : Initialises the Old and New references for the columns of the table.
51   ||  Known limitations, enhancements or remarks :
52   ||  Change History :
53   ||  Who             When            What
54   ||  (reverse chronological order - newest change first)
55   */
56 
57     CURSOR cur_old_ref_values IS
58       SELECT   *
59       FROM     IGF_GR_PELL_SETUP_ALL
60       WHERE    rowid = x_rowid;
61 
62   BEGIN
63 
64     l_rowid := x_rowid;
65 
66     -- Code for setting the Old and New Reference Values.
67     -- Populate Old Values.
68     OPEN cur_old_ref_values;
69     FETCH cur_old_ref_values INTO old_references;
70     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
71       CLOSE cur_old_ref_values;
72       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
73       igs_ge_msg_stack.add;
74       app_exception.raise_exception;
75       RETURN;
76     END IF;
77     CLOSE cur_old_ref_values;
78 
79     -- Populate New Values.
80     new_references.pell_seq_id                       := x_pell_seq_id;
81     new_references.ci_cal_type                       := x_ci_cal_type;
82     new_references.ci_sequence_number                := x_ci_sequence_number;
83     new_references.rep_pell_id                       := x_rep_pell_id;
84     new_references.pell_profile                      := x_pell_profile;
85     new_references.branch_campus                     := x_branch_campus;
86     new_references.attend_campus_id                  := x_attend_campus_id;
87     new_references.use_census_dts                    := x_use_census_dts;
88     new_references.funding_method                    := x_funding_method;
89     new_references.inst_cross_ref_code               := x_inst_cross_ref_code;
90     new_references.low_tution_fee                    := x_low_tution_fee;
91     new_references.academic_cal                      := x_academic_cal;
92     new_references.payment_method                    := x_payment_method;
93     new_references.wk_inst_time_calc_pymt            := x_wk_inst_time_calc_pymt;
94     new_references.wk_int_time_prg_def_yr            := x_wk_int_time_prg_def_yr;
95     new_references.cr_clk_hrs_prds_sch_yr            := x_cr_clk_hrs_prds_sch_yr;
96     new_references.cr_clk_hrs_acad_yr                := x_cr_clk_hrs_acad_yr;
97     new_references.alt_coa_limit                     := x_alt_coa_limit;
98     new_references.efc_max                           := x_efc_max;
99     new_references.pell_alt_exp_max                  := x_pell_alt_exp_max;
100 
101     new_references.course_cd                         := x_course_cd;
102     new_references.version_number                    := x_version_number;
103     new_references.payment_periods_num               := x_payment_periods_num;
104     new_references.enr_before_ts_code                := x_enr_before_ts_code;
105     new_references.enr_in_mt_code                    := x_enr_in_mt_code;
106     new_references.enr_after_tc_code                 := x_enr_after_tc_code;
107     new_references.rep_entity_id_txt                 := x_rep_entity_id_txt;
108     new_references.response_option_code              := x_response_option_code;
109     new_references.term_start_offset_num             := x_term_start_offset_num;
110 
111     IF (p_action = 'UPDATE') THEN
112       new_references.creation_date                   := old_references.creation_date;
113       new_references.created_by                      := old_references.created_by;
114     ELSE
115       new_references.creation_date                   := x_creation_date;
116       new_references.created_by                      := x_created_by;
117     END IF;
118 
119     new_references.last_update_date                  := x_last_update_date;
120     new_references.last_updated_by                   := x_last_updated_by;
121     new_references.last_update_login                 := x_last_update_login;
122 
123   END set_column_values;
124 
125 
126   PROCEDURE check_uniqueness AS
127   /*
128   ||  Created By : avenkatr
129   ||  Created On : 04-JAN-2001
130   ||  Purpose : Handles the Unique Constraint logic defined for the columns.
131   ||  Known limitations, enhancements or remarks :
132   ||  Change History :
133   ||  Who             When            What
134   ||  ugummall        24-NOV-2003     Bug 3252832. FA 131 - COD Updates
135   ||                                  Added two new params in cal to get_uk2_for_validation.
136   ||  (reverse chronological order - newest change first)
137   */
138   BEGIN
139     IF ( get_uk2_for_validation (
140            new_references.ci_cal_type,
141            new_references.ci_sequence_number,
142            new_references.rep_pell_id,
143            new_references.course_cd,
144            new_references.version_number,
145            new_references.rep_entity_id_txt
146          )
147        ) THEN
148       fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
149       igs_ge_msg_stack.add;
150       app_exception.raise_exception;
151     END IF;
152 
153   END check_uniqueness;
154 
155 
156   PROCEDURE check_parent_existance AS
157   /*
158   ||  Created By : avenkatr
159   ||  Created On : 04-JAN-2001
160   ||  Purpose : Checks for the existance of Parent records.
161   ||  Known limitations, enhancements or remarks :
162   ||  Change History :
163   ||  Who             When            What
164   ||  ugummall        24-NOV-2003     Bug 3252832. FA 131 - COD Updates
165   ||                                  Added code to check for parent in IGS_PS_VER_ALL table.
166   ||  (reverse chronological order - newest change first)
167   */
168   BEGIN
169 
170 
171 
172     IF (((old_references.rep_pell_id = new_references.rep_pell_id)) OR
173         ((new_references.rep_pell_id IS NULL))) THEN
174       NULL;
175     END IF;
176 
177     IF (((old_references.ci_cal_type = new_references.ci_cal_type) AND
178          (old_references.ci_sequence_number = new_references.ci_sequence_number)) OR
179         ((new_references.ci_cal_type IS NULL) OR
180          (new_references.ci_sequence_number IS NULL))) THEN
181       NULL;
182     ELSIF NOT igs_ca_inst_pkg.get_pk_for_validation (
183                 new_references.ci_cal_type,
184                 new_references.ci_sequence_number
185               ) THEN
186       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
187       igs_ge_msg_stack.add;
188       app_exception.raise_exception;
189     END IF;
190 
191     IF (((old_references.course_cd = new_references.course_cd) AND
192          (old_references.version_number = new_references.version_number)) OR
193         ((new_references.course_cd IS NULL) OR
194          (new_references.version_number IS NULL))) THEN
195       NULL;
196     ELSIF NOT igs_ps_ver_pkg.get_pk_for_validation (
197                 new_references.course_cd,
198                 new_references.version_number
199               ) THEN
200       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
201       igs_ge_msg_stack.add;
202       app_exception.raise_exception;
203     END IF;
204 
205   END check_parent_existance;
206 
207 
208 
209 
210   FUNCTION get_pk_for_validation (
211     x_pell_seq_id                       IN     NUMBER
212   ) RETURN BOOLEAN AS
213   /*
214   ||  Created By : avenkatr
215   ||  Created On : 04-JAN-2001
216   ||  Purpose : Validates the Primary Key of the table.
217   ||  Known limitations, enhancements or remarks :
218   ||  Change History :
219   ||  Who             When            What
220   ||  (reverse chronological order - newest change first)
221   */
222     CURSOR cur_rowid IS
223       SELECT   rowid
224       FROM     igf_gr_pell_setup_all
225       WHERE    pell_seq_id = x_pell_seq_id
226       FOR UPDATE NOWAIT;
227 
228     lv_rowid cur_rowid%RowType;
229 
230   BEGIN
231 
232     OPEN cur_rowid;
233     FETCH cur_rowid INTO lv_rowid;
234     IF (cur_rowid%FOUND) THEN
235       CLOSE cur_rowid;
236       RETURN(TRUE);
237     ELSE
238       CLOSE cur_rowid;
239       RETURN(FALSE);
240     END IF;
241 
242   END get_pk_for_validation;
243 
244 
245   FUNCTION get_uk2_for_validation (
246     x_ci_cal_type                       IN     VARCHAR2,
247     x_ci_sequence_number                IN     NUMBER,
248     x_rep_pell_id                       IN     VARCHAR2,
249     x_course_cd                         IN     VARCHAR2,
250     x_version_number                    IN     NUMBER,
251     x_rep_entity_id_txt                 IN     VARCHAR2
252   ) RETURN BOOLEAN AS
253   /*
254   ||  Created By : avenkatr
255   ||  Created On : 04-JAN-2001
256   ||  Purpose : Validates the Unique Keys of the table.
257   ||  Known limitations, enhancements or remarks :
258   ||  Change History :
259   ||  Who             When            What
260   ||  ugummall        24-NOV-2003     Bug 3252832. FA 131 - COD Updates
261   ||                                  1. Added two new params x_course_cd and x_version_number
262   ||  (reverse chronological order - newest change first)
263   */
264     CURSOR cur_rowid IS
265       SELECT   rowid
266       FROM     igf_gr_pell_setup_all
267       WHERE    ci_cal_type = x_ci_cal_type
268       AND      ci_sequence_number = x_ci_sequence_number
269       AND      ((l_rowid IS NULL) OR (rowid <> l_rowid))
270       AND      NVL(rep_pell_id,-1) = NVL(x_rep_pell_id,-1)
271       AND      NVL(rep_entity_id_txt,-1) = NVL(x_rep_entity_id_txt,-1)
272       AND      NVL(course_cd,':*:') = NVL(x_course_cd,':*:')
273       AND      NVL(version_number,-1) = NVL(x_version_number,-1);
274 
275     lv_rowid cur_rowid%RowType;
276 
277   BEGIN
278 
279     OPEN cur_rowid;
280     FETCH cur_rowid INTO lv_rowid;
281     IF (cur_rowid%FOUND) THEN
282       CLOSE cur_rowid;
283         RETURN (true);
284         ELSE
285        CLOSE cur_rowid;
286       RETURN(FALSE);
287     END IF;
288 
289   END get_uk2_for_validation ;
290 
291   PROCEDURE get_fk_igs_ca_inst (
292     x_cal_type                          IN     VARCHAR2,
293     x_sequence_number                   IN     NUMBER
294   ) AS
295   /*
296   ||  Created By : avenkatr
297   ||  Created On : 04-JAN-2001
298   ||  Purpose : Validates the Foreign Keys for the table.
299   ||  Known limitations, enhancements or remarks :
300   ||  Change History :
301   ||  Who             When            What
302   ||  (reverse chronological order - newest change first)
303   */
304     CURSOR cur_rowid IS
305       SELECT   rowid
306       FROM     igf_gr_pell_setup_all
307       WHERE   ((ci_cal_type = x_cal_type) AND
308                (ci_sequence_number = x_sequence_number));
309 
310     lv_rowid cur_rowid%RowType;
311 
312   BEGIN
313 
314     OPEN cur_rowid;
315     FETCH cur_rowid INTO lv_rowid;
316     IF (cur_rowid%FOUND) THEN
317       CLOSE cur_rowid;
318       fnd_message.set_name ('IGF', 'IGF_GR_PELL_CI_FK');
319       igs_ge_msg_stack.add;
320       app_exception.raise_exception;
321       RETURN;
322     END IF;
323     CLOSE cur_rowid;
324 
325   END get_fk_igs_ca_inst;
326 
327   PROCEDURE get_fk_igs_ps_ver (
328     x_course_cd                          IN     VARCHAR2,
329     x_version_number                     IN     NUMBER
330   ) AS
331   /*
332   ||  Created By : ugummall
333   ||  Created On : 24-NOV-2003
334   ||  Purpose : Validates the Foreign Keys for the table.
335   ||  Known limitations, enhancements or remarks :
336   ||  Change History :
337   ||  Who             When            What
338   ||  (reverse chronological order - newest change first)
339   */
340     CURSOR cur_rowid IS
341       SELECT   rowid
342       FROM     igf_gr_pell_setup_all
343       WHERE   ((course_cd = x_course_cd) AND
344                (version_number = x_version_number));
345 
346     lv_rowid cur_rowid%RowType;
347 
348   BEGIN
349 
350     OPEN cur_rowid;
351     FETCH cur_rowid INTO lv_rowid;
352     IF (cur_rowid%FOUND) THEN
353       CLOSE cur_rowid;
354       fnd_message.set_name ('IGF', 'IGF_GR_PELL_PSV_FK');
355       igs_ge_msg_stack.add;
356       app_exception.raise_exception;
357       RETURN;
358     END IF;
359     CLOSE cur_rowid;
360 
361   END get_fk_igs_ps_ver;
362 
363   PROCEDURE get_fk_igf_gr_report_pell (
364    x_rep_pell_cd                       IN     VARCHAR2
365   ) AS
366   /*
367   ||  Created By : pssahni
368   ||  Created On : 8-Nov-2004
369   ||  Purpose : Validates the Foreign Keys for the table.
370   ||  Known limitations, enhancements or remarks :
371   ||  Change History :
372   ||  Who             When            What
373   ||  (reverse chronological order - newest change first)
374   */
375     CURSOR cur_rowid IS
376       SELECT   rowid
377       FROM     igf_gr_pell_setup_all
378       WHERE    rep_pell_id = x_rep_pell_cd ;
379 
380     lv_rowid cur_rowid%RowType;
381 
382   BEGIN
383 
384     OPEN cur_rowid;
385     FETCH cur_rowid INTO lv_rowid;
386     IF (cur_rowid%FOUND) THEN
387       CLOSE cur_rowid;
388       fnd_message.set_name ('IGF', 'IGF_GR_CANT_DEL_REP_PELL_ST');
389       igs_ge_msg_stack.add;
390       app_exception.raise_exception;
391       RETURN;
392     END IF;
393     CLOSE cur_rowid;
394 
395   END get_fk_igf_gr_report_pell;
396 
397   PROCEDURE get_fk_igf_gr_report_ent (
398      x_rep_entity_id_txt                 IN     VARCHAR2
399   ) AS
400   /*
404   ||  Known limitations, enhancements or remarks :
401   ||  Created By : pssahni
402   ||  Created On : 8-Nov-2004
403   ||  Purpose : Validates the Foreign Keys for the table.
405   ||  Change History :
406   ||  Who             When            What
407   ||  (reverse chronological order - newest change first)
408   */
409     CURSOR cur_rowid IS
410       SELECT   rowid
411       FROM     igf_gr_pell_setup_all
412       WHERE   rep_entity_id_txt = x_rep_entity_id_txt;
413 
414     lv_rowid cur_rowid%RowType;
415 
416   BEGIN
417 
418     OPEN cur_rowid;
419     FETCH cur_rowid INTO lv_rowid;
420     IF (cur_rowid%FOUND) THEN
421       CLOSE cur_rowid;
422       fnd_message.set_name ('IGF', 'IGF_GR_CANT_DEL_REP_ENT_ST');
423       igs_ge_msg_stack.add;
424       app_exception.raise_exception;
425       RETURN;
426     END IF;
427     CLOSE cur_rowid;
428 
429   END get_fk_igf_gr_report_ent;
430 
431  PROCEDURE check_child ( p_rep_pell_id        IN VARCHAR2,
432                          p_ci_cal_type        IN VARCHAR2,
433                          p_ci_sequence_number IN NUMBER)
434   AS
435    /*
436   ||  Created By : rasahoo
437   ||  Created On : 13-Feb-2004
438   ||  Purpose : Checks for the existence of Child Record.
439   ||  Known limitations, enhancements or remarks :
440   ||  Change History :
441   ||  Who             When            What
442   ||  (reverse chronological order - newest change first)
443   */
444 
445   -- Get the number of record present in Pell setup table for
446   -- the corresponding Reporting pell id and award year.
447   CURSOR cur_get_child(p_rep_pell_id  VARCHAR2,
448                           p_ci_cal_type  VARCHAR2,
449                           p_ci_sequence_number NUMBER) IS
450       SELECT   COUNT(*) num_of_rec
451       FROM     igf_gr_pell_setup_all
452       WHERE    REP_PELL_ID =  p_rep_pell_id
453         AND    CI_CAL_TYPE = p_ci_cal_type
454         AND    CI_SEQUENCE_NUMBER =  p_ci_sequence_number;
455 
456   rec_get_child cur_get_child%ROWTYPE;
457 
458   BEGIN
459 
460   -- Get the number of record present in Pell setup table for
461   -- the corresponding Reporting pell id and award year.
462    rec_get_child := NULL; -- Initializes the cursor.
463    OPEN cur_get_child(p_rep_pell_id,p_ci_cal_type,p_ci_sequence_number);
464    FETCH cur_get_child INTO rec_get_child;
465    -- If record count is greater than one that implies child record exists.
466    -- Therfore do not allow to delete record and show error message.
467    IF rec_get_child.num_of_rec >1 THEN
468      fnd_message.set_name ('IGS', 'IGS_SS_INQ_DELETE_RECORD_INSTR');
469       igs_ge_msg_stack.add;
470       CLOSE cur_get_child;
471       app_exception.raise_exception;
472    END IF;
473    CLOSE cur_get_child;
474   END check_child;
475 
476   PROCEDURE before_dml (
477     p_action                            IN     VARCHAR2,
478     x_rowid                             IN     VARCHAR2,
479     x_pell_seq_id                       IN     NUMBER  ,
480     x_ci_cal_type                       IN     VARCHAR2,
481     x_ci_sequence_number                IN     NUMBER  ,
482     x_rep_pell_id                       IN     VARCHAR2,
483     x_pell_profile                      IN     VARCHAR2,
484     x_branch_campus                     IN     VARCHAR2,
485     x_attend_campus_id                  IN     VARCHAR2,
486     x_use_census_dts                    IN     VARCHAR2,
487     x_funding_method                    IN     VARCHAR2,
488     x_inst_cross_ref_code               IN     VARCHAR2,
489     x_low_tution_fee                    IN     VARCHAR2,
490     x_academic_cal                      IN     VARCHAR2,
491     x_payment_method                    IN     VARCHAR2,
492     x_wk_inst_time_calc_pymt            IN     NUMBER  ,
493     x_wk_int_time_prg_def_yr            IN     NUMBER  ,
494     x_cr_clk_hrs_prds_sch_yr            IN     NUMBER  ,
495     x_cr_clk_hrs_acad_yr                IN     NUMBER  ,
496     x_alt_coa_limit                     IN     NUMBER  ,
497     x_efc_max                           IN     NUMBER  ,
498     x_pell_alt_exp_max                  IN     NUMBER  ,
499     x_creation_date                     IN     DATE    ,
500     x_created_by                        IN     NUMBER  ,
501     x_last_update_date                  IN     DATE    ,
502     x_last_updated_by                   IN     NUMBER  ,
503     x_last_update_login                 IN     NUMBER  ,
504     x_course_cd                         IN     VARCHAR2,
505     x_version_number                    IN     NUMBER  ,
506     x_payment_periods_num               IN     NUMBER  ,
507     x_enr_before_ts_code                IN     VARCHAR2,
508     x_enr_in_mt_code                    IN     VARCHAR2,
509     x_enr_after_tc_code                 IN     VARCHAR2,
510     x_rep_entity_id_txt                 IN     VARCHAR2,
511     x_response_option_code              IN     VARCHAR2,
512     x_term_start_offset_num             IN     NUMBER
513 
514   ) AS
515   /*
516   ||  Created By : avenkatr
517   ||  Created On : 04-JAN-2001
518   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
519   ||            Trigger Handlers for the table, before any DML operation.
520   ||  Known limitations, enhancements or remarks :
521   ||  Change History :
522   ||  Who             When            What
526 
523   ||  (reverse chronological order - newest change first)
524   */
525   BEGIN
527     set_column_values (
528       p_action,
529       x_rowid,
530       x_pell_seq_id,
531       x_ci_cal_type,
532       x_ci_sequence_number,
533       x_rep_pell_id,
534       x_pell_profile,
535       x_branch_campus,
536       x_attend_campus_id,
537       x_use_census_dts,
538       x_funding_method,
539       x_inst_cross_ref_code,
540       x_low_tution_fee,
541       x_academic_cal,
542       x_payment_method,
543       x_wk_inst_time_calc_pymt,
544       x_wk_int_time_prg_def_yr,
545       x_cr_clk_hrs_prds_sch_yr,
546       x_cr_clk_hrs_acad_yr,
547       x_alt_coa_limit,
548       x_efc_max,
549       x_pell_alt_exp_max,
550       x_creation_date,
551       x_created_by,
552       x_last_update_date,
553       x_last_updated_by,
554       x_last_update_login,
555       x_course_cd,
556       x_version_number,
557       x_payment_periods_num,
558       x_enr_before_ts_code,
559       x_enr_in_mt_code,
560       x_enr_after_tc_code,
561       x_rep_entity_id_txt,
562       x_response_option_code,
563       x_term_start_offset_num
564     );
565 
566     IF (p_action = 'INSERT') THEN
567       -- Call all the procedures related to Before Insert.
568       IF ( get_pk_for_validation(
569              new_references.pell_seq_id
570            )
571          ) THEN
572         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
573         igs_ge_msg_stack.add;
574         app_exception.raise_exception;
575       END IF;
576       check_uniqueness;
577       check_parent_existance;
578     ELSIF (p_action = 'UPDATE') THEN
579       -- Call all the procedures related to Before Update.
580       check_uniqueness;
581       check_parent_existance;
582     ELSIF (p_action = 'VALIDATE_DELETE') THEN
583     -- Call all the procedures related to Before delete.
584     -- Checks for existence of child record
585     -- If child record present Then it raises exception
586       check_child(x_rep_pell_id,x_ci_cal_type,x_ci_sequence_number);
587     ELSIF (p_action = 'VALIDATE_INSERT') THEN
588       -- Call all the procedures related to Before Insert.
589       IF ( get_pk_for_validation (
590              new_references.pell_seq_id
591            )
592          ) THEN
593         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
594         igs_ge_msg_stack.add;
595         app_exception.raise_exception;
596       END IF;
597       check_uniqueness;
598     ELSIF (p_action = 'VALIDATE_UPDATE') THEN
599       check_uniqueness;
600     END IF;
601 
602   END before_dml;
603 
604 
605 
606   PROCEDURE insert_row (
607     x_rowid                             IN OUT NOCOPY VARCHAR2,
608     x_pell_seq_id                       IN OUT NOCOPY NUMBER,
609     x_ci_cal_type                       IN     VARCHAR2,
610     x_ci_sequence_number                IN     NUMBER,
611     x_rep_pell_id                       IN     VARCHAR2,
612     x_pell_profile                      IN     VARCHAR2,
613     x_branch_campus                     IN     VARCHAR2,
614     x_attend_campus_id                  IN     VARCHAR2,
615     x_use_census_dts                    IN     VARCHAR2,
616     x_funding_method                    IN     VARCHAR2,
617     x_inst_cross_ref_code               IN     VARCHAR2,
618     x_low_tution_fee                    IN     VARCHAR2,
619     x_academic_cal                      IN     VARCHAR2,
620     x_payment_method                    IN     VARCHAR2,
621     x_wk_inst_time_calc_pymt            IN     NUMBER,
622     x_wk_int_time_prg_def_yr            IN     NUMBER,
623     x_cr_clk_hrs_prds_sch_yr            IN     NUMBER,
624     x_cr_clk_hrs_acad_yr                IN     NUMBER,
625     x_alt_coa_limit                     IN     NUMBER,
626     x_efc_max                           IN     NUMBER,
627     x_pell_alt_exp_max                  IN     NUMBER,
628     x_mode                              IN     VARCHAR2,
629     x_course_cd                         IN     VARCHAR2,
630     x_version_number                    IN     NUMBER  ,
631     x_payment_periods_num               IN     NUMBER  ,
632     x_enr_before_ts_code                IN     VARCHAR2,
633     x_enr_in_mt_code                    IN     VARCHAR2,
634     x_enr_after_tc_code                 IN     VARCHAR2,
635     x_rep_entity_id_txt                 IN     VARCHAR2,
636     x_response_option_code              IN     VARCHAR2,
637     x_term_start_offset_num             IN     NUMBER
638 
639   ) AS
640   /*
641   ||  Created By : avenkatr
642   ||  Created On : 04-JAN-2001
643   ||  Purpose : Handles the INSERT DML logic for the table.
644   ||  Known limitations, enhancements or remarks :
645   ||  Change History :
646   ||  Who             When            What
647   ||  (reverse chronological order - newest change first)
648   */
649     CURSOR c IS
650       SELECT   rowid
651       FROM     igf_gr_pell_setup_all
652       WHERE    pell_seq_id                       = x_pell_seq_id;
653 
654     x_last_update_date           DATE;
655     x_last_updated_by            NUMBER;
656     x_last_update_login          NUMBER;
660 
657     l_org_id			 igf_gr_pell_setup_all.org_id%TYPE;
658 
659   BEGIN
661     l_org_id			 := igf_aw_gen.get_org_id;
662 
663     x_last_update_date := SYSDATE;
664     IF (x_mode = 'I') THEN
665       x_last_updated_by := 1;
666       x_last_update_login := 0;
667     ELSIF (x_mode = 'R') THEN
668       x_last_updated_by := fnd_global.user_id;
669       IF (x_last_updated_by IS NULL) THEN
670         x_last_updated_by := -1;
671       END IF;
672       x_last_update_login := fnd_global.login_id;
673       IF (x_last_update_login IS NULL) THEN
674         x_last_update_login := -1;
675       END IF;
676     ELSE
677       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
678       igs_ge_msg_stack.add;
679       app_exception.raise_exception;
680     END IF;
681 
682 		SELECT igf_gr_pell_setup_s.nextval INTO x_pell_seq_id FROM dual;
683     before_dml(
684       p_action                            => 'INSERT',
685       x_rowid                             => x_rowid,
686       x_pell_seq_id                       => x_pell_seq_id,
687       x_ci_cal_type                       => x_ci_cal_type,
688       x_ci_sequence_number                => x_ci_sequence_number,
689       x_rep_pell_id                       => x_rep_pell_id,
690       x_pell_profile                      => x_pell_profile,
691       x_branch_campus                     => x_branch_campus,
692       x_attend_campus_id                  => x_attend_campus_id,
693       x_use_census_dts                    => x_use_census_dts,
694       x_funding_method                    => x_funding_method,
695       x_inst_cross_ref_code               => x_inst_cross_ref_code,
696       x_low_tution_fee                    => x_low_tution_fee,
697       x_academic_cal                      => x_academic_cal,
698       x_payment_method                    => x_payment_method,
699       x_wk_inst_time_calc_pymt            => x_wk_inst_time_calc_pymt,
700       x_wk_int_time_prg_def_yr            => x_wk_int_time_prg_def_yr,
701       x_cr_clk_hrs_prds_sch_yr            => x_cr_clk_hrs_prds_sch_yr,
702       x_cr_clk_hrs_acad_yr                => x_cr_clk_hrs_acad_yr,
703       x_alt_coa_limit                     => x_alt_coa_limit,
704       x_efc_max                           => x_efc_max,
705       x_pell_alt_exp_max                  => x_pell_alt_exp_max,
706       x_creation_date                     => x_last_update_date,
707       x_created_by                        => x_last_updated_by,
708       x_last_update_date                  => x_last_update_date,
709       x_last_updated_by                   => x_last_updated_by,
710       x_last_update_login                 => x_last_update_login,
711       x_course_cd                         => x_course_cd,
712       x_version_number                    => x_version_number,
713       x_payment_periods_num               => x_payment_periods_num,
714       x_enr_before_ts_code                => x_enr_before_ts_code,
715       x_enr_in_mt_code                    => x_enr_in_mt_code,
716       x_enr_after_tc_code                 => x_enr_after_tc_code,
717       x_rep_entity_id_txt                 => x_rep_entity_id_txt,
718       x_response_option_code              => x_response_option_code,
719       x_term_start_offset_num             => x_term_start_offset_num
720 
721     );
722 
723     INSERT INTO igf_gr_pell_setup_all (
724       pell_seq_id,
725       ci_cal_type,
726       ci_sequence_number,
727       rep_pell_id,
728       branch_campus,
729       attend_campus_id,
730       funding_method,
731       inst_cross_ref_code,
732       academic_cal,
733       payment_method,
734       wk_inst_time_calc_pymt,
735       wk_int_time_prg_def_yr,
736       cr_clk_hrs_prds_sch_yr,
737       cr_clk_hrs_acad_yr,
738       alt_coa_limit,
739       efc_max,
740       pell_alt_exp_max,
741       creation_date,
742       created_by,
743       last_update_date,
744       last_updated_by,
745       last_update_login,
746       org_id,
747       course_cd,
748       version_number,
749       payment_periods_num,
750       enr_before_ts_code,
751       enr_in_mt_code,
752       enr_after_tc_code,
753       rep_entity_id_txt,
754       response_option_code,
755       term_start_offset_num
756 
757     ) VALUES (
758       new_references.pell_seq_id,
759       new_references.ci_cal_type,
760       new_references.ci_sequence_number,
761       new_references.rep_pell_id,
762       new_references.branch_campus,
763       new_references.attend_campus_id,
764       new_references.funding_method,
765       new_references.inst_cross_ref_code,
766       new_references.academic_cal,
767       new_references.payment_method,
768       new_references.wk_inst_time_calc_pymt,
769       new_references.wk_int_time_prg_def_yr,
770       new_references.cr_clk_hrs_prds_sch_yr,
771       new_references.cr_clk_hrs_acad_yr,
772       new_references.alt_coa_limit,
773       new_references.efc_max,
774       new_references.pell_alt_exp_max ,
775       x_last_update_date,
776       x_last_updated_by,
777       x_last_update_date,
778       x_last_updated_by,
779       x_last_update_login,
780       l_org_id,
781       new_references.course_cd,
782       new_references.version_number,
783       new_references.payment_periods_num,
787       new_references.rep_entity_id_txt,
784       new_references.enr_before_ts_code,
785       new_references.enr_in_mt_code,
786       new_references.enr_after_tc_code,
788       new_references.response_option_code,
789       new_references.term_start_offset_num
790 
791     );
792 
793     OPEN c;
794     FETCH c INTO x_rowid;
795     IF (c%NOTFOUND) THEN
796       CLOSE c;
797       RAISE NO_DATA_FOUND;
798     END IF;
799     CLOSE c;
800 
801   END insert_row;
802 
803 
804   PROCEDURE lock_row (
805     x_rowid                             IN     VARCHAR2,
806     x_pell_seq_id                       IN     NUMBER,
807     x_ci_cal_type                       IN     VARCHAR2,
808     x_ci_sequence_number                IN     NUMBER,
809     x_rep_pell_id                       IN     VARCHAR2,
810     x_pell_profile                      IN     VARCHAR2,
811     x_branch_campus                     IN     VARCHAR2,
812     x_attend_campus_id                  IN     VARCHAR2,
813     x_use_census_dts                    IN     VARCHAR2,
814     x_funding_method                    IN     VARCHAR2,
815     x_inst_cross_ref_code               IN     VARCHAR2,
816     x_low_tution_fee                    IN     VARCHAR2,
817     x_academic_cal                      IN     VARCHAR2,
818     x_payment_method                    IN     VARCHAR2,
819     x_wk_inst_time_calc_pymt            IN     NUMBER,
820     x_wk_int_time_prg_def_yr            IN     NUMBER,
821     x_cr_clk_hrs_prds_sch_yr            IN     NUMBER,
822     x_cr_clk_hrs_acad_yr                IN     NUMBER,
823     x_alt_coa_limit                     IN     NUMBER,
824     x_efc_max                           IN     NUMBER,
825     x_pell_alt_exp_max                  IN     NUMBER,
826     x_course_cd                         IN     VARCHAR2,
827     x_version_number                    IN     NUMBER  ,
828     x_payment_periods_num               IN     NUMBER  ,
829     x_enr_before_ts_code                IN     VARCHAR2,
830     x_enr_in_mt_code                    IN     VARCHAR2,
831     x_enr_after_tc_code                 IN     VARCHAR2,
832     x_rep_entity_id_txt                 IN     VARCHAR2,
833     x_response_option_code              IN     VARCHAR2,
834     x_term_start_offset_num             IN     NUMBER
835 
836   ) AS
837   /*
838   ||  Created By : avenkatr
839   ||  Created On : 04-JAN-2001
840   ||  Purpose : Handles the LOCK mechanism for the table.
841   ||  Known limitations, enhancements or remarks :
842   ||  Change History :
843   ||  Who             When            What
844   ||  (reverse chronological order - newest change first)
845   */
846     CURSOR c1 IS
847       SELECT
848         ci_cal_type,
849         ci_sequence_number,
850         rep_pell_id,
851         branch_campus,
852         attend_campus_id,
853         funding_method,
854         inst_cross_ref_code,
855         academic_cal,
856         payment_method,
857         wk_inst_time_calc_pymt,
858         wk_int_time_prg_def_yr,
859         cr_clk_hrs_prds_sch_yr,
860         cr_clk_hrs_acad_yr,
861         alt_coa_limit,
862 	      efc_max,
863 	      pell_alt_exp_max,
864         course_cd,
865         version_number,
866         payment_periods_num,
867         enr_before_ts_code,
868         enr_in_mt_code,
869         enr_after_tc_code,
870         rep_entity_id_txt,
871         response_option_code,
872 	term_start_offset_num
873 
874       FROM  igf_gr_pell_setup_all
875       WHERE rowid = x_rowid
876       FOR UPDATE NOWAIT;
877 
878     tlinfo c1%ROWTYPE;
879 
880   BEGIN
881 
882     OPEN c1;
883     FETCH c1 INTO tlinfo;
884     IF (c1%notfound) THEN
885       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
886       igs_ge_msg_stack.add;
887       CLOSE c1;
888       app_exception.raise_exception;
889       RETURN;
890     END IF;
891     CLOSE c1;
892 
893     IF (
894         (tlinfo.ci_cal_type = x_ci_cal_type)
895         AND (tlinfo.ci_sequence_number = x_ci_sequence_number)
896         AND ((tlinfo.rep_pell_id = x_rep_pell_id) OR ((tlinfo.rep_pell_id IS NULL) AND (X_rep_pell_id IS NULL)))
897 --        AND (tlinfo.branch_campus = x_branch_campus) OR ((tlinfo.branch_campus IS NULL) AND (x_branch_campus IS NULL))
898   --      AND (tlinfo.attend_campus_id = x_attend_campus_id) OR ((tlinfo.attend_campus_id IS NULL) AND (x_attend_campus_id IS NULL))
899         AND ((tlinfo.funding_method = x_funding_method)  OR ((tlinfo.funding_method IS NULL) AND (X_funding_method IS NULL)))
900         AND ((tlinfo.inst_cross_ref_code = x_inst_cross_ref_code) OR ((tlinfo.inst_cross_ref_code IS NULL) AND (X_inst_cross_ref_code IS NULL)))
901         AND (tlinfo.academic_cal = x_academic_cal)
902         AND (tlinfo.payment_method = x_payment_method)
903         AND ((tlinfo.wk_inst_time_calc_pymt = x_wk_inst_time_calc_pymt) OR ((tlinfo.wk_inst_time_calc_pymt IS NULL) AND (X_wk_inst_time_calc_pymt IS NULL)))
904         AND ((tlinfo.wk_int_time_prg_def_yr = x_wk_int_time_prg_def_yr) OR ((tlinfo.wk_int_time_prg_def_yr IS NULL) AND (X_wk_int_time_prg_def_yr IS NULL)))
908         AND ((tlinfo.efc_max = x_efc_max) OR ((tlinfo.efc_max IS NULL) AND (X_efc_max IS NULL)))
905         AND ((tlinfo.cr_clk_hrs_prds_sch_yr = x_cr_clk_hrs_prds_sch_yr) OR ((tlinfo.cr_clk_hrs_prds_sch_yr IS NULL) AND (X_cr_clk_hrs_prds_sch_yr IS NULL)))
906         AND ((tlinfo.cr_clk_hrs_acad_yr = x_cr_clk_hrs_acad_yr) OR ((tlinfo.cr_clk_hrs_acad_yr IS NULL) AND (X_cr_clk_hrs_acad_yr IS NULL)))
907         AND ((tlinfo.alt_coa_limit = x_alt_coa_limit) OR ((tlinfo.alt_coa_limit IS NULL) AND (X_alt_coa_limit IS NULL)))
909         AND ((tlinfo.pell_alt_exp_max = x_pell_alt_exp_max) OR ((tlinfo.pell_alt_exp_max IS NULL) AND (X_pell_alt_exp_max IS NULL)))
910         AND ((tlinfo.course_cd = x_course_cd) OR ((tlinfo.course_cd IS NULL) AND (x_course_cd IS NULL)))
911         AND ((tlinfo.version_number = x_version_number) OR ((tlinfo.version_number IS NULL) AND (x_version_number IS NULL)))
912         AND ((tlinfo.payment_periods_num = x_payment_periods_num) OR ((tlinfo.payment_periods_num IS NULL) AND (x_payment_periods_num IS NULL)))
913         AND ((tlinfo.enr_before_ts_code = x_enr_before_ts_code) OR ((tlinfo.enr_before_ts_code IS NULL) AND (x_enr_before_ts_code IS NULL)))
914         AND ((tlinfo.enr_in_mt_code = x_enr_in_mt_code) OR ((tlinfo.enr_in_mt_code IS NULL) AND (x_enr_in_mt_code IS NULL)))
915         AND ((tlinfo.enr_after_tc_code = x_enr_after_tc_code) OR ((tlinfo.enr_after_tc_code IS NULL) AND (x_enr_after_tc_code IS NULL)))
916         AND ((tlinfo.rep_entity_id_txt = x_rep_entity_id_txt) OR ((tlinfo.rep_entity_id_txt IS NULL) AND (x_rep_entity_id_txt IS NULL)))
917         AND ((tlinfo.response_option_code = x_response_option_code) OR ((tlinfo.response_option_code IS NULL) AND (x_response_option_code IS NULL)))
918 	AND ((tlinfo.term_start_offset_num = x_term_start_offset_num) OR ((tlinfo.term_start_offset_num IS NULL) AND (x_term_start_offset_num IS NULL)))
919 
920        ) THEN
921       NULL;
922     ELSE
923       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
924       igs_ge_msg_stack.add;
925       app_exception.raise_exception;
926     END IF;
927 
928     RETURN;
929 
930   END lock_row;
931 
932 
933   PROCEDURE update_row (
934     x_rowid                             IN     VARCHAR2,
935     x_pell_seq_id                       IN     NUMBER,
936     x_ci_cal_type                       IN     VARCHAR2,
937     x_ci_sequence_number                IN     NUMBER,
938     x_rep_pell_id                       IN     VARCHAR2,
939     x_pell_profile                      IN     VARCHAR2,
940     x_branch_campus                     IN     VARCHAR2,
941     x_attend_campus_id                  IN     VARCHAR2,
942     x_use_census_dts                    IN     VARCHAR2,
943     x_funding_method                    IN     VARCHAR2,
944     x_inst_cross_ref_code               IN     VARCHAR2,
945     x_low_tution_fee                    IN     VARCHAR2,
946     x_academic_cal                      IN     VARCHAR2,
947     x_payment_method                    IN     VARCHAR2,
948     x_wk_inst_time_calc_pymt            IN     NUMBER,
949     x_wk_int_time_prg_def_yr            IN     NUMBER,
950     x_cr_clk_hrs_prds_sch_yr            IN     NUMBER,
951     x_cr_clk_hrs_acad_yr                IN     NUMBER,
952     x_alt_coa_limit                     IN     NUMBER,
953     x_efc_max                           IN     NUMBER,
954     x_pell_alt_exp_max                  IN     NUMBER,
955     x_mode                              IN     VARCHAR2,
956     x_course_cd                         IN     VARCHAR2,
957     x_version_number                    IN     NUMBER  ,
958     x_payment_periods_num               IN     NUMBER  ,
959     x_enr_before_ts_code                IN     VARCHAR2,
960     x_enr_in_mt_code                    IN     VARCHAR2,
961     x_enr_after_tc_code                 IN     VARCHAR2,
962     x_rep_entity_id_txt                 IN     VARCHAR2,
963     x_response_option_code              IN     VARCHAR2,
964     x_term_start_offset_num             IN     NUMBER
965 
966   ) AS
967   /*
968   ||  Created By : avenkatr
969   ||  Created On : 04-JAN-2001
970   ||  Purpose : Handles the UPDATE DML logic for the table.
971   ||  Known limitations, enhancements or remarks :
972   ||  Change History :
973   ||  Who             When            What
974   ||  (reverse chronological order - newest change first)
975   */
976     x_last_update_date           DATE ;
977     x_last_updated_by            NUMBER;
978     x_last_update_login          NUMBER;
979 
980   BEGIN
981 
982     x_last_update_date := SYSDATE;
983     IF (X_MODE = 'I') THEN
984       x_last_updated_by := 1;
985       x_last_update_login := 0;
986     ELSIF (x_mode = 'R') THEN
987       x_last_updated_by := fnd_global.user_id;
988       IF x_last_updated_by IS NULL THEN
989         x_last_updated_by := -1;
990       END IF;
991       x_last_update_login := fnd_global.login_id;
992       IF (x_last_update_login IS NULL) THEN
993         x_last_update_login := -1;
994       END IF;
995     ELSE
996       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
997       igs_ge_msg_stack.add;
998       app_exception.raise_exception;
999     END IF;
1000 
1001     before_dml(
1002       p_action                            => 'UPDATE',
1003       x_rowid                             => x_rowid,
1004       x_pell_seq_id                       => x_pell_seq_id,
1008       x_pell_profile                      => x_pell_profile,
1005       x_ci_cal_type                       => x_ci_cal_type,
1006       x_ci_sequence_number                => x_ci_sequence_number,
1007       x_rep_pell_id                       => x_rep_pell_id,
1009       x_branch_campus                     => x_branch_campus,
1010       x_attend_campus_id                  => x_attend_campus_id,
1011       x_use_census_dts                    => x_use_census_dts,
1012       x_funding_method                    => x_funding_method,
1013       x_inst_cross_ref_code               => x_inst_cross_ref_code,
1014       x_low_tution_fee                    => x_low_tution_fee,
1015       x_academic_cal                      => x_academic_cal,
1016       x_payment_method                    => x_payment_method,
1017       x_wk_inst_time_calc_pymt            => x_wk_inst_time_calc_pymt,
1018       x_wk_int_time_prg_def_yr            => x_wk_int_time_prg_def_yr,
1019       x_cr_clk_hrs_prds_sch_yr            => x_cr_clk_hrs_prds_sch_yr,
1020       x_cr_clk_hrs_acad_yr                => x_cr_clk_hrs_acad_yr,
1021       x_alt_coa_limit                     => x_alt_coa_limit,
1022       x_efc_max                           => x_efc_max ,
1023       x_pell_alt_exp_max                  => x_pell_alt_exp_max,
1024       x_creation_date                     => x_last_update_date,
1025       x_created_by                        => x_last_updated_by,
1026       x_last_update_date                  => x_last_update_date,
1027       x_last_updated_by                   => x_last_updated_by,
1028       x_last_update_login                 => x_last_update_login,
1029       x_course_cd                         => x_course_cd,
1030       x_version_number                    => x_version_number,
1031       x_payment_periods_num               => x_payment_periods_num,
1032       x_enr_before_ts_code                => x_enr_before_ts_code,
1033       x_enr_in_mt_code                    => x_enr_in_mt_code,
1034       x_enr_after_tc_code                 => x_enr_after_tc_code,
1035       x_rep_entity_id_txt                 => x_rep_entity_id_txt,
1036       x_response_option_code              => x_response_option_code,
1037       x_term_start_offset_num             => x_term_start_offset_num
1038 
1039     );
1040 
1041     UPDATE igf_gr_pell_setup_all
1042       SET
1043         ci_cal_type                       = new_references.ci_cal_type,
1044         ci_sequence_number                = new_references.ci_sequence_number,
1045         rep_pell_id                       = new_references.rep_pell_id,
1046         branch_campus                     = new_references.branch_campus,
1047         attend_campus_id                  = new_references.attend_campus_id,
1048         funding_method                    = new_references.funding_method,
1049         inst_cross_ref_code               = new_references.inst_cross_ref_code,
1050         academic_cal                      = new_references.academic_cal,
1051         payment_method                    = new_references.payment_method,
1052         wk_inst_time_calc_pymt            = new_references.wk_inst_time_calc_pymt,
1053         wk_int_time_prg_def_yr            = new_references.wk_int_time_prg_def_yr,
1054         cr_clk_hrs_prds_sch_yr            = new_references.cr_clk_hrs_prds_sch_yr,
1055         cr_clk_hrs_acad_yr                = new_references.cr_clk_hrs_acad_yr,
1056         alt_coa_limit                     = new_references.alt_coa_limit,
1057         efc_max                           = new_references.efc_max ,
1058         pell_alt_exp_max                  = new_references.pell_alt_exp_max ,
1059         last_update_date                  = x_last_update_date,
1060         last_updated_by                   = x_last_updated_by,
1061         last_update_login                 = x_last_update_login,
1062         course_cd                         = x_course_cd,
1063         version_number                    = x_version_number,
1064         payment_periods_num               = x_payment_periods_num,
1065         enr_before_ts_code                = x_enr_before_ts_code,
1066         enr_in_mt_code                    = x_enr_in_mt_code,
1067         enr_after_tc_code                 = x_enr_after_tc_code,
1068         rep_entity_id_txt                 = new_references.rep_entity_id_txt,
1069         response_option_code              = new_references.response_option_code,
1070 	term_start_offset_num             = new_references.term_start_offset_num
1071 
1072       WHERE rowid = x_rowid;
1073 
1074     IF (SQL%NOTFOUND) THEN
1075       RAISE NO_DATA_FOUND;
1076     END IF;
1077 
1078   END update_row;
1079 
1080 
1081   PROCEDURE add_row (
1082     x_rowid                             IN OUT NOCOPY VARCHAR2,
1083     x_pell_seq_id                       IN OUT NOCOPY NUMBER,
1084     x_ci_cal_type                       IN     VARCHAR2,
1085     x_ci_sequence_number                IN     NUMBER,
1086     x_rep_pell_id                       IN     VARCHAR2,
1087     x_pell_profile                      IN     VARCHAR2,
1088     x_branch_campus                     IN     VARCHAR2,
1089     x_attend_campus_id                  IN     VARCHAR2,
1090     x_use_census_dts                    IN     VARCHAR2,
1091     x_funding_method                    IN     VARCHAR2,
1092     x_inst_cross_ref_code               IN     VARCHAR2,
1093     x_low_tution_fee                    IN     VARCHAR2,
1094     x_academic_cal                      IN     VARCHAR2,
1095     x_payment_method                    IN     VARCHAR2,
1096     x_wk_inst_time_calc_pymt            IN     NUMBER,
1097     x_wk_int_time_prg_def_yr            IN     NUMBER,
1098     x_cr_clk_hrs_prds_sch_yr            IN     NUMBER,
1099     x_cr_clk_hrs_acad_yr                IN     NUMBER,
1100     x_alt_coa_limit                     IN     NUMBER,
1101     x_efc_max                           IN     NUMBER,
1102     x_pell_alt_exp_max                  IN     NUMBER,
1103     x_mode                              IN     VARCHAR2,
1104     x_course_cd                         IN     VARCHAR2,
1105     x_version_number                    IN     NUMBER  ,
1106     x_payment_periods_num               IN     NUMBER  ,
1107     x_enr_before_ts_code                IN     VARCHAR2,
1108     x_enr_in_mt_code                    IN     VARCHAR2,
1109     x_enr_after_tc_code                 IN     VARCHAR2,
1110     x_rep_entity_id_txt                 IN     VARCHAR2,
1111     x_response_option_code              IN     VARCHAR2,
1112     x_term_start_offset_num             IN     NUMBER
1113 
1114   ) AS
1115   /*
1116   ||  Created By : avenkatr
1117   ||  Created On : 04-JAN-2001
1118   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
1119   ||  Known limitations, enhancements or remarks :
1120   ||  Change History :
1121   ||  Who             When            What
1122   ||  (reverse chronological order - newest change first)
1123   */
1124     CURSOR c1 IS
1125       SELECT   rowid
1126       FROM     igf_gr_pell_setup_all
1127       WHERE    pell_seq_id                       = x_pell_seq_id;
1128 
1129   BEGIN
1130 
1131     OPEN c1;
1132     FETCH c1 INTO x_rowid;
1133     IF (c1%NOTFOUND) THEN
1134       CLOSE c1;
1135 
1136       insert_row (
1137         x_rowid,
1138         x_pell_seq_id,
1139         x_ci_cal_type,
1140         x_ci_sequence_number,
1141         x_rep_pell_id,
1142         x_pell_profile,
1143         x_branch_campus,
1144         x_attend_campus_id,
1145         x_use_census_dts,
1146         x_funding_method,
1147         x_inst_cross_ref_code,
1148         x_low_tution_fee,
1149         x_academic_cal,
1150         x_payment_method,
1151         x_wk_inst_time_calc_pymt,
1152         x_wk_int_time_prg_def_yr,
1153         x_cr_clk_hrs_prds_sch_yr,
1154         x_cr_clk_hrs_acad_yr,
1155         x_alt_coa_limit,
1156 	x_efc_max,
1157         x_pell_alt_exp_max,
1158         x_mode,
1159         x_course_cd,
1160         x_version_number,
1161         x_payment_periods_num,
1162         x_enr_before_ts_code,
1163         x_enr_in_mt_code,
1164         x_enr_after_tc_code,
1165         x_rep_entity_id_txt,
1166         x_response_option_code,
1167         x_term_start_offset_num
1168       );
1169       RETURN;
1170     END IF;
1171     CLOSE c1;
1172 
1173     update_row (
1174       x_rowid,
1175       x_pell_seq_id,
1176       x_ci_cal_type,
1177       x_ci_sequence_number,
1178       x_rep_pell_id,
1179       x_pell_profile,
1180       x_branch_campus,
1181       x_attend_campus_id,
1182       x_use_census_dts,
1183       x_funding_method,
1184       x_inst_cross_ref_code,
1185       x_low_tution_fee,
1186       x_academic_cal,
1187       x_payment_method,
1188       x_wk_inst_time_calc_pymt,
1189       x_wk_int_time_prg_def_yr,
1190       x_cr_clk_hrs_prds_sch_yr,
1191       x_cr_clk_hrs_acad_yr,
1192       x_alt_coa_limit,
1193       x_efc_max,
1194       x_pell_alt_exp_max,
1195       x_mode,
1196       x_course_cd,
1197       x_version_number,
1198       x_payment_periods_num,
1199       x_enr_before_ts_code,
1200       x_enr_in_mt_code,
1201       x_enr_after_tc_code,
1202       x_rep_entity_id_txt,
1203       x_response_option_code,
1204       x_term_start_offset_num
1205 
1206     );
1207 
1208   END add_row;
1209 
1210 
1211   PROCEDURE delete_row (
1212     x_rowid IN VARCHAR2
1213   ) AS
1214   /*
1215   ||  Created By : avenkatr
1216   ||  Created On : 04-JAN-2001
1217   ||  Purpose : Handles the DELETE DML logic for the table.
1218   ||  Known limitations, enhancements or remarks :
1219   ||  Change History :
1220   ||  Who             When            What
1221   ||  (reverse chronological order - newest change first)
1222   */
1223   BEGIN
1224 
1225     before_dml (
1226       p_action => 'DELETE',
1227       x_rowid => x_rowid
1228     );
1229 
1230     DELETE FROM igf_gr_pell_setup_all
1231     WHERE rowid = x_rowid;
1232 
1233     IF (SQL%NOTFOUND) THEN
1234       RAISE NO_DATA_FOUND;
1235     END IF;
1236 
1237   END delete_row;
1238 
1239 
1240 END igf_gr_pell_setup_pkg;