DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_AD_LOCVENUE_ADDR_PKG

Source


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