DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_FI_PP_INSTLMNTS_PKG

Source


1 PACKAGE BODY igs_fi_pp_instlmnts_pkg AS
2 /* $Header: IGSSIE1B.pls 115.1 2003/09/08 16:12:59 shtatiko noship $ */
3 
4   l_rowid VARCHAR2(25);
5   old_references igs_fi_pp_instlmnts%ROWTYPE;
6   new_references igs_fi_pp_instlmnts%ROWTYPE;
7 
8   PROCEDURE set_column_values (
9     p_action                            IN     VARCHAR2,
10     x_rowid                             IN     VARCHAR2,
11     x_installment_id                    IN     NUMBER,
12     x_student_plan_id                   IN     NUMBER,
13     x_installment_line_num              IN     NUMBER,
14     x_due_day                           IN     NUMBER,
15     x_due_month_code                    IN     VARCHAR2,
16     x_due_year                          IN     NUMBER,
17     x_due_date                          IN     DATE,
18     x_installment_amt                   IN     NUMBER,
19     x_due_amt                           IN     NUMBER,
20     x_penalty_flag                      IN     VARCHAR2,
21     x_creation_date                     IN     DATE,
22     x_created_by                        IN     NUMBER,
23     x_last_update_date                  IN     DATE,
24     x_last_updated_by                   IN     NUMBER,
25     x_last_update_login                 IN     NUMBER
26   ) AS
27   /*
28   ||  Created By : smvk
29   ||  Created On : 25-AUG-2003
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     igs_fi_pp_instlmnts
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.installment_id                    := x_installment_id;
61     new_references.student_plan_id                   := x_student_plan_id;
62     new_references.installment_line_num              := x_installment_line_num;
63     new_references.due_day                           := x_due_day;
64     new_references.due_month_code                    := x_due_month_code;
65     new_references.due_year                          := x_due_year;
66     new_references.due_date                          := x_due_date;
67     new_references.installment_amt                   := x_installment_amt;
68     new_references.due_amt                           := x_due_amt;
69     new_references.penalty_flag                      := x_penalty_flag;
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 : smvk
89   ||  Created On : 25-AUG-2003
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.student_plan_id,
100            new_references.installment_line_num
101          )
102        ) THEN
103       fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
104       igs_ge_msg_stack.add;
105       app_exception.raise_exception;
106     END IF;
107 
108     IF ( get_uk2_for_validation (
109            new_references.student_plan_id,
110            new_references.due_date
111          )
112        ) THEN
113       fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
114       igs_ge_msg_stack.add;
115       app_exception.raise_exception;
116     END IF;
117 
118   END check_uniqueness;
119 
120 
121   PROCEDURE check_parent_existance AS
122   /*
123   ||  Created By : smvk
124   ||  Created On : 25-AUG-2003
125   ||  Purpose : Checks for the existance of Parent records.
126   ||  Known limitations, enhancements or remarks :
127   ||  Change History :
128   ||  Who             When            What
129   ||  (reverse chronological order - newest change first)
130   */
131   BEGIN
132 
133     IF (((old_references.student_plan_id = new_references.student_plan_id)) OR
134         ((new_references.student_plan_id IS NULL))) THEN
135       NULL;
136     ELSIF NOT igs_fi_pp_std_attrs_pkg.get_pk_for_validation (
137                 new_references.student_plan_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_installment_id                    IN     NUMBER
149   ) RETURN BOOLEAN AS
150   /*
151   ||  Created By : smvk
152   ||  Created On : 25-AUG-2003
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_fi_pp_instlmnts
162       WHERE    installment_id = x_installment_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_student_plan_id                   IN     NUMBER,
184     x_installment_line_num              IN     NUMBER
185   ) RETURN BOOLEAN AS
186   /*
187   ||  Created By : smvk
188   ||  Created On : 25-AUG-2003
189   ||  Purpose : Validates the Unique Keys of the table.
190   ||  Known limitations, enhancements or remarks :
191   ||  Change History :
192   ||  Who             When            What
193   ||  (reverse chronological order - newest change first)
194   */
195     CURSOR cur_rowid IS
196       SELECT   rowid
197       FROM     igs_fi_pp_instlmnts
198       WHERE    student_plan_id = x_student_plan_id
199       AND      installment_line_num = x_installment_line_num
200       AND      ((l_rowid IS NULL) OR (rowid <> l_rowid));
201 
202     lv_rowid cur_rowid%RowType;
203 
204   BEGIN
205 
206     OPEN cur_rowid;
207     FETCH cur_rowid INTO lv_rowid;
208     IF (cur_rowid%FOUND) THEN
209       CLOSE cur_rowid;
210         RETURN (true);
211         ELSE
212        CLOSE cur_rowid;
213       RETURN(FALSE);
214     END IF;
215 
216   END get_uk_for_validation ;
217 
218 
219   FUNCTION get_uk2_for_validation (
220     x_student_plan_id                   IN     NUMBER,
221     x_due_date                          IN     DATE
222   ) RETURN BOOLEAN AS
223   /*
224   ||  Created By : smvk
225   ||  Created On : 25-AUG-2003
226   ||  Purpose : Validates the Unique Keys of the table.
227   ||  Known limitations, enhancements or remarks :
228   ||  Change History :
229   ||  Who             When            What
230   ||  (reverse chronological order - newest change first)
231   */
232     CURSOR cur_rowid IS
233       SELECT   rowid
234       FROM     igs_fi_pp_instlmnts
235       WHERE    student_plan_id = x_student_plan_id
236       AND      due_date = x_due_date
237       AND      ((l_rowid IS NULL) OR (rowid <> l_rowid));
238 
239     lv_rowid cur_rowid%RowType;
240 
241   BEGIN
242 
243     OPEN cur_rowid;
244     FETCH cur_rowid INTO lv_rowid;
245     IF (cur_rowid%FOUND) THEN
246       CLOSE cur_rowid;
247         RETURN (true);
248         ELSE
249        CLOSE cur_rowid;
250       RETURN(FALSE);
251     END IF;
252 
253   END get_uk2_for_validation ;
254 
255 
256   PROCEDURE get_fk_igs_fi_pp_std_attrs (
257     x_student_plan_id                   IN     NUMBER
258   ) AS
259   /*
260   ||  Created By : smvk
261   ||  Created On : 25-AUG-2003
262   ||  Purpose : Validates the Foreign Keys for the table.
263   ||  Known limitations, enhancements or remarks :
264   ||  Change History :
265   ||  Who             When            What
266   ||  (reverse chronological order - newest change first)
267   */
268     CURSOR cur_rowid IS
269       SELECT   rowid
270       FROM     igs_fi_pp_instlmnts
271       WHERE   ((student_plan_id = x_student_plan_id));
272 
273     lv_rowid cur_rowid%RowType;
274 
275   BEGIN
276 
277     OPEN cur_rowid;
278     FETCH cur_rowid INTO lv_rowid;
279     IF (cur_rowid%FOUND) THEN
280       CLOSE cur_rowid;
281       fnd_message.set_name ('IGS', 'IGS_FI_PPIN_PPSA_FK');
282       igs_ge_msg_stack.add;
283       app_exception.raise_exception;
284       RETURN;
285     END IF;
286     CLOSE cur_rowid;
287 
288   END get_fk_igs_fi_pp_std_attrs;
289 
290 
291   PROCEDURE before_dml (
292     p_action                            IN     VARCHAR2,
293     x_rowid                             IN     VARCHAR2,
294     x_installment_id                    IN     NUMBER,
295     x_student_plan_id                   IN     NUMBER,
296     x_installment_line_num              IN     NUMBER,
297     x_due_day                           IN     NUMBER,
298     x_due_month_code                    IN     VARCHAR2,
299     x_due_year                          IN     NUMBER,
300     x_due_date                          IN     DATE,
301     x_installment_amt                   IN     NUMBER,
302     x_due_amt                           IN     NUMBER,
303     x_penalty_flag                      IN     VARCHAR2,
304     x_creation_date                     IN     DATE,
305     x_created_by                        IN     NUMBER,
306     x_last_update_date                  IN     DATE,
307     x_last_updated_by                   IN     NUMBER,
308     x_last_update_login                 IN     NUMBER
309   ) AS
310   /*
311   ||  Created By : smvk
312   ||  Created On : 25-AUG-2003
313   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
314   ||            Trigger Handlers for the table, before any DML operation.
315   ||  Known limitations, enhancements or remarks :
316   ||  Change History :
317   ||  Who             When            What
318   ||  (reverse chronological order - newest change first)
319   */
320   BEGIN
321 
322     set_column_values (
323       p_action,
324       x_rowid,
325       x_installment_id,
326       x_student_plan_id,
327       x_installment_line_num,
328       x_due_day,
329       x_due_month_code,
330       x_due_year,
331       x_due_date,
332       x_installment_amt,
333       x_due_amt,
334       x_penalty_flag,
335       x_creation_date,
336       x_created_by,
337       x_last_update_date,
338       x_last_updated_by,
339       x_last_update_login
340     );
341 
342     IF (p_action = 'INSERT') THEN
343       -- Call all the procedures related to Before Insert.
344       IF ( get_pk_for_validation(
345              new_references.installment_id
346            )
347          ) THEN
348         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
349         igs_ge_msg_stack.add;
350         app_exception.raise_exception;
351       END IF;
352       check_uniqueness;
353       check_parent_existance;
354     ELSIF (p_action = 'UPDATE') THEN
355       -- Call all the procedures related to Before Update.
356       check_uniqueness;
357       check_parent_existance;
358     ELSIF (p_action = 'VALIDATE_INSERT') THEN
359       -- Call all the procedures related to Before Insert.
360       IF ( get_pk_for_validation (
361              new_references.installment_id
362            )
363          ) THEN
364         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
365         igs_ge_msg_stack.add;
366         app_exception.raise_exception;
367       END IF;
368       check_uniqueness;
369     ELSIF (p_action = 'VALIDATE_UPDATE') THEN
370       check_uniqueness;
371     END IF;
372 
373     l_rowid := NULL;
374 
375   END before_dml;
376 
377 
378   PROCEDURE insert_row (
379     x_rowid                             IN OUT NOCOPY VARCHAR2,
380     x_installment_id                    IN OUT NOCOPY NUMBER,
381     x_student_plan_id                   IN     NUMBER,
382     x_installment_line_num              IN     NUMBER,
383     x_due_day                           IN     NUMBER,
384     x_due_month_code                    IN     VARCHAR2,
385     x_due_year                          IN     NUMBER,
386     x_due_date                          IN     DATE,
387     x_installment_amt                   IN     NUMBER,
388     x_due_amt                           IN     NUMBER,
389     x_penalty_flag                      IN     VARCHAR2,
390     x_mode                              IN     VARCHAR2
391   ) AS
392   /*
393   ||  Created By : smvk
394   ||  Created On : 25-AUG-2003
395   ||  Purpose : Handles the INSERT DML logic for the table.
396   ||  Known limitations, enhancements or remarks :
397   ||  Change History :
398   ||  Who             When            What
399   ||  (reverse chronological order - newest change first)
400   */
401 
402     x_last_update_date           DATE;
403     x_last_updated_by            NUMBER;
404     x_last_update_login          NUMBER;
405     x_request_id                 NUMBER;
406     x_program_id                 NUMBER;
407     x_program_application_id     NUMBER;
408     x_program_update_date        DATE;
409 
410   BEGIN
411 
412     x_last_update_date := SYSDATE;
413     IF (x_mode = 'I') THEN
414       x_last_updated_by := 1;
415       x_last_update_login := 0;
416     ELSIF (x_mode = 'R') THEN
417       x_last_updated_by := fnd_global.user_id;
418       IF (x_last_updated_by IS NULL) THEN
419         x_last_updated_by := -1;
420       END IF;
421       x_last_update_login := fnd_global.login_id;
422       IF (x_last_update_login IS NULL) THEN
423         x_last_update_login := -1;
424       END IF;
425       x_request_id             := fnd_global.conc_request_id;
426       x_program_id             := fnd_global.conc_program_id;
427       x_program_application_id := fnd_global.prog_appl_id;
428 
429       IF (x_request_id = -1) THEN
430         x_request_id             := NULL;
431         x_program_id             := NULL;
432         x_program_application_id := NULL;
433         x_program_update_date    := NULL;
434       ELSE
435         x_program_update_date    := SYSDATE;
436       END IF;
437     ELSE
438       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
439       fnd_message.set_token ('ROUTINE', 'IGS_FI_PP_INSTLMNTS_PKG.INSERT_ROW');
440       igs_ge_msg_stack.add;
441       app_exception.raise_exception;
442     END IF;
443 
444     x_installment_id := NULL;
445 
446     before_dml(
447       p_action                            => 'INSERT',
448       x_rowid                             => x_rowid,
449       x_installment_id                    => x_installment_id,
450       x_student_plan_id                   => x_student_plan_id,
451       x_installment_line_num              => x_installment_line_num,
452       x_due_day                           => x_due_day,
453       x_due_month_code                    => x_due_month_code,
454       x_due_year                          => x_due_year,
455       x_due_date                          => x_due_date,
456       x_installment_amt                   => x_installment_amt,
457       x_due_amt                           => x_due_amt,
458       x_penalty_flag                      => x_penalty_flag,
459       x_creation_date                     => x_last_update_date,
460       x_created_by                        => x_last_updated_by,
461       x_last_update_date                  => x_last_update_date,
462       x_last_updated_by                   => x_last_updated_by,
463       x_last_update_login                 => x_last_update_login
464     );
465 
466     INSERT INTO igs_fi_pp_instlmnts (
467       installment_id,
468       student_plan_id,
469       installment_line_num,
470       due_day,
471       due_month_code,
472       due_year,
473       due_date,
474       installment_amt,
475       due_amt,
476       penalty_flag,
477       creation_date,
478       created_by,
479       last_update_date,
480       last_updated_by,
481       last_update_login,
482       request_id,
483       program_id,
484       program_application_id,
485       program_update_date
486     ) VALUES (
487       igs_fi_pp_instlmnts_s.NEXTVAL,
488       new_references.student_plan_id,
489       new_references.installment_line_num,
490       new_references.due_day,
491       new_references.due_month_code,
492       new_references.due_year,
493       new_references.due_date,
494       new_references.installment_amt,
495       new_references.due_amt,
496       new_references.penalty_flag,
497       x_last_update_date,
498       x_last_updated_by,
499       x_last_update_date,
500       x_last_updated_by,
501       x_last_update_login ,
502       x_request_id,
503       x_program_id,
504       x_program_application_id,
505       x_program_update_date
506     ) RETURNING ROWID, installment_id INTO x_rowid, x_installment_id;
507 
508   END insert_row;
509 
510 
511   PROCEDURE lock_row (
512     x_rowid                             IN     VARCHAR2,
513     x_installment_id                    IN     NUMBER,
514     x_student_plan_id                   IN     NUMBER,
515     x_installment_line_num              IN     NUMBER,
516     x_due_day                           IN     NUMBER,
517     x_due_month_code                    IN     VARCHAR2,
518     x_due_year                          IN     NUMBER,
519     x_due_date                          IN     DATE,
520     x_installment_amt                   IN     NUMBER,
521     x_due_amt                           IN     NUMBER,
522     x_penalty_flag                      IN     VARCHAR2
523   ) AS
524   /*
525   ||  Created By : smvk
526   ||  Created On : 25-AUG-2003
527   ||  Purpose : Handles the LOCK mechanism for the table.
528   ||  Known limitations, enhancements or remarks :
529   ||  Change History :
530   ||  Who             When            What
531   ||  (reverse chronological order - newest change first)
532   */
533     CURSOR c1 IS
534       SELECT
535         student_plan_id,
536         installment_line_num,
537         due_day,
538         due_month_code,
539         due_year,
540         due_date,
541         installment_amt,
542         due_amt,
543         penalty_flag
544       FROM  igs_fi_pp_instlmnts
545       WHERE rowid = x_rowid
546       FOR UPDATE NOWAIT;
547 
548     tlinfo c1%ROWTYPE;
549 
550   BEGIN
551 
552     OPEN c1;
553     FETCH c1 INTO tlinfo;
554     IF (c1%notfound) THEN
555       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
556       igs_ge_msg_stack.add;
557       CLOSE c1;
558       app_exception.raise_exception;
559       RETURN;
560     END IF;
561     CLOSE c1;
562 
563     IF (
564         (tlinfo.student_plan_id = x_student_plan_id)
565         AND (tlinfo.installment_line_num = x_installment_line_num)
566         AND (tlinfo.due_day = x_due_day)
567         AND (tlinfo.due_month_code = x_due_month_code)
568         AND (tlinfo.due_year = x_due_year)
569         AND (tlinfo.due_date = x_due_date)
570         AND (tlinfo.installment_amt = x_installment_amt)
571         AND (tlinfo.due_amt = x_due_amt)
572         AND ((tlinfo.penalty_flag = x_penalty_flag) OR ((tlinfo.penalty_flag IS NULL) AND (X_penalty_flag IS NULL)))
573        ) THEN
574       NULL;
575     ELSE
576       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
577       igs_ge_msg_stack.add;
578       app_exception.raise_exception;
579     END IF;
580 
581     RETURN;
582 
583   END lock_row;
584 
585 
586   PROCEDURE update_row (
587     x_rowid                             IN     VARCHAR2,
588     x_installment_id                    IN     NUMBER,
589     x_student_plan_id                   IN     NUMBER,
590     x_installment_line_num              IN     NUMBER,
591     x_due_day                           IN     NUMBER,
592     x_due_month_code                    IN     VARCHAR2,
593     x_due_year                          IN     NUMBER,
594     x_due_date                          IN     DATE,
595     x_installment_amt                   IN     NUMBER,
596     x_due_amt                           IN     NUMBER,
597     x_penalty_flag                      IN     VARCHAR2,
598     x_mode                              IN     VARCHAR2
599   ) AS
600   /*
601   ||  Created By : smvk
602   ||  Created On : 25-AUG-2003
603   ||  Purpose : Handles the UPDATE DML logic for the table.
604   ||  Known limitations, enhancements or remarks :
605   ||  Change History :
606   ||  Who             When            What
607   ||  (reverse chronological order - newest change first)
608   */
609     x_last_update_date           DATE ;
610     x_last_updated_by            NUMBER;
611     x_last_update_login          NUMBER;
612     x_request_id                 NUMBER;
613     x_program_id                 NUMBER;
614     x_program_application_id     NUMBER;
615     x_program_update_date        DATE;
616 
617   BEGIN
618 
619     x_last_update_date := SYSDATE;
620     IF (X_MODE = 'I') THEN
621       x_last_updated_by := 1;
622       x_last_update_login := 0;
623     ELSIF (x_mode = 'R') THEN
624       x_last_updated_by := fnd_global.user_id;
625       IF x_last_updated_by IS NULL THEN
626         x_last_updated_by := -1;
627       END IF;
628       x_last_update_login := fnd_global.login_id;
629       IF (x_last_update_login IS NULL) THEN
630         x_last_update_login := -1;
631       END IF;
632     ELSE
633       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
634       fnd_message.set_token ('ROUTINE', 'IGS_FI_PP_INSTLMNTS_PKG.UPDATE_ROW');
635       igs_ge_msg_stack.add;
636       app_exception.raise_exception;
637     END IF;
638 
639     before_dml(
640       p_action                            => 'UPDATE',
641       x_rowid                             => x_rowid,
642       x_installment_id                    => x_installment_id,
643       x_student_plan_id                   => x_student_plan_id,
644       x_installment_line_num              => x_installment_line_num,
645       x_due_day                           => x_due_day,
646       x_due_month_code                    => x_due_month_code,
647       x_due_year                          => x_due_year,
648       x_due_date                          => x_due_date,
649       x_installment_amt                   => x_installment_amt,
650       x_due_amt                           => x_due_amt,
651       x_penalty_flag                      => x_penalty_flag,
652       x_creation_date                     => x_last_update_date,
653       x_created_by                        => x_last_updated_by,
654       x_last_update_date                  => x_last_update_date,
655       x_last_updated_by                   => x_last_updated_by,
656       x_last_update_login                 => x_last_update_login
657     );
658 
659     IF (x_mode = 'R') THEN
660       x_request_id := fnd_global.conc_request_id;
661       x_program_id := fnd_global.conc_program_id;
662       x_program_application_id := fnd_global.prog_appl_id;
663       IF (x_request_id =  -1) THEN
664         x_request_id := old_references.request_id;
665         x_program_id := old_references.program_id;
666         x_program_application_id := old_references.program_application_id;
667         x_program_update_date := old_references.program_update_date;
668       ELSE
669         x_program_update_date := SYSDATE;
670       END IF;
671     END IF;
672 
673     UPDATE igs_fi_pp_instlmnts
674       SET
675         student_plan_id                   = new_references.student_plan_id,
676         installment_line_num              = new_references.installment_line_num,
677         due_day                           = new_references.due_day,
678         due_month_code                    = new_references.due_month_code,
679         due_year                          = new_references.due_year,
680         due_date                          = new_references.due_date,
681         installment_amt                   = new_references.installment_amt,
682         due_amt                           = new_references.due_amt,
683         penalty_flag                      = new_references.penalty_flag,
684         last_update_date                  = x_last_update_date,
685         last_updated_by                   = x_last_updated_by,
686         last_update_login                 = x_last_update_login ,
687         request_id                        = x_request_id,
688         program_id                        = x_program_id,
689         program_application_id            = x_program_application_id,
690         program_update_date               = x_program_update_date
691       WHERE rowid = x_rowid;
692 
693     IF (SQL%NOTFOUND) THEN
694       RAISE NO_DATA_FOUND;
695     END IF;
696 
697   END update_row;
698 
699 
700   PROCEDURE add_row (
701     x_rowid                             IN OUT NOCOPY VARCHAR2,
702     x_installment_id                    IN OUT NOCOPY NUMBER,
703     x_student_plan_id                   IN     NUMBER,
704     x_installment_line_num              IN     NUMBER,
705     x_due_day                           IN     NUMBER,
706     x_due_month_code                    IN     VARCHAR2,
707     x_due_year                          IN     NUMBER,
708     x_due_date                          IN     DATE,
709     x_installment_amt                   IN     NUMBER,
710     x_due_amt                           IN     NUMBER,
711     x_penalty_flag                      IN     VARCHAR2,
712     x_mode                              IN     VARCHAR2
713   ) AS
714   /*
715   ||  Created By : smvk
716   ||  Created On : 25-AUG-2003
717   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
718   ||  Known limitations, enhancements or remarks :
719   ||  Change History :
720   ||  Who             When            What
721   ||  (reverse chronological order - newest change first)
722   */
723     CURSOR c1 IS
724       SELECT   rowid
725       FROM     igs_fi_pp_instlmnts
726       WHERE    installment_id                    = x_installment_id;
727 
728   BEGIN
729 
730     OPEN c1;
731     FETCH c1 INTO x_rowid;
732     IF (c1%NOTFOUND) THEN
733       CLOSE c1;
734 
735       insert_row (
736         x_rowid,
737         x_installment_id,
738         x_student_plan_id,
739         x_installment_line_num,
740         x_due_day,
741         x_due_month_code,
742         x_due_year,
743         x_due_date,
744         x_installment_amt,
745         x_due_amt,
746         x_penalty_flag,
747         x_mode
748       );
749       RETURN;
750     END IF;
751     CLOSE c1;
752 
753     update_row (
754       x_rowid,
755       x_installment_id,
756       x_student_plan_id,
757       x_installment_line_num,
758       x_due_day,
759       x_due_month_code,
760       x_due_year,
761       x_due_date,
762       x_installment_amt,
763       x_due_amt,
764       x_penalty_flag,
765       x_mode
766     );
767 
768   END add_row;
769 
770 
771   PROCEDURE delete_row (
772     x_rowid IN VARCHAR2
773   ) AS
774   /*
775   ||  Created By : smvk
776   ||  Created On : 25-AUG-2003
777   ||  Purpose : Handles the DELETE DML logic for the table.
778   ||  Known limitations, enhancements or remarks :
779   ||  Change History :
780   ||  Who             When            What
781   ||  (reverse chronological order - newest change first)
782   */
783   BEGIN
784 
785     before_dml (
786       p_action => 'DELETE',
787       x_rowid => x_rowid
788     );
789 
790     DELETE FROM igs_fi_pp_instlmnts
791     WHERE rowid = x_rowid;
792 
793     IF (SQL%NOTFOUND) THEN
794       RAISE NO_DATA_FOUND;
795     END IF;
796 
797   END delete_row;
798 
799 
800 END igs_fi_pp_instlmnts_pkg;