DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_AP_FA_ANT_DATA_PKG

Source


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