DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_EN_NSD_DLSTP_PKG

Source


1 PACKAGE BODY igs_en_nsd_dlstp_pkg AS
2 /* $Header: IGSEI46B.pls 120.1 2005/09/19 23:45:18 appldev ship $ */
3 
4   l_rowid VARCHAR2(25);
5   old_references igs_en_nsd_dlstp_all%ROWTYPE;
6   new_references igs_en_nsd_dlstp_all%ROWTYPE;
7 
8   PROCEDURE set_column_values (
9     p_action                            IN     VARCHAR2,
10     x_rowid                             IN     VARCHAR2    DEFAULT NULL,
11     x_non_std_disc_dl_stp_id            IN     NUMBER      DEFAULT NULL,
12     x_administrative_unit_status        IN     VARCHAR2    DEFAULT NULL,
13     x_definition_code                   IN     VARCHAR2    DEFAULT NULL,
14     x_org_unit_code                     IN     VARCHAR2    DEFAULT NULL,
15     x_formula_method                    IN     VARCHAR2    DEFAULT NULL,
16     x_round_method                      IN     VARCHAR2    DEFAULT NULL,
17     x_offset_dt_code                    IN     VARCHAR2    DEFAULT NULL,
18     x_offset_duration                   IN     NUMBER      DEFAULT NULL,
19     x_creation_date                     IN     DATE        DEFAULT NULL,
20     x_created_by                        IN     NUMBER      DEFAULT NULL,
21     x_last_update_date                  IN     DATE        DEFAULT NULL,
22     x_last_updated_by                   IN     NUMBER      DEFAULT NULL,
23     x_last_update_login                 IN     NUMBER      DEFAULT NULL,
24     x_incl_wkend_duration_flag          IN     VARCHAR2    DEFAULT NULL
25   ) AS
26   /*
27   ||  Created By : [email protected]
28   ||  Created On : 30-MAR-2001
29   ||  Purpose : Initialises the Old and New references for the columns of the table.
30   ||  Known limitations, enhancements or remarks :
31   ||  Change History :
32   ||  Who             When            What
33   ||  (reverse chronological order - newest change first)
34   */
35 
36     CURSOR cur_old_ref_values IS
37       SELECT   *
38       FROM     IGS_EN_NSD_DLSTP_ALL
39       WHERE    rowid = x_rowid;
40 
41   BEGIN
42 
43     l_rowid := x_rowid;
44 
45     -- Code for setting the Old and New Reference Values.
46     -- Populate Old Values.
47     OPEN cur_old_ref_values;
48     FETCH cur_old_ref_values INTO old_references;
49     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
50       CLOSE cur_old_ref_values;
51       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
52       igs_ge_msg_stack.add;
53       app_exception.raise_exception;
54       RETURN;
55     END IF;
56     CLOSE cur_old_ref_values;
57 
58     -- Populate New Values.
59     new_references.non_std_disc_dl_stp_id            := x_non_std_disc_dl_stp_id;
60     new_references.administrative_unit_status        := x_administrative_unit_status;
61     new_references.definition_code                   := x_definition_code;
62     new_references.org_unit_code                     := x_org_unit_code;
63     new_references.formula_method                    := x_formula_method;
64     new_references.round_method                      := x_round_method;
65     new_references.offset_dt_code                    := x_offset_dt_code;
66     new_references.offset_duration                   := x_offset_duration;
67     new_references.incl_wkend_duration_flag          := x_incl_wkend_duration_flag;
68 
69     IF (p_action = 'UPDATE') THEN
70       new_references.creation_date                   := old_references.creation_date;
71       new_references.created_by                      := old_references.created_by;
72     ELSE
73       new_references.creation_date                   := x_creation_date;
74       new_references.created_by                      := x_created_by;
75     END IF;
76 
77     new_references.last_update_date                  := x_last_update_date;
78     new_references.last_updated_by                   := x_last_updated_by;
79     new_references.last_update_login                 := x_last_update_login;
80 
81   END set_column_values;
82 
83 
84   PROCEDURE check_uniqueness AS
85   /*
86   ||  Created By : [email protected]
87   ||  Created On : 30-MAR-2001
88   ||  Purpose : Handles the Unique Constraint logic defined for the columns.
89   ||  Known limitations, enhancements or remarks :
90   ||  Change History :
91   ||  Who             When            What
92   ||  (reverse chronological order - newest change first)
93   */
94   BEGIN
95 
96     IF ( get_uk_for_validation (
97            new_references.administrative_unit_status,
98            new_references.definition_code,
99            new_references.org_unit_code
100          )
101        ) THEN
102       fnd_message.set_name ('IGS', 'IGS_GE_RECORD_ALREADY_EXISTS');
103       igs_ge_msg_stack.add;
104       app_exception.raise_exception;
105     END IF;
106 
107   END check_uniqueness;
108 
109   PROCEDURE check_parent_existance AS
110   /*************************************************************
111   Created By :
112   Date Created By :
113   Purpose :
114   Know limitations, enhancements or remarks
115   Change History
116   Who             When            What
117   (reverse chronological order - newest change first)
118 
119   Nishikant       09DEC2002       Bug#2688542. For the field org_unit_cd
120                                   the foreign key check was done in this
121                                   procedure itself. Now its modified for
122                                   consistency to make a call to the function
123                                   igs_or_unit_pkg.get_pk_for_str_validation.
124   ***************************************************************/
125 
126   BEGIN
127 
128     IF (((old_references.org_unit_code = new_references.org_unit_code)) OR
129         ((new_references.org_unit_code IS NULL))) THEN
130       NULL;
131     ELSIF NOT igs_or_unit_pkg.get_pk_for_str_validation (
132                   new_references.org_unit_code
133                 ) THEN
134         fnd_message.set_name ('FND','FORM_RECORD_DELETED');
135         igs_ge_msg_stack.add;
136         app_exception.raise_exception;
137     END IF;
138 
139     IF (((old_references.administrative_unit_status = new_references.administrative_unit_status)) OR
140         ((new_references.administrative_unit_status IS NULL))) THEN
141       NULL;
142     ELSIF NOT igs_ad_adm_unit_stat_pkg.get_pk_for_validation (
143                 new_references.administrative_unit_status,
144                 'N'
145               ) THEN
146       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
147       igs_ge_msg_stack.add;
148       app_exception.raise_exception;
149     END IF;
150 
151   END check_parent_existance;
152 
153   PROCEDURE check_child_existance IS
154   /*
155   ||  Created By : [email protected]
156   ||  Created On : 30-MAR-2001
157   ||  Purpose : Checks for the existance of Child records.
158   ||  Known limitations, enhancements or remarks :
159   ||  Change History :
160   ||  Who             When            What
161   ||  (reverse chronological order - newest change first)
162   */
163   BEGIN
164 
165     igs_en_disc_dl_cons_pkg.get_fk_igs_en_nsd_dlstp_all (
166       old_references.non_std_disc_dl_stp_id
167     );
168 
169   END check_child_existance;
170 
171 
172   FUNCTION get_pk_for_validation (
173     x_non_std_disc_dl_stp_id            IN     NUMBER
174   ) RETURN BOOLEAN AS
175   /*
176   ||  Created By : [email protected]
177   ||  Created On : 30-MAR-2001
178   ||  Purpose : Validates the Primary Key of the table.
179   ||  Known limitations, enhancements or remarks :
180   ||  Change History :
181   ||  Who             When            What
182   ||  (reverse chronological order - newest change first)
183   */
184     CURSOR cur_rowid IS
185       SELECT   rowid
186       FROM     igs_en_nsd_dlstp_all
187       WHERE    non_std_disc_dl_stp_id = x_non_std_disc_dl_stp_id
188       FOR UPDATE NOWAIT;
189 
190     lv_rowid cur_rowid%RowType;
191 
192   BEGIN
193 
194     OPEN cur_rowid;
195     FETCH cur_rowid INTO lv_rowid;
196     IF (cur_rowid%FOUND) THEN
197       CLOSE cur_rowid;
198       RETURN(TRUE);
199     ELSE
200       CLOSE cur_rowid;
201       RETURN(FALSE);
202     END IF;
203 
204   END get_pk_for_validation;
205 
206 
207   FUNCTION get_uk_for_validation (
208     x_administrative_unit_status        IN     VARCHAR2,
209     x_definition_code                   IN     VARCHAR2,
210     x_org_unit_code                     IN     VARCHAR2
211   ) RETURN BOOLEAN AS
212   /*
213   ||  Created By : [email protected]
214   ||  Created On : 30-MAR-2001
215   ||  Purpose : Validates the Unique Keys of the table.
216   ||  Known limitations, enhancements or remarks :
217   ||  Change History :
218   ||  Who             When            What
219   ||  (reverse chronological order - newest change first)
220   */
221   --
222   --svenkata - The cursor definition has been changed to SELECT from the table igs_en_nsd_dlstp_all and not view igs_en_nsd_dlstp as it was
223   -- done earlier . The column org_unit_code has been checked for NULL values also to avoid Uniue index validtion failure on inserting a
224   -- duplicate record .Bug # 2272521.
225   --
226     CURSOR cur_rowid IS
227       SELECT   rowid
228       FROM     igs_en_nsd_dlstp_all
229       WHERE    administrative_unit_status = x_administrative_unit_status
230       AND      definition_code = x_definition_code
231       AND      ( org_unit_code  IS NULL OR org_unit_code = x_org_unit_code )
232       AND      ((l_rowid IS NULL) OR (rowid <> l_rowid));
233 
234     lv_rowid cur_rowid%RowType;
235 
236   BEGIN
237 
238     OPEN cur_rowid;
239     FETCH cur_rowid INTO lv_rowid;
240     IF (cur_rowid%FOUND) THEN
241       CLOSE cur_rowid;
242         RETURN (true);
243         ELSE
244        CLOSE cur_rowid;
245       RETURN(FALSE);
246     END IF;
247 
248   END get_uk_for_validation ;
249 
250   PROCEDURE before_dml (
251     p_action                            IN     VARCHAR2,
252     x_rowid                             IN     VARCHAR2    DEFAULT NULL,
253     x_non_std_disc_dl_stp_id            IN     NUMBER      DEFAULT NULL,
254     x_administrative_unit_status        IN     VARCHAR2    DEFAULT NULL,
255     x_definition_code                   IN     VARCHAR2    DEFAULT NULL,
256     x_org_unit_code                     IN     VARCHAR2    DEFAULT NULL,
257     x_formula_method                    IN     VARCHAR2    DEFAULT NULL,
258     x_round_method                      IN     VARCHAR2    DEFAULT NULL,
259     x_offset_dt_code                    IN     VARCHAR2    DEFAULT NULL,
260     x_offset_duration                   IN     NUMBER      DEFAULT NULL,
261     x_creation_date                     IN     DATE        DEFAULT NULL,
262     x_created_by                        IN     NUMBER      DEFAULT NULL,
263     x_last_update_date                  IN     DATE        DEFAULT NULL,
264     x_last_updated_by                   IN     NUMBER      DEFAULT NULL,
265     x_last_update_login                 IN     NUMBER      DEFAULT NULL,
266     x_incl_wkend_duration_flag          IN     VARCHAR2    DEFAULT NULL
267   ) AS
268   /*
269   ||  Created By : [email protected]
270   ||  Created On : 30-MAR-2001
271   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
272   ||            Trigger Handlers for the table, before any DML operation.
273   ||  Known limitations, enhancements or remarks :
274   ||  Change History :
275   ||  Who             When            What
276   ||  (reverse chronological order - newest change first)
277   */
278   BEGIN
279 
280     set_column_values (
281       p_action,
282       x_rowid,
283       x_non_std_disc_dl_stp_id,
284       x_administrative_unit_status,
285       x_definition_code,
286       x_org_unit_code,
287       x_formula_method,
288       x_round_method,
289       x_offset_dt_code,
290       x_offset_duration,
291       x_creation_date,
292       x_created_by,
293       x_last_update_date,
294       x_last_updated_by,
295       x_last_update_login,
296       x_incl_wkend_duration_flag
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.non_std_disc_dl_stp_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       check_uniqueness;
310       check_parent_existance;
311     ELSIF (p_action = 'UPDATE') THEN
312       -- Call all the procedures related to Before Update.
313       check_uniqueness;
314       check_parent_existance;
315     ELSIF (p_action = 'DELETE') THEN
316       -- Call all the procedures related to Before Delete.
317       check_child_existance;
318     ELSIF (p_action = 'VALIDATE_INSERT') THEN
319       -- Call all the procedures related to Before Insert.
320       IF ( get_pk_for_validation (
321              new_references.non_std_disc_dl_stp_id
322            )
323          ) THEN
324         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
325         igs_ge_msg_stack.add;
326         app_exception.raise_exception;
327       END IF;
328       check_uniqueness;
329     ELSIF (p_action = 'VALIDATE_UPDATE') THEN
330       check_uniqueness;
331     ELSIF (p_action = 'VALIDATE_DELETE') THEN
332       check_child_existance;
333     END IF;
334 
335   END before_dml;
336 
337 
338   PROCEDURE insert_row (
339     x_rowid                             IN OUT NOCOPY VARCHAR2,
340     x_non_std_disc_dl_stp_id            IN OUT NOCOPY NUMBER,
341     x_administrative_unit_status        IN     VARCHAR2,
342     x_definition_code                   IN     VARCHAR2,
343     x_org_unit_code                     IN     VARCHAR2,
344     x_formula_method                    IN     VARCHAR2,
345     x_round_method                      IN     VARCHAR2,
346     x_offset_dt_code                    IN     VARCHAR2,
347     x_offset_duration                   IN     NUMBER,
348     x_mode                              IN     VARCHAR2 DEFAULT 'R',
349     x_incl_wkend_duration_flag          IN     VARCHAR2
350   ) AS
351   /*
352   ||  Created By : [email protected]
353   ||  Created On : 30-MAR-2001
354   ||  Purpose : Handles the INSERT DML logic for the table.
355   ||  Known limitations, enhancements or remarks :
356   ||  Change History :
357   ||  Who             When            What
358   ||  (reverse chronological order - newest change first)
359   */
360     CURSOR c IS
361       SELECT   rowid
362       FROM     igs_en_nsd_dlstp_all
363       WHERE    non_std_disc_dl_stp_id            = x_non_std_disc_dl_stp_id;
364 
365     x_last_update_date           DATE;
366     x_last_updated_by            NUMBER;
367     x_last_update_login          NUMBER;
368 
369   BEGIN
370 
371     x_last_update_date := SYSDATE;
372     IF (x_mode = 'I') THEN
373       x_last_updated_by := 1;
374       x_last_update_login := 0;
375     ELSIF (x_mode = 'R') THEN
376       x_last_updated_by := fnd_global.user_id;
377       IF (x_last_updated_by IS NULL) THEN
378         x_last_updated_by := -1;
379       END IF;
380       x_last_update_login := fnd_global.login_id;
381       IF (x_last_update_login IS NULL) THEN
382         x_last_update_login := -1;
383       END IF;
384     ELSE
385       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
386       igs_ge_msg_stack.add;
387       app_exception.raise_exception;
388     END IF;
389 
390     SELECT    igs_en_nsd_dlstp_all_s.NEXTVAL
391     INTO      x_non_std_disc_dl_stp_id
392     FROM      dual;
393 
394     new_references.org_id := igs_ge_gen_003.get_org_id;
395 
396     before_dml(
397       p_action                            => 'INSERT',
398       x_rowid                             => x_rowid,
399       x_non_std_disc_dl_stp_id            => x_non_std_disc_dl_stp_id,
400       x_administrative_unit_status        => x_administrative_unit_status,
401       x_definition_code                   => x_definition_code,
402       x_org_unit_code                     => x_org_unit_code,
403       x_formula_method                    => x_formula_method,
404       x_round_method                      => x_round_method,
405       x_offset_dt_code                    => x_offset_dt_code,
406       x_offset_duration                   => x_offset_duration,
407       x_creation_date                     => x_last_update_date,
408       x_created_by                        => x_last_updated_by,
409       x_last_update_date                  => x_last_update_date,
410       x_last_updated_by                   => x_last_updated_by,
411       x_last_update_login                 => x_last_update_login,
412       x_incl_wkend_duration_flag          => x_incl_wkend_duration_flag
413     );
414 
415 
416     INSERT INTO igs_en_nsd_dlstp_all (
417       non_std_disc_dl_stp_id,
418       administrative_unit_status,
419       definition_code,
420       org_unit_code,
421       formula_method,
422       round_method,
423       offset_dt_code,
424       offset_duration,
425       org_id,
426       incl_wkend_duration_flag,
427       creation_date,
428       created_by,
429       last_update_date,
430       last_updated_by,
431       last_update_login
432     ) VALUES (
433       new_references.non_std_disc_dl_stp_id,
434       new_references.administrative_unit_status,
435       new_references.definition_code,
436       new_references.org_unit_code,
437       new_references.formula_method,
438       new_references.round_method,
439       new_references.offset_dt_code,
440       new_references.offset_duration,
441       new_references.org_id,
442       new_references.incl_wkend_duration_flag,
443       x_last_update_date,
444       x_last_updated_by,
445       x_last_update_date,
446       x_last_updated_by,
447       x_last_update_login
448     );
449 
450     OPEN c;
451     FETCH c INTO x_rowid;
452     IF (c%NOTFOUND) THEN
453       CLOSE c;
454       RAISE NO_DATA_FOUND;
455     END IF;
456     CLOSE c;
457 
458   END insert_row;
459 
460 
461   PROCEDURE lock_row (
462     x_rowid                             IN     VARCHAR2,
463     x_non_std_disc_dl_stp_id            IN     NUMBER,
464     x_administrative_unit_status        IN     VARCHAR2,
465     x_definition_code                   IN     VARCHAR2,
466     x_org_unit_code                     IN     VARCHAR2,
467     x_formula_method                    IN     VARCHAR2,
468     x_round_method                      IN     VARCHAR2,
469     x_offset_dt_code                    IN     VARCHAR2,
470     x_offset_duration                   IN     NUMBER,
471     x_incl_wkend_duration_flag          IN     VARCHAR2
472   ) AS
473   /*
474   ||  Created By : [email protected]
475   ||  Created On : 30-MAR-2001
476   ||  Purpose : Handles the LOCK mechanism for the table.
477   ||  Known limitations, enhancements or remarks :
478   ||  Change History :
479   ||  Who             When            What
480   ||  (reverse chronological order - newest change first)
481   */
482     CURSOR c1 IS
483       SELECT
484         administrative_unit_status,
485         definition_code,
486         org_unit_code,
487         formula_method,
488         round_method,
489         offset_dt_code,
490         offset_duration,
491         incl_wkend_duration_flag
492       FROM  igs_en_nsd_dlstp_all
493       WHERE rowid = x_rowid
494       FOR UPDATE NOWAIT;
495 
496     tlinfo c1%ROWTYPE;
497 
498   BEGIN
499 
500     OPEN c1;
501     FETCH c1 INTO tlinfo;
502     IF (c1%notfound) THEN
503       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
504       igs_ge_msg_stack.add;
505       CLOSE c1;
506       app_exception.raise_exception;
507       RETURN;
508     END IF;
509     CLOSE c1;
510 
511     IF (
512         (tlinfo.administrative_unit_status = x_administrative_unit_status)
513         AND (tlinfo.definition_code = x_definition_code)
514         AND ((tlinfo.org_unit_code = x_org_unit_code)  OR ((tlinfo.org_unit_code IS NULL) AND (X_org_unit_code IS NULL)))
515         AND (tlinfo.formula_method = x_formula_method)
516         AND (tlinfo.round_method = x_round_method)
517         AND (tlinfo.offset_dt_code = x_offset_dt_code)
518         AND (tlinfo.offset_duration = x_offset_duration)
519         AND (tlinfo.incl_wkend_duration_flag = x_incl_wkend_duration_flag)
520        ) THEN
521       NULL;
522     ELSE
523       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
524       igs_ge_msg_stack.add;
525       app_exception.raise_exception;
526     END IF;
527 
528     RETURN;
529 
530   END lock_row;
531 
532 
533   PROCEDURE update_row (
534     x_rowid                             IN     VARCHAR2,
535     x_non_std_disc_dl_stp_id            IN     NUMBER,
536     x_administrative_unit_status        IN     VARCHAR2,
537     x_definition_code                   IN     VARCHAR2,
538     x_org_unit_code                     IN     VARCHAR2,
539     x_formula_method                    IN     VARCHAR2,
540     x_round_method                      IN     VARCHAR2,
541     x_offset_dt_code                    IN     VARCHAR2,
542     x_offset_duration                   IN     NUMBER,
543     x_mode                              IN     VARCHAR2 DEFAULT 'R',
544     x_incl_wkend_duration_flag          IN     VARCHAR2
545   ) AS
546   /*
547   ||  Created By : [email protected]
548   ||  Created On : 30-MAR-2001
549   ||  Purpose : Handles the UPDATE DML logic for the table.
550   ||  Known limitations, enhancements or remarks :
551   ||  Change History :
552   ||  Who             When            What
553   ||  (reverse chronological order - newest change first)
554   */
555     x_last_update_date           DATE ;
556     x_last_updated_by            NUMBER;
557     x_last_update_login          NUMBER;
558 
559   BEGIN
560 
561     x_last_update_date := SYSDATE;
562     IF (X_MODE = 'I') THEN
563       x_last_updated_by := 1;
564       x_last_update_login := 0;
565     ELSIF (x_mode = 'R') THEN
566       x_last_updated_by := fnd_global.user_id;
567       IF x_last_updated_by IS NULL THEN
568         x_last_updated_by := -1;
569       END IF;
570       x_last_update_login := fnd_global.login_id;
571       IF (x_last_update_login IS NULL) THEN
572         x_last_update_login := -1;
573       END IF;
574     ELSE
575       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
576       igs_ge_msg_stack.add;
577       app_exception.raise_exception;
578     END IF;
579 
580     before_dml(
581       p_action                            => 'UPDATE',
582       x_rowid                             => x_rowid,
583       x_non_std_disc_dl_stp_id            => x_non_std_disc_dl_stp_id,
584       x_administrative_unit_status        => x_administrative_unit_status,
585       x_definition_code                   => x_definition_code,
586       x_org_unit_code                     => x_org_unit_code,
587       x_formula_method                    => x_formula_method,
588       x_round_method                      => x_round_method,
589       x_offset_dt_code                    => x_offset_dt_code,
590       x_offset_duration                   => x_offset_duration,
591       x_creation_date                     => x_last_update_date,
592       x_created_by                        => x_last_updated_by,
593       x_last_update_date                  => x_last_update_date,
594       x_last_updated_by                   => x_last_updated_by,
595       x_last_update_login                 => x_last_update_login,
596       x_incl_wkend_duration_flag          => x_incl_wkend_duration_flag
597     );
598 
599     UPDATE igs_en_nsd_dlstp_all
600       SET
601         administrative_unit_status        = new_references.administrative_unit_status,
602         definition_code                   = new_references.definition_code,
603         org_unit_code                     = new_references.org_unit_code,
604         formula_method                    = new_references.formula_method,
605         round_method                      = new_references.round_method,
606         offset_dt_code                    = new_references.offset_dt_code,
607         offset_duration                   = new_references.offset_duration,
608 	incl_wkend_duration_flag          = new_references.incl_wkend_duration_flag,
609         last_update_date                  = x_last_update_date,
610         last_updated_by                   = x_last_updated_by,
611         last_update_login                 = x_last_update_login
612       WHERE rowid = x_rowid;
613 
614     IF (SQL%NOTFOUND) THEN
615       RAISE NO_DATA_FOUND;
616     END IF;
617 
618   END update_row;
619 
620 
621   PROCEDURE add_row (
622     x_rowid                             IN OUT NOCOPY VARCHAR2,
623     x_non_std_disc_dl_stp_id            IN OUT NOCOPY NUMBER,
624     x_administrative_unit_status        IN     VARCHAR2,
625     x_definition_code                   IN     VARCHAR2,
626     x_org_unit_code                     IN     VARCHAR2,
627     x_formula_method                    IN     VARCHAR2,
628     x_round_method                      IN     VARCHAR2,
629     x_offset_dt_code                    IN     VARCHAR2,
630     x_offset_duration                   IN     NUMBER,
631     x_mode                              IN     VARCHAR2 DEFAULT 'R',
632     x_incl_wkend_duration_flag          IN     VARCHAR2
633   ) AS
634   /*
635   ||  Created By : [email protected]
636   ||  Created On : 30-MAR-2001
637   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
638   ||  Known limitations, enhancements or remarks :
639   ||  Change History :
640   ||  Who             When            What
641   ||  (reverse chronological order - newest change first)
642   */
643     CURSOR c1 IS
644       SELECT   rowid
645       FROM     igs_en_nsd_dlstp_all
646       WHERE    non_std_disc_dl_stp_id            = x_non_std_disc_dl_stp_id;
647 
648   BEGIN
649 
650     OPEN c1;
651     FETCH c1 INTO x_rowid;
652     IF (c1%NOTFOUND) THEN
653       CLOSE c1;
654 
655       insert_row (
656         x_rowid,
657         x_non_std_disc_dl_stp_id,
658         x_administrative_unit_status,
659         x_definition_code,
660         x_org_unit_code,
661         x_formula_method,
662         x_round_method,
663         x_offset_dt_code,
664         x_offset_duration,
665         x_mode,
666         x_incl_wkend_duration_flag
667       );
668       RETURN;
669     END IF;
670     CLOSE c1;
671 
672     update_row (
673       x_rowid,
674       x_non_std_disc_dl_stp_id,
675       x_administrative_unit_status,
676       x_definition_code,
677       x_org_unit_code,
678       x_formula_method,
679       x_round_method,
680       x_offset_dt_code,
681       x_offset_duration,
682       x_mode,
683       x_incl_wkend_duration_flag
684     );
685 
686   END add_row;
687 
688 
689   PROCEDURE delete_row (
690     x_rowid IN VARCHAR2
691   ) AS
692   /*
693   ||  Created By : [email protected]
694   ||  Created On : 30-MAR-2001
695   ||  Purpose : Handles the DELETE DML logic for the table.
696   ||  Known limitations, enhancements or remarks :
697   ||  Change History :
698   ||  Who             When            What
699   ||  (reverse chronological order - newest change first)
700   */
701   BEGIN
702 
703     before_dml (
704       p_action => 'DELETE',
705       x_rowid => x_rowid
706     );
707 
708     DELETE FROM igs_en_nsd_dlstp_all
709     WHERE rowid = x_rowid;
710 
711     IF (SQL%NOTFOUND) THEN
712       RAISE NO_DATA_FOUND;
713     END IF;
714 
715   END delete_row;
716 
717 
718 END igs_en_nsd_dlstp_pkg;