DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_AD_RECRUIT_PI_PKG

Source


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