DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_PR_INST_STAT_PKG

Source


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