DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_SE_PAYMENT_INT_PKG

Source


1 PACKAGE BODY igf_se_payment_int_pkg AS
2 /* $Header: IGFSI03B.pls 120.0 2005/06/01 14:53:53 appldev noship $ */
3 
4 /*=======================================================================+
5  |  Copyright (c) 1994, 1996 Oracle Corp. Redwood Shores, California, USA|
6  |                            All rights reserved.                       |
7  +=======================================================================+
8  |                                                                       |
9  | DESCRIPTION                                                           |
10  |      PL/SQL body for package: IGF_SE_PAYMENT_INT_PKG
11  |                                                                       |
12  | NOTES                                                                 |
13  |                                                                       |
14  | This package has a flag on the end of some of the procedures called   |
15  | X_MODE. Pass either 'R' for runtime, or 'I' for Install-time.         |
16  | This will control how the who columns are filled in; If you are       |
17  | running in runtime mode, they are taken from the profiles, whereas in |
18  | install-time mode they get defaulted with special values to indicate  |
19  | that they were inserted by datamerge.                                 |
20  |                                                                       |
21  | The ADD_ROW routine will see whether a row exists by selecting        |
22  | based on the primary key, and updates the row if it exists,           |
23  | or inserts the row if it doesn't already exist.                       |
24  |                                                                       |
25  | This module is called by AutoInstall (afplss.drv) on install and      |
26  | upgrade.  The WHENEVER SQLERROR and EXIT (at bottom) are required.    |
27  |                                                                       |
28  | HISTORY                                                               |
29  | veramach        July 2004    Obsoleted ld_cal_type,ld_sequence_number,|
30  |                              hrs_worked                               |
31  *=======================================================================*/
32 
33   l_rowid VARCHAR2(25);
34   old_references igf_se_payment_int%ROWTYPE;
35   new_references igf_se_payment_int%ROWTYPE;
36 
37   PROCEDURE set_column_values (
38     p_action                            IN     VARCHAR2,
39     x_rowid                             IN     VARCHAR2    DEFAULT NULL,
40     x_transaction_id                    IN     NUMBER      DEFAULT NULL,
41     x_batch_id                          IN     NUMBER      DEFAULT NULL,
42     x_payroll_id                        IN     NUMBER      DEFAULT NULL,
43     x_payroll_date                      IN     DATE        DEFAULT NULL,
44     x_auth_id                           IN     NUMBER      DEFAULT NULL,
45     x_person_id                         IN     NUMBER      DEFAULT NULL,
46     x_fund_id                           IN     NUMBER      DEFAULT NULL,
47     x_paid_amount                       IN     NUMBER      DEFAULT NULL,
48     x_org_unit_cd                       IN     VARCHAR2    DEFAULT NULL,
49     x_status                            IN     VARCHAR2    DEFAULT NULL,
50     x_error_code                        IN     VARCHAR2    DEFAULT NULL,
51     x_creation_date                     IN     DATE        DEFAULT NULL,
52     x_created_by                        IN     NUMBER      DEFAULT NULL,
53     x_last_update_date                  IN     DATE        DEFAULT NULL,
54     x_last_updated_by                   IN     NUMBER      DEFAULT NULL,
55     x_last_update_login                 IN     NUMBER      DEFAULT NULL
56   ) AS
57   /*
58   ||  Created By : ssawhney
59   ||  Created On : 31-DEC-2001
60   ||  Purpose : Initialises the Old and New references for the columns of the table.
61   ||  Known limitations, enhancements or remarks :
62   ||  Change History :
63   ||  Who             When            What
64   ||  (reverse chronological order - newest change first)
65   */
66 
67     CURSOR cur_old_ref_values IS
68       SELECT   *
69       FROM     IGF_SE_PAYMENT_INT
70       WHERE    rowid = x_rowid;
71 
72   BEGIN
73 
74     l_rowid := x_rowid;
75 
76     -- Code for setting the Old and New Reference Values.
77     -- Populate Old Values.
78     OPEN cur_old_ref_values;
79     FETCH cur_old_ref_values INTO old_references;
80     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
81       CLOSE cur_old_ref_values;
82       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
83       igs_ge_msg_stack.add;
84       app_exception.raise_exception;
85       RETURN;
86     END IF;
87     CLOSE cur_old_ref_values;
88 
89     -- Populate New Values.
90     new_references.transaction_id                    := x_transaction_id;
91     new_references.batch_id                          := x_batch_id;
92     new_references.payroll_id                        := x_payroll_id;
93     new_references.payroll_date                      := x_payroll_date;
94     new_references.auth_id                           := x_auth_id;
95     new_references.person_id                         := x_person_id;
96     new_references.fund_id                           := x_fund_id;
97     new_references.paid_amount                       := x_paid_amount;
98     new_references.org_unit_cd                       := x_org_unit_cd;
99     new_references.status                            := x_status;
100     new_references.error_code                        := x_error_code;
101 
102     IF (p_action = 'UPDATE') THEN
103       new_references.creation_date                   := old_references.creation_date;
104       new_references.created_by                      := old_references.created_by;
105     ELSE
106       new_references.creation_date                   := x_creation_date;
107       new_references.created_by                      := x_created_by;
108     END IF;
109 
110     new_references.last_update_date                  := x_last_update_date;
111     new_references.last_updated_by                   := x_last_updated_by;
112     new_references.last_update_login                 := x_last_update_login;
113 
114   END set_column_values;
115 
116   PROCEDURE check_constraints (
117     column_name    IN     VARCHAR2    DEFAULT NULL,
118     column_value   IN     VARCHAR2    DEFAULT NULL
119   ) AS
120   /*
121   ||  Created By : ssawhney
122   ||  Created On : 02-JAN-2002
123   ||  Purpose : Handles the Check Constraint logic for the the columns.
124   ||  Known limitations, enhancements or remarks :
125   ||  Change History :
126   ||  Who             When            What
127   ||  (reverse chronological order - newest change first)
128   */
129   BEGIN
130 
131     IF (column_name IS NULL) THEN
132       NULL;
133     ELSIF (UPPER(column_name) = 'STATUS') THEN
134       new_references.status := column_value;
135     END IF;
136 
137     IF (UPPER(column_name) = 'STATUS' OR column_name IS NULL) THEN
138       IF NOT (new_references.status IN ('NEW','DONE','ERROR'))  THEN
139         fnd_message.set_name('IGS','IGS_GE_INVALID_VALUE');
140         igs_ge_msg_stack.add;
141         app_exception.raise_exception;
142       END IF;
143     END IF;
144 
145   END check_constraints;
146 
147 
148   PROCEDURE check_uniqueness AS
149   /*
150   ||  Created By : ssawhney
151   ||  Created On : 31-DEC-2001
152   ||  Purpose : Handles the Unique Constraint logic defined for the columns.
153   ||  Known limitations, enhancements or remarks :
154   ||  Change History :
155   ||  Who             When            What
156   ||  (reverse chronological order - newest change first)
157   */
158   BEGIN
159 
160     IF ( get_uk_for_validation (
161            new_references.payroll_id,
162            new_references.auth_id
163          )
164        ) THEN
165       fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
166       igs_ge_msg_stack.add;
167       app_exception.raise_exception;
168     END IF;
169 
170   END check_uniqueness;
171 
172 
173   FUNCTION get_pk_for_validation (
174     x_transaction_id                    IN     NUMBER
175   ) RETURN BOOLEAN AS
176   /*
177   ||  Created By : ssawhney
178   ||  Created On : 31-DEC-2001
179   ||  Purpose : Validates the Primary Key of the table.
180   ||  Known limitations, enhancements or remarks :
181   ||  Change History :
182   ||  Who             When            What
183   ||  (reverse chronological order - newest change first)
184   */
185     CURSOR cur_rowid IS
186       SELECT   rowid
187       FROM     igf_se_payment_int
188       WHERE    transaction_id = x_transaction_id
189       FOR UPDATE NOWAIT;
190 
191     lv_rowid cur_rowid%RowType;
192 
193   BEGIN
194 
195     OPEN cur_rowid;
196     FETCH cur_rowid INTO lv_rowid;
197     IF (cur_rowid%FOUND) THEN
198       CLOSE cur_rowid;
199       RETURN(TRUE);
200     ELSE
201       CLOSE cur_rowid;
202       RETURN(FALSE);
203     END IF;
204 
205   END get_pk_for_validation;
206 
207 
208   FUNCTION get_uk_for_validation (
209     x_payroll_id                        IN     NUMBER,
210     x_auth_id                           IN     NUMBER
211   ) RETURN BOOLEAN AS
212   /*
213   ||  Created By : ssawhney
214   ||  Created On : 31-DEC-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     igf_se_payment_int
224       WHERE    payroll_id = x_payroll_id
225       AND      auth_id = x_auth_id
226       AND      ((l_rowid IS NULL) OR (rowid <> l_rowid));
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_uk_for_validation ;
243 
244 
245   PROCEDURE before_dml (
246     p_action                            IN     VARCHAR2,
247     x_rowid                             IN     VARCHAR2    DEFAULT NULL,
248     x_transaction_id                    IN     NUMBER      DEFAULT NULL,
249     x_batch_id                          IN     NUMBER      DEFAULT NULL,
250     x_payroll_id                        IN     NUMBER      DEFAULT NULL,
251     x_payroll_date                      IN     DATE        DEFAULT NULL,
252     x_auth_id                           IN     NUMBER      DEFAULT NULL,
253     x_person_id                         IN     NUMBER      DEFAULT NULL,
254     x_fund_id                           IN     NUMBER      DEFAULT NULL,
255     x_paid_amount                       IN     NUMBER      DEFAULT NULL,
256     x_org_unit_cd                       IN     VARCHAR2    DEFAULT NULL,
257     x_status                            IN     VARCHAR2    DEFAULT NULL,
258     x_error_code                        IN     VARCHAR2    DEFAULT NULL,
259     x_creation_date                     IN     DATE        DEFAULT NULL,
260     x_created_by                        IN     NUMBER      DEFAULT NULL,
261     x_last_update_date                  IN     DATE        DEFAULT NULL,
262     x_last_updated_by                   IN     NUMBER      DEFAULT NULL,
263     x_last_update_login                 IN     NUMBER      DEFAULT NULL
264   ) AS
265   /*
266   ||  Created By : ssawhney
267   ||  Created On : 31-DEC-2001
268   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
269   ||            Trigger Handlers for the table, before any DML operation.
270   ||  Known limitations, enhancements or remarks :
271   ||  Change History :
272   ||  Who             When            What
273   ||  (reverse chronological order - newest change first)
274   */
275   BEGIN
276 
277     set_column_values (
278       p_action,
279       x_rowid,
280       x_transaction_id,
281       x_batch_id,
282       x_payroll_id,
283       x_payroll_date,
284       x_auth_id,
285       x_person_id,
286       x_fund_id,
287       x_paid_amount,
288       x_org_unit_cd,
289       x_status,
290       x_error_code,
291       x_creation_date,
292       x_created_by,
293       x_last_update_date,
294       x_last_updated_by,
295       x_last_update_login
296     );
297 
298     IF (p_action = 'INSERT') THEN
299       -- Call all the procedures related to Before Insert.
300       IF ( get_pk_for_validation(
301              new_references.transaction_id
302            )
303          ) THEN
304         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
305         igs_ge_msg_stack.add;
306         app_exception.raise_exception;
307       END IF;
308       check_uniqueness;
309       check_constraints;
310     ELSIF (p_action = 'UPDATE') THEN
311       -- Call all the procedures related to Before Update.
312       check_uniqueness;
313       check_constraints;
314     ELSIF (p_action = 'VALIDATE_INSERT') THEN
315       -- Call all the procedures related to Before Insert.
316       IF ( get_pk_for_validation (
317              new_references.transaction_id
318            )
319          ) THEN
320         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
321         igs_ge_msg_stack.add;
322         app_exception.raise_exception;
323       END IF;
324       check_uniqueness;
325       check_constraints;
326     ELSIF (p_action = 'VALIDATE_UPDATE') THEN
327       check_uniqueness;
328       check_constraints;
329     END IF;
330 
331   END before_dml;
332 
333 
334   PROCEDURE insert_row (
335     x_rowid                             IN OUT NOCOPY VARCHAR2,
336     x_transaction_id                    IN OUT NOCOPY NUMBER,
337     x_batch_id                          IN     NUMBER,
338     x_payroll_id                        IN     NUMBER,
339     x_payroll_date                      IN     DATE,
340     x_auth_id                           IN     NUMBER,
341     x_person_id                         IN     NUMBER,
342     x_fund_id                           IN     NUMBER,
343     x_paid_amount                       IN     NUMBER,
344     x_org_unit_cd                       IN     VARCHAR2,
345     x_status                            IN     VARCHAR2,
346     x_error_code                        IN     VARCHAR2,
347     x_mode                              IN     VARCHAR2 DEFAULT 'R'
348   ) AS
349   /*
350   ||  Created By : ssawhney
351   ||  Created On : 31-DEC-2001
352   ||  Purpose : Handles the INSERT DML logic for the table.
353   ||  Known limitations, enhancements or remarks :
354   ||  Change History :
355   ||  Who             When            What
356   ||  (reverse chronological order - newest change first)
357   */
358     CURSOR c IS
359       SELECT   rowid
360       FROM     igf_se_payment_int
361       WHERE    transaction_id                    = x_transaction_id;
362 
363     x_last_update_date           DATE;
364     x_last_updated_by            NUMBER;
365     x_last_update_login          NUMBER;
366 
367   BEGIN
368 
369     x_last_update_date := SYSDATE;
370     IF (x_mode = 'I') THEN
371       x_last_updated_by := 1;
372       x_last_update_login := 0;
373     ELSIF (x_mode = 'R') THEN
374       x_last_updated_by := fnd_global.user_id;
375       IF (x_last_updated_by IS NULL) THEN
376         x_last_updated_by := -1;
377       END IF;
378       x_last_update_login := fnd_global.login_id;
379       IF (x_last_update_login IS NULL) THEN
380         x_last_update_login := -1;
381       END IF;
382     ELSE
386     END IF;
383       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
384       igs_ge_msg_stack.add;
385       app_exception.raise_exception;
387 
388     SELECT    igf_se_payment_int_s.NEXTVAL
389     INTO      x_transaction_id
390     FROM      dual;
391 
392     before_dml(
393       p_action                            => 'INSERT',
394       x_rowid                             => x_rowid,
395       x_transaction_id                    => x_transaction_id,
396       x_batch_id                          => x_batch_id,
397       x_payroll_id                        => x_payroll_id,
398       x_payroll_date                      => x_payroll_date,
399       x_auth_id                           => x_auth_id,
400       x_person_id                         => x_person_id,
401       x_fund_id                           => x_fund_id,
402       x_paid_amount                       => x_paid_amount,
403       x_org_unit_cd                       => x_org_unit_cd,
404       x_status                            => x_status,
405       x_error_code                        => x_error_code,
406       x_creation_date                     => x_last_update_date,
407       x_created_by                        => x_last_updated_by,
408       x_last_update_date                  => x_last_update_date,
409       x_last_updated_by                   => x_last_updated_by,
410       x_last_update_login                 => x_last_update_login
411     );
412 
413     INSERT INTO igf_se_payment_int (
414       transaction_id,
415       batch_id,
416       payroll_id,
417       payroll_date,
418       auth_id,
419       person_id,
420       fund_id,
421       paid_amount,
422       org_unit_cd,
423       status,
424       error_code,
425       creation_date,
426       created_by,
427       last_update_date,
428       last_updated_by,
429       last_update_login
430     ) VALUES (
431       new_references.transaction_id,
432       new_references.batch_id,
433       new_references.payroll_id,
434       new_references.payroll_date,
435       new_references.auth_id,
436       new_references.person_id,
437       new_references.fund_id,
438       new_references.paid_amount,
439       new_references.org_unit_cd,
440       new_references.status,
441       new_references.error_code,
442       x_last_update_date,
443       x_last_updated_by,
444       x_last_update_date,
445       x_last_updated_by,
446       x_last_update_login
447     );
448 
449     OPEN c;
450     FETCH c INTO x_rowid;
451     IF (c%NOTFOUND) THEN
452       CLOSE c;
453       RAISE NO_DATA_FOUND;
454     END IF;
455     CLOSE c;
456 
457   END insert_row;
458 
459 
460   PROCEDURE lock_row (
461     x_rowid                             IN     VARCHAR2,
462     x_transaction_id                    IN     NUMBER,
463     x_batch_id                          IN     NUMBER,
464     x_payroll_id                        IN     NUMBER,
465     x_payroll_date                      IN     DATE,
466     x_auth_id                           IN     NUMBER,
467     x_person_id                         IN     NUMBER,
468     x_fund_id                           IN     NUMBER,
469     x_paid_amount                       IN     NUMBER,
470     x_org_unit_cd                       IN     VARCHAR2,
471     x_status                            IN     VARCHAR2,
472     x_error_code                        IN     VARCHAR2
473   ) AS
474   /*
475   ||  Created By : ssawhney
476   ||  Created On : 31-DEC-2001
477   ||  Purpose : Handles the LOCK mechanism for the table.
478   ||  Known limitations, enhancements or remarks :
479   ||  Change History :
480   ||  Who             When            What
481   ||  (reverse chronological order - newest change first)
482   */
483     CURSOR c1 IS
484       SELECT
485         batch_id,
486         payroll_id,
487         payroll_date,
488         auth_id,
489         person_id,
490         fund_id,
491         paid_amount,
492         org_unit_cd,
493         status,
494         error_code
495       FROM  igf_se_payment_int
496       WHERE rowid = x_rowid
497       FOR UPDATE NOWAIT;
498 
499     tlinfo c1%ROWTYPE;
500 
501   BEGIN
502 
503     OPEN c1;
504     FETCH c1 INTO tlinfo;
505     IF (c1%notfound) THEN
506       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
507       igs_ge_msg_stack.add;
508       CLOSE c1;
509       app_exception.raise_exception;
510       RETURN;
511     END IF;
512     CLOSE c1;
513 
514     IF (
515         (tlinfo.batch_id = x_batch_id)
516         AND (tlinfo.payroll_id = x_payroll_id)
517         AND (tlinfo.payroll_date = x_payroll_date)
518         AND (tlinfo.auth_id = x_auth_id)
519         AND (tlinfo.person_id = x_person_id)
520         AND (tlinfo.fund_id = x_fund_id)
521         AND (tlinfo.paid_amount = x_paid_amount)
522         AND ((tlinfo.org_unit_cd = x_org_unit_cd) OR ((tlinfo.org_unit_cd IS NULL) AND (X_org_unit_cd IS NULL)))
523         AND (tlinfo.status = x_status)
524         AND ((tlinfo.error_code = x_error_code) OR ((tlinfo.error_code IS NULL) AND (X_error_code IS NULL)))
525        ) THEN
526       NULL;
530       app_exception.raise_exception;
527     ELSE
528       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
529       igs_ge_msg_stack.add;
531     END IF;
532 
533     RETURN;
534 
535   END lock_row;
536 
537 
538   PROCEDURE update_row (
539     x_rowid                             IN     VARCHAR2,
540     x_transaction_id                    IN     NUMBER,
541     x_batch_id                          IN     NUMBER,
542     x_payroll_id                        IN     NUMBER,
543     x_payroll_date                      IN     DATE,
544     x_auth_id                           IN     NUMBER,
545     x_person_id                         IN     NUMBER,
546     x_fund_id                           IN     NUMBER,
547     x_paid_amount                       IN     NUMBER,
548     x_org_unit_cd                       IN     VARCHAR2,
549     x_status                            IN     VARCHAR2,
550     x_error_code                        IN     VARCHAR2,
551     x_mode                              IN     VARCHAR2 DEFAULT 'R'
552   ) AS
553   /*
554   ||  Created By : ssawhney
555   ||  Created On : 31-DEC-2001
556   ||  Purpose : Handles the UPDATE DML logic for the table.
557   ||  Known limitations, enhancements or remarks :
558   ||  Change History :
559   ||  Who             When            What
560   ||  (reverse chronological order - newest change first)
561   */
562     x_last_update_date           DATE ;
563     x_last_updated_by            NUMBER;
564     x_last_update_login          NUMBER;
565 
566   BEGIN
567 
568     x_last_update_date := SYSDATE;
569     IF (X_MODE = 'I') THEN
570       x_last_updated_by := 1;
571       x_last_update_login := 0;
572     ELSIF (x_mode = 'R') THEN
573       x_last_updated_by := fnd_global.user_id;
574       IF x_last_updated_by IS NULL THEN
575         x_last_updated_by := -1;
576       END IF;
577       x_last_update_login := fnd_global.login_id;
578       IF (x_last_update_login IS NULL) THEN
579         x_last_update_login := -1;
580       END IF;
581     ELSE
582       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
583       igs_ge_msg_stack.add;
584       app_exception.raise_exception;
585     END IF;
586 
587     before_dml(
588       p_action                            => 'UPDATE',
589       x_rowid                             => x_rowid,
590       x_transaction_id                    => x_transaction_id,
591       x_batch_id                          => x_batch_id,
592       x_payroll_id                        => x_payroll_id,
593       x_payroll_date                      => x_payroll_date,
594       x_auth_id                           => x_auth_id,
595       x_person_id                         => x_person_id,
596       x_fund_id                           => x_fund_id,
597       x_paid_amount                       => x_paid_amount,
598       x_org_unit_cd                       => x_org_unit_cd,
599       x_status                            => x_status,
600       x_error_code                        => x_error_code,
601       x_creation_date                     => x_last_update_date,
602       x_created_by                        => x_last_updated_by,
603       x_last_update_date                  => x_last_update_date,
604       x_last_updated_by                   => x_last_updated_by,
605       x_last_update_login                 => x_last_update_login
606     );
607 
608     UPDATE igf_se_payment_int
609       SET
610         batch_id                          = new_references.batch_id,
611         payroll_id                        = new_references.payroll_id,
612         payroll_date                      = new_references.payroll_date,
613         auth_id                           = new_references.auth_id,
614         person_id                         = new_references.person_id,
615         fund_id                           = new_references.fund_id,
616         paid_amount                       = new_references.paid_amount,
617         org_unit_cd                       = new_references.org_unit_cd,
618         status                            = new_references.status,
619         error_code                        = new_references.error_code,
620         last_update_date                  = x_last_update_date,
621         last_updated_by                   = x_last_updated_by,
622         last_update_login                 = x_last_update_login
623       WHERE rowid = x_rowid;
624 
625     IF (SQL%NOTFOUND) THEN
626       RAISE NO_DATA_FOUND;
627     END IF;
628 
629   END update_row;
630 
631 
632   PROCEDURE add_row (
633     x_rowid                             IN OUT NOCOPY VARCHAR2,
634     x_transaction_id                    IN OUT NOCOPY NUMBER,
635     x_batch_id                          IN     NUMBER,
636     x_payroll_id                        IN     NUMBER,
637     x_payroll_date                      IN     DATE,
638     x_auth_id                           IN     NUMBER,
639     x_person_id                         IN     NUMBER,
640     x_fund_id                           IN     NUMBER,
641     x_paid_amount                       IN     NUMBER,
642     x_org_unit_cd                       IN     VARCHAR2,
643     x_status                            IN     VARCHAR2,
644     x_error_code                        IN     VARCHAR2,
645     x_mode                              IN     VARCHAR2 DEFAULT 'R'
646   ) AS
647   /*
648   ||  Created By : ssawhney
649   ||  Created On : 31-DEC-2001
650   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
654   ||  (reverse chronological order - newest change first)
651   ||  Known limitations, enhancements or remarks :
652   ||  Change History :
653   ||  Who             When            What
655   */
656     CURSOR c1 IS
657       SELECT   rowid
658       FROM     igf_se_payment_int
659       WHERE    transaction_id                    = x_transaction_id;
660 
661   BEGIN
662 
663     OPEN c1;
664     FETCH c1 INTO x_rowid;
665     IF (c1%NOTFOUND) THEN
666       CLOSE c1;
667 
668       insert_row (
669         x_rowid,
670         x_transaction_id,
671         x_batch_id,
672         x_payroll_id,
673         x_payroll_date,
674         x_auth_id,
675         x_person_id,
676         x_fund_id,
677         x_paid_amount,
678         x_org_unit_cd,
679         x_status,
680         x_error_code,
681         x_mode
682       );
683       RETURN;
684     END IF;
685     CLOSE c1;
686 
687     update_row (
688       x_rowid,
689       x_transaction_id,
690       x_batch_id,
691       x_payroll_id,
692       x_payroll_date,
693       x_auth_id,
694       x_person_id,
695       x_fund_id,
696       x_paid_amount,
697       x_org_unit_cd,
698       x_status,
699       x_error_code,
700       x_mode
701     );
702 
703   END add_row;
704 
705 
706   PROCEDURE delete_row (
707     x_rowid IN VARCHAR2
708   ) AS
709   /*
710   ||  Created By : ssawhney
711   ||  Created On : 31-DEC-2001
712   ||  Purpose : Handles the DELETE DML logic for the table.
713   ||  Known limitations, enhancements or remarks :
714   ||  Change History :
715   ||  Who             When            What
716   ||  (reverse chronological order - newest change first)
717   */
718   BEGIN
719 
720     before_dml (
721       p_action => 'DELETE',
722       x_rowid => x_rowid
723     );
724 
725     DELETE FROM igf_se_payment_int
726     WHERE rowid = x_rowid;
727 
728     IF (SQL%NOTFOUND) THEN
729       RAISE NO_DATA_FOUND;
730     END IF;
731 
732   END delete_row;
733 
734 
735 END igf_se_payment_int_pkg;