DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGI_EXP_TU_TYPE_HEADERS_PKG

Source


1 PACKAGE BODY igi_exp_tu_type_headers_pkg AS
2 /* $Header: igiexpub.pls 120.5.12000000.1 2007/09/13 04:24:51 mbremkum ship $ */
3 
4 --following variables added for bug 3199481: fnd logging changes: sdixit
5    l_debug_level number	:=	FND_LOG.G_CURRENT_RUNTIME_LEVEL;
6    l_state_level number	:=	FND_LOG.LEVEL_STATEMENT;
7    l_proc_level number	:=	FND_LOG.LEVEL_PROCEDURE;
8    l_event_level number	:=	FND_LOG.LEVEL_EVENT;
9    l_excep_level number	:=	FND_LOG.LEVEL_EXCEPTION;
10    l_error_level number	:=	FND_LOG.LEVEL_ERROR;
11    l_unexp_level number	:=	FND_LOG.LEVEL_UNEXPECTED;
12 
13   l_rowid VARCHAR2(25);
14   old_references igi_exp_tu_type_headers_all%ROWTYPE;
15   new_references igi_exp_tu_type_headers_all%ROWTYPE;
16 
17   PROCEDURE set_column_values (
18     p_action                            IN     VARCHAR2,
19     x_rowid                             IN     VARCHAR2    ,
20     x_tu_type_header_id                 IN     NUMBER      ,
21     x_tu_type_name                      IN     VARCHAR2    ,
22     x_tu_type_desc                      IN     VARCHAR2    ,
23     x_apprv_profile_id                  IN     NUMBER      ,
24     x_allow_override                    IN     VARCHAR2    ,
25     x_start_date                        IN     DATE        ,
26     x_end_date                          IN     DATE        ,
27     x_org_id                            IN     NUMBER      ,
28     x_creation_date                     IN     DATE        ,
29     x_created_by                        IN     NUMBER      ,
30     x_last_update_date                  IN     DATE        ,
31     x_last_updated_by                   IN     NUMBER      ,
32     x_last_update_login                 IN     NUMBER      ) AS
33   /*
34   ||  Created By : [email protected]
35   ||  Created On : 18-OCT-2001
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     IGI_EXP_TU_TYPE_HEADERS_ALL
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    --bug 3199481 fnd logging changes: sdixit: start block
60        IF (l_error_level >=  l_debug_level ) THEN
61           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.set_column_values',FALSE);
62        END IF;
63    --bug 3199481 fnd logging changes: sdixit: end block
64 
65       app_exception.raise_exception;
66       RETURN;
67     END IF;
68     CLOSE cur_old_ref_values;
69 
70     -- Populate New Values.
71     new_references.tu_type_header_id                 := x_tu_type_header_id;
72     new_references.tu_type_name                      := x_tu_type_name;
73     new_references.tu_type_desc                      := x_tu_type_desc;
74     new_references.apprv_profile_id                  := x_apprv_profile_id;
75     new_references.allow_override                    := x_allow_override;
76     new_references.start_date                        := x_start_date;
77     new_references.end_date                          := x_end_date;
78     new_references.org_id                            := x_org_id;
79 
80     IF (p_action = 'UPDATE') THEN
81       new_references.creation_date                   := old_references.creation_date;
82       new_references.created_by                      := old_references.created_by;
83     ELSE
84       new_references.creation_date                   := x_creation_date;
85       new_references.created_by                      := x_created_by;
86     END IF;
87 
88     new_references.last_update_date                  := x_last_update_date;
89     new_references.last_updated_by                   := x_last_updated_by;
90     new_references.last_update_login                 := x_last_update_login;
91 
92   END set_column_values;
93 
94 
95   PROCEDURE check_parent_existance AS
96   /*
97   ||  Created By : [email protected]
98   ||  Created On : 18-OCT-2001
99   ||  Purpose : Checks for the existance of Parent records.
100   ||  Known limitations, enhancements or remarks :
101   ||  Change History :
102   ||  Who             When            What
103   ||  (reverse chronological order - newest change first)
104   */
105   BEGIN
106 
107     IF (((old_references.apprv_profile_id = new_references.apprv_profile_id)) OR
108         ((new_references.apprv_profile_id IS NULL))) THEN
109       NULL;
110     ELSIF NOT igi_exp_apprv_profiles_pkg.get_pk_for_validation (
111                 new_references.apprv_profile_id
112               ) THEN
113       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
114    --bug 3199481 fnd logging changes: sdixit: start block
115        IF (l_error_level >=  l_debug_level ) THEN
116           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.check_parent_existance',FALSE);
117        END IF;
118    --bug 3199481 fnd logging changes: sdixit: end block
119 
120       app_exception.raise_exception;
121     END IF;
122 
123   END check_parent_existance;
124 
125 
126   PROCEDURE check_child_existance IS
127   /*
128   ||  Created By : [email protected]
129   ||  Created On : 18-OCT-2001
130   ||  Purpose : Checks for the existance of Child records.
131   ||  Known limitations, enhancements or remarks :
132   ||  Change History :
133   ||  Who             When            What
134   ||  (reverse chronological order - newest change first)
135   */
136   BEGIN
137 
138     igi_exp_tu_type_details_pkg.get_fk_igi_exp_tu_type_headers (
139       old_references.tu_type_header_id
140     );
141 
142   END check_child_existance;
143 
144 
145   FUNCTION get_pk_for_validation (
146     x_tu_type_header_id                 IN     NUMBER
147   ) RETURN BOOLEAN AS
148   /*
149   ||  Created By : [email protected]
150   ||  Created On : 18-OCT-2001
151   ||  Purpose : Validates the Primary Key of the table.
152   ||  Known limitations, enhancements or remarks :
153   ||  Change History :
154   ||  Who             When            What
155   ||  (reverse chronological order - newest change first)
156   */
157     CURSOR cur_rowid IS
158       SELECT   rowid
159       FROM     igi_exp_tu_type_headers_all
160       WHERE    tu_type_header_id = x_tu_type_header_id
161       FOR UPDATE NOWAIT;
162 
163     lv_rowid cur_rowid%RowType;
164 
165   BEGIN
166 
167     OPEN cur_rowid;
168     FETCH cur_rowid INTO lv_rowid;
169     IF (cur_rowid%FOUND) THEN
170       CLOSE cur_rowid;
171       RETURN(TRUE);
172     ELSE
173       CLOSE cur_rowid;
174       RETURN(FALSE);
175     END IF;
176 
177   END get_pk_for_validation;
178 
179 
180   PROCEDURE get_fk_igi_exp_apprv_profiles (
181     x_apprv_profile_id                  IN     NUMBER
182   ) AS
183   /*
184   ||  Created By : [email protected]
185   ||  Created On : 18-OCT-2001
186   ||  Purpose : Validates the Foreign Keys for the table.
187   ||  Known limitations, enhancements or remarks :
188   ||  Change History :
189   ||  Who             When            What
190   ||  (reverse chronological order - newest change first)
191   */
192     CURSOR cur_rowid IS
193       SELECT   rowid
194       FROM     igi_exp_tu_type_headers_all
195       WHERE   ((apprv_profile_id = x_apprv_profile_id));
196 
197     lv_rowid cur_rowid%RowType;
198 
199   BEGIN
200 
201     OPEN cur_rowid;
202     FETCH cur_rowid INTO lv_rowid;
203     IF (cur_rowid%FOUND) THEN
204       CLOSE cur_rowid;
205       fnd_message.set_name ('FND','FND-CANNOT DELETE MASTER');
206    --bug 3199481 fnd logging changes: sdixit: start block
207        IF (l_error_level >=  l_debug_level ) THEN
208           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.get_fk_igi_exp_apprv_profiles',FALSE);
209        END IF;
210    --bug 3199481 fnd logging changes: sdixit: end block
211 
212       app_exception.raise_exception;
213       RETURN;
214     END IF;
215     CLOSE cur_rowid;
216 
217   END get_fk_igi_exp_apprv_profiles;
218 
219 
220   PROCEDURE before_dml (
221     p_action                            IN     VARCHAR2,
222     x_rowid                             IN     VARCHAR2    ,
223     x_tu_type_header_id                 IN     NUMBER      ,
224     x_tu_type_name                      IN     VARCHAR2    ,
225     x_tu_type_desc                      IN     VARCHAR2    ,
226     x_apprv_profile_id                  IN     NUMBER      ,
227     x_allow_override                    IN     VARCHAR2    ,
228     x_start_date                        IN     DATE        ,
229     x_end_date                          IN     DATE        ,
230     x_org_id                            IN     NUMBER      ,
231     x_creation_date                     IN     DATE        ,
232     x_created_by                        IN     NUMBER      ,
233     x_last_update_date                  IN     DATE        ,
234     x_last_updated_by                   IN     NUMBER      ,
235     x_last_update_login                 IN     NUMBER      ) AS
236   /*
237   ||  Created By : [email protected]
238   ||  Created On : 18-OCT-2001
239   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
240   ||            Trigger Handlers for the table, before any DML operation.
241   ||  Known limitations, enhancements or remarks :
242   ||  Change History :
243   ||  Who             When            What
244   ||  (reverse chronological order - newest change first)
245   */
246   BEGIN
247 
248     set_column_values (
249       p_action,
250       x_rowid,
251       x_tu_type_header_id,
252       x_tu_type_name,
253       x_tu_type_desc,
254       x_apprv_profile_id,
255       x_allow_override,
256       x_start_date,
257       x_end_date,
258       x_org_id,
259       x_creation_date,
260       x_created_by,
261       x_last_update_date,
262       x_last_updated_by,
263       x_last_update_login
264     );
265 
266     IF (p_action = 'INSERT') THEN
267       -- Call all the procedures related to Before Insert.
268       IF ( get_pk_for_validation(
269              new_references.tu_type_header_id
270            )
271          ) THEN
272         fnd_message.set_name('IGI','IGI_EXP_DUP_ROW');
273    --bug 3199481 fnd logging changes: sdixit: start block
274        IF (l_error_level >=  l_debug_level ) THEN
275           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.before_dml.msg1',FALSE);
276        END IF;
277    --bug 3199481 fnd logging changes: sdixit: end block
278 
279         app_exception.raise_exception;
280       END IF;
281       check_parent_existance;
282     ELSIF (p_action = 'UPDATE') THEN
283       -- Call all the procedures related to Before Update.
284       check_parent_existance;
285     ELSIF (p_action = 'DELETE') THEN
286       -- Call all the procedures related to Before Delete.
287       check_child_existance;
288     ELSIF (p_action = 'VALIDATE_INSERT') THEN
289       -- Call all the procedures related to Before Insert.
290       IF ( get_pk_for_validation (
291              new_references.tu_type_header_id
292            )
293          ) THEN
294         fnd_message.set_name('IGI','IGI_EXP_DUP_ROW');
295    --bug 3199481 fnd logging changes: sdixit: start block
296        IF (l_error_level >=  l_debug_level ) THEN
297           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.before_dml.msg1',FALSE);
298        END IF;
299    --bug 3199481 fnd logging changes: sdixit: end block
300 
301         app_exception.raise_exception;
302       END IF;
303     ELSIF (p_action = 'VALIDATE_DELETE') THEN
304       check_child_existance;
305     END IF;
306 
307   END before_dml;
308 
309 
310   PROCEDURE insert_row (
311     x_rowid                             IN OUT NOCOPY VARCHAR2,
312     x_tu_type_header_id                 IN OUT NOCOPY NUMBER,
313     x_tu_type_name                      IN     VARCHAR2,
314     x_tu_type_desc                      IN     VARCHAR2,
315     x_apprv_profile_id                  IN     NUMBER,
316     x_allow_override                    IN     VARCHAR2,
317     x_start_date                        IN     DATE,
318     x_end_date                          IN     DATE,
319     x_org_id                            IN     NUMBER,
320     x_mode                              IN     VARCHAR2 ) AS
321   /*
322   ||  Created By : [email protected]
323   ||  Created On : 18-OCT-2001
324   ||  Purpose : Handles the INSERT DML logic for the table.
325   ||  Known limitations, enhancements or remarks :
326   ||  Change History :
327   ||  Who             When            What
328   ||  (reverse chronological order - newest change first)
329   */
330     CURSOR c IS
331       SELECT   rowid
332       FROM     igi_exp_tu_type_headers_all
333       WHERE    tu_type_header_id                 = x_tu_type_header_id;
334 
335     x_last_update_date           DATE;
336     x_last_updated_by            NUMBER;
337     x_last_update_login          NUMBER;
338 
339   BEGIN
340 
341     x_last_update_date := SYSDATE;
342     IF (x_mode = 'I') THEN
343       x_last_updated_by := 1;
344       x_last_update_login := 0;
345     ELSIF (x_mode = 'R') THEN
346       x_last_updated_by := fnd_global.user_id;
347       IF (x_last_updated_by IS NULL) THEN
348         x_last_updated_by := -1;
349       END IF;
350       x_last_update_login := fnd_global.login_id;
351       IF (x_last_update_login IS NULL) THEN
352         x_last_update_login := -1;
353       END IF;
354     ELSE
355       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
356    --bug 3199481 fnd logging changes: sdixit: start block
357        IF (l_error_level >=  l_debug_level ) THEN
358           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.insert_row',FALSE);
359        END IF;
360    --bug 3199481 fnd logging changes: sdixit: end block
361 
362       app_exception.raise_exception;
363     END IF;
364 
365     SELECT    igi_exp_tu_type_headers_s1.NEXTVAL
366     INTO      x_tu_type_header_id
367     FROM      dual;
368 
369     before_dml(
370       p_action                            => 'INSERT',
371       x_rowid                             => x_rowid,
372       x_tu_type_header_id                 => x_tu_type_header_id,
373       x_tu_type_name                      => x_tu_type_name,
374       x_tu_type_desc                      => x_tu_type_desc,
375       x_apprv_profile_id                  => x_apprv_profile_id,
376       x_allow_override                    => x_allow_override,
377       x_start_date                        => x_start_date,
378       x_end_date                          => x_end_date,
379       x_org_id                            => x_org_id,
380       x_creation_date                     => x_last_update_date,
381       x_created_by                        => x_last_updated_by,
382       x_last_update_date                  => x_last_update_date,
383       x_last_updated_by                   => x_last_updated_by,
384       x_last_update_login                 => x_last_update_login
385     );
386 
387     INSERT INTO igi_exp_tu_type_headers_all (
388       tu_type_header_id,
389       tu_type_name,
390       tu_type_desc,
391       apprv_profile_id,
392       allow_override,
393       start_date,
394       end_date,
395       org_id,
396       creation_date,
397       created_by,
398       last_update_date,
399       last_updated_by,
400       last_update_login
401     ) VALUES (
402       new_references.tu_type_header_id,
403       new_references.tu_type_name,
404       new_references.tu_type_desc,
405       new_references.apprv_profile_id,
406       new_references.allow_override,
407       new_references.start_date,
408       new_references.end_date,
409       new_references.org_id,
410       x_last_update_date,
411       x_last_updated_by,
412       x_last_update_date,
413       x_last_updated_by,
414       x_last_update_login
415     );
416 
417     OPEN c;
418     FETCH c INTO x_rowid;
419     IF (c%NOTFOUND) THEN
420       CLOSE c;
421       RAISE NO_DATA_FOUND;
422     END IF;
423     CLOSE c;
424 
425   END insert_row;
426 
427 
428   PROCEDURE lock_row (
429     x_rowid                             IN     VARCHAR2,
430     x_tu_type_header_id                 IN     NUMBER,
431     x_tu_type_name                      IN     VARCHAR2,
432     x_tu_type_desc                      IN     VARCHAR2,
433     x_apprv_profile_id                  IN     NUMBER,
434     x_allow_override                    IN     VARCHAR2,
435     x_start_date                        IN     DATE,
436     x_end_date                          IN     DATE,
437     x_org_id                            IN     NUMBER
438   ) AS
439   /*
440   ||  Created By : [email protected]
441   ||  Created On : 18-OCT-2001
442   ||  Purpose : Handles the LOCK mechanism for the table.
443   ||  Known limitations, enhancements or remarks :
444   ||  Change History :
445   ||  Who             When            What
446   ||  (reverse chronological order - newest change first)
447   */
448     CURSOR c1 IS
449       SELECT
450         tu_type_name,
451         tu_type_desc,
452         apprv_profile_id,
453         allow_override,
454         start_date,
455         end_date,
456         org_id
457       FROM  igi_exp_tu_type_headers_all
458       WHERE rowid = x_rowid
459       FOR UPDATE NOWAIT;
460 
461     tlinfo c1%ROWTYPE;
462 
463   BEGIN
464 
465     OPEN c1;
466     FETCH c1 INTO tlinfo;
467     IF (c1%notfound) THEN
468       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
469    --bug 3199481 fnd logging changes: sdixit: start block
470        IF (l_error_level >=  l_debug_level ) THEN
471           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.lock_row',FALSE);
472        END IF;
473    --bug 3199481 fnd logging changes: sdixit: end block
474 
475       CLOSE c1;
476       app_exception.raise_exception;
477       RETURN;
478     END IF;
479     CLOSE c1;
480 
481     IF (
482         (tlinfo.tu_type_name = x_tu_type_name)
483         AND ((tlinfo.tu_type_desc = x_tu_type_desc) OR ((tlinfo.tu_type_desc IS NULL) AND (X_tu_type_desc IS NULL)))
484         AND (tlinfo.apprv_profile_id = x_apprv_profile_id)
485         AND (tlinfo.allow_override = x_allow_override)
486         AND (tlinfo.start_date = x_start_date)
487         AND ((tlinfo.end_date = x_end_date) OR ((tlinfo.end_date IS NULL) AND (X_end_date IS NULL)))
488         AND (tlinfo.org_id = x_org_id)
489        ) THEN
490       NULL;
491     ELSE
492       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
493    --bug 3199481 fnd logging changes: sdixit: start block
494        IF (l_error_level >=  l_debug_level ) THEN
495           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.lock_row',FALSE);
496        END IF;
497    --bug 3199481 fnd logging changes: sdixit: end block
498 
499       app_exception.raise_exception;
500     END IF;
501 
502     RETURN;
503 
504   END lock_row;
505 
506 
507   PROCEDURE update_row (
508     x_rowid                             IN     VARCHAR2,
509     x_tu_type_header_id                 IN     NUMBER,
510     x_tu_type_name                      IN     VARCHAR2,
511     x_tu_type_desc                      IN     VARCHAR2,
512     x_apprv_profile_id                  IN     NUMBER,
513     x_allow_override                    IN     VARCHAR2,
514     x_start_date                        IN     DATE,
515     x_end_date                          IN     DATE,
516     x_org_id                            IN     NUMBER,
517     x_mode                              IN     VARCHAR2 ) AS
518   /*
519   ||  Created By : [email protected]
520   ||  Created On : 18-OCT-2001
521   ||  Purpose : Handles the UPDATE DML logic for the table.
522   ||  Known limitations, enhancements or remarks :
523   ||  Change History :
524   ||  Who             When            What
525   ||  (reverse chronological order - newest change first)
526   */
527     x_last_update_date           DATE ;
528     x_last_updated_by            NUMBER;
529     x_last_update_login          NUMBER;
530 
531   BEGIN
532 
533     x_last_update_date := SYSDATE;
534     IF (X_MODE = 'I') THEN
535       x_last_updated_by := 1;
536       x_last_update_login := 0;
537     ELSIF (x_mode = 'R') THEN
538       x_last_updated_by := fnd_global.user_id;
539       IF x_last_updated_by IS NULL THEN
540         x_last_updated_by := -1;
541       END IF;
542       x_last_update_login := fnd_global.login_id;
543       IF (x_last_update_login IS NULL) THEN
544         x_last_update_login := -1;
545       END IF;
546     ELSE
547       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
548    --bug 3199481 fnd logging changes: sdixit: start block
549        IF (l_error_level >=  l_debug_level ) THEN
550           FND_LOG.MESSAGE (l_error_level , 'igi.plsql.igiexpub.IGI_EXP_TU_TYPE_HEADERS_PKG.update_row',FALSE);
551        END IF;
552    --bug 3199481 fnd logging changes: sdixit: end block
553 
554       app_exception.raise_exception;
555     END IF;
556 
557     before_dml(
558       p_action                            => 'UPDATE',
559       x_rowid                             => x_rowid,
560       x_tu_type_header_id                 => x_tu_type_header_id,
561       x_tu_type_name                      => x_tu_type_name,
562       x_tu_type_desc                      => x_tu_type_desc,
563       x_apprv_profile_id                  => x_apprv_profile_id,
564       x_allow_override                    => x_allow_override,
565       x_start_date                        => x_start_date,
566       x_end_date                          => x_end_date,
567       x_org_id                            => x_org_id,
568       x_creation_date                     => x_last_update_date,
569       x_created_by                        => x_last_updated_by,
570       x_last_update_date                  => x_last_update_date,
571       x_last_updated_by                   => x_last_updated_by,
572       x_last_update_login                 => x_last_update_login
573     );
574 
575     UPDATE igi_exp_tu_type_headers_all
576       SET
577         tu_type_name                      = new_references.tu_type_name,
578         tu_type_desc                      = new_references.tu_type_desc,
579         apprv_profile_id                  = new_references.apprv_profile_id,
580         allow_override                    = new_references.allow_override,
581         start_date                        = new_references.start_date,
582         end_date                          = new_references.end_date,
583         org_id                            = new_references.org_id,
584         last_update_date                  = x_last_update_date,
585         last_updated_by                   = x_last_updated_by,
586         last_update_login                 = x_last_update_login
587       WHERE rowid = x_rowid;
588 
589     IF (SQL%NOTFOUND) THEN
590       RAISE NO_DATA_FOUND;
591     END IF;
592 
593   END update_row;
594 
595 
596   PROCEDURE add_row (
597     x_rowid                             IN OUT NOCOPY VARCHAR2,
598     x_tu_type_header_id                 IN OUT NOCOPY NUMBER,
599     x_tu_type_name                      IN     VARCHAR2,
600     x_tu_type_desc                      IN     VARCHAR2,
601     x_apprv_profile_id                  IN     NUMBER,
602     x_allow_override                    IN     VARCHAR2,
603     x_start_date                        IN     DATE,
604     x_end_date                          IN     DATE,
605     x_org_id                            IN     NUMBER,
606     x_mode                              IN     VARCHAR2 ) AS
607   /*
608   ||  Created By : [email protected]
609   ||  Created On : 18-OCT-2001
610   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
611   ||  Known limitations, enhancements or remarks :
612   ||  Change History :
613   ||  Who             When            What
614   ||  (reverse chronological order - newest change first)
615   */
616     CURSOR c1 IS
617       SELECT   rowid
618       FROM     igi_exp_tu_type_headers_all
619       WHERE    tu_type_header_id                 = x_tu_type_header_id;
620 
621   BEGIN
622 
623     OPEN c1;
624     FETCH c1 INTO x_rowid;
625     IF (c1%NOTFOUND) THEN
626       CLOSE c1;
627 
628       insert_row (
629         x_rowid,
630         x_tu_type_header_id,
631         x_tu_type_name,
632         x_tu_type_desc,
633         x_apprv_profile_id,
634         x_allow_override,
635         x_start_date,
636         x_end_date,
637         x_org_id,
638         x_mode
639       );
640       RETURN;
641     END IF;
642     CLOSE c1;
643 
644     update_row (
645       x_rowid,
646       x_tu_type_header_id,
647       x_tu_type_name,
648       x_tu_type_desc,
649       x_apprv_profile_id,
650       x_allow_override,
651       x_start_date,
652       x_end_date,
653       x_org_id,
654       x_mode
655     );
656 
657   END add_row;
658 
659 
660   PROCEDURE delete_row (
661     x_rowid IN VARCHAR2
662   ) AS
663   /*
664   ||  Created By : [email protected]
665   ||  Created On : 18-OCT-2001
666   ||  Purpose : Handles the DELETE DML logic for the table.
667   ||  Known limitations, enhancements or remarks :
668   ||  Change History :
669   ||  Who             When            What
670   ||  (reverse chronological order - newest change first)
671   */
672   BEGIN
673 
674     before_dml (
675       p_action => 'DELETE',
676       x_rowid => x_rowid
677     );
678 
679     DELETE FROM igi_exp_tu_type_headers_all
680     WHERE rowid = x_rowid;
681 
682     IF (SQL%NOTFOUND) THEN
683       RAISE NO_DATA_FOUND;
684     END IF;
685 
686   END delete_row;
687 
688 
689 END igi_exp_tu_type_headers_pkg;