DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_PR_COHORT_PKG

Source


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