DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_HE_SUBMSN_RETURN_PKG

Source


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