DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_EN_SPLACEMENTS_PKG

Source


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