DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_PE_SN_SERVICE_PKG

Source


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