DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGR_I_INQUIRY_TYPES_PKG

Source


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