DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_EN_NSU_DLSTP_PKG

Source


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