DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_AW_LOAN_LIMIT_PKG

Source


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