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