DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_FI_IMP_CHGS_PKG

Source


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