51:
52:
53: -- Generates "Warning" message in the Status column
54: -- of Concurrent Manager "Requests" table
55: edw_log.put_line(' ');
56: edw_log.put_line('INSERTING ' || to_char(sql%rowcount) ||
57: ' rows into poa_edw_alines_inc table');
58: END;
59:
52:
53: -- Generates "Warning" message in the Status column
54: -- of Concurrent Manager "Requests" table
55: edw_log.put_line(' ');
56: edw_log.put_line('INSERTING ' || to_char(sql%rowcount) ||
57: ' rows into poa_edw_alines_inc table');
58: END;
59:
60: -----------------------------------------------------------
93: -- progress until the push_to_local procedure for
94: -- all view types has completed successfully.
95: -- ------------------------------------------------
96:
97: edw_log.put_line(' ');
98: edw_log.put_line('Pushing data to local staging table...');
99:
100: l_temp_date := sysdate;
101: Insert Into POA_EDW_ALINES_FSTG (
94: -- all view types has completed successfully.
95: -- ------------------------------------------------
96:
97: edw_log.put_line(' ');
98: edw_log.put_line('Pushing data to local staging table...');
99:
100: l_temp_date := sysdate;
101: Insert Into POA_EDW_ALINES_FSTG (
102: DUNS_FK,
310:
311: l_rows_inserted := sql%rowcount;
312: l_duration := sysdate - l_temp_date;
313:
314: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0))||
315: ' rows into the local staging table');
316: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
317: edw_log.put_line(' ');
318:
312: l_duration := sysdate - l_temp_date;
313:
314: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0))||
315: ' rows into the local staging table');
316: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
317: edw_log.put_line(' ');
318:
319: RETURN (l_rows_inserted);
320:
313:
314: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0))||
315: ' rows into the local staging table');
316: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
317: edw_log.put_line(' ');
318:
319: RETURN (l_rows_inserted);
320:
321: EXCEPTION
391: SET seq_id = l_seq_id
392: WHERE seq_id IS NULL;
393:
394: p_count := sql%rowcount;
395: edw_log.put_line( 'Updated ' || p_count || ' records');
396:
397: INSERT INTO poa_edw_alines_inc(primary_key, seq_id)
398: SELECT pol.po_line_id, l_seq_id
399: FROM po_headers_all poh,
495: g_push_date_range1 := nvl(l_from_date,
496: EDW_COLLECTION_UTIL.G_local_last_push_start_date - EDW_COLLECTION_UTIL.g_offset);
497: g_push_date_range2 := nvl(l_to_date,EDW_COLLECTION_UTIL.G_local_curr_push_start_date);
498:
499: edw_log.put_line( 'The collection range is from '||
500: to_char(g_push_date_range1, 'MM/DD/YYYY HH24:MI:SS')||' to '||
501: to_char(g_push_date_range2, 'MM/DD/YYYY HH24:MI:SS'));
502: edw_log.put_line(' ');
503:
498:
499: edw_log.put_line( 'The collection range is from '||
500: to_char(g_push_date_range1, 'MM/DD/YYYY HH24:MI:SS')||' to '||
501: to_char(g_push_date_range2, 'MM/DD/YYYY HH24:MI:SS'));
502: edw_log.put_line(' ');
503:
504: l_temp_date := sysdate;
505:
506: -- --------------------------------------------
505:
506: -- --------------------------------------------
507: -- Identify Change
508: -- --------------------------------------------
509: edw_log.put_line(' ');
510: edw_log.put_line('Identifying changes...');
511: l_seq_id := IDENTIFY_CHANGE1 (1, l_row_count);
512:
513: if (l_seq_id = -1) THEN
506: -- --------------------------------------------
507: -- Identify Change
508: -- --------------------------------------------
509: edw_log.put_line(' ');
510: edw_log.put_line('Identifying changes...');
511: l_seq_id := IDENTIFY_CHANGE1 (1, l_row_count);
512:
513: if (l_seq_id = -1) THEN
514: RAISE l_iden_change_failure;
512:
513: if (l_seq_id = -1) THEN
514: RAISE l_iden_change_failure;
515: end if;
516: edw_log.put_line('Identified ' || l_row_count || ' changed records');
517:
518: -- -------------------------------------------
519: -- Delete delicates in the Inc Table
520: -- --------------------------------------------
518: -- -------------------------------------------
519: -- Delete delicates in the Inc Table
520: -- --------------------------------------------
521: DELETE_DUPLICATES;
522: edw_log.put_line('Duplicate records deleted in Inc Table');
523:
524: -- --------------------------------------------
525: -- Push to local staging table for view type 1
526: -- --------------------------------------------
524: -- --------------------------------------------
525: -- Push to local staging table for view type 1
526: -- --------------------------------------------
527:
528: edw_log.put_line(' ');
529: edw_log.put_line('Inserting into local staging table for view type 1');
530: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
531:
532: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
525: -- Push to local staging table for view type 1
526: -- --------------------------------------------
527:
528: edw_log.put_line(' ');
529: edw_log.put_line('Inserting into local staging table for view type 1');
530: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
531:
532: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
533:
530: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
531:
532: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
533:
534: edw_log.put_line('Inserted '|| nvl(l_row_count1, 0) ||
535: ' rows into the local staging table for view type 1');
536: edw_log.put_line(' ');
537:
538: -- --------------------------------------------
532: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
533:
534: edw_log.put_line('Inserted '|| nvl(l_row_count1, 0) ||
535: ' rows into the local staging table for view type 1');
536: edw_log.put_line(' ');
537:
538: -- --------------------------------------------
539: -- Delete all incremental tables' record
540: -- --------------------------------------------
540: -- --------------------------------------------
541:
542: TRUNCATE_INC;
543:
544: edw_log.put_line(' ');
545: edw_log.put_line('truncated Increment Table');
546: edw_log.put_line(' ');
547:
548: -- --------------------------------------------
541:
542: TRUNCATE_INC;
543:
544: edw_log.put_line(' ');
545: edw_log.put_line('truncated Increment Table');
546: edw_log.put_line(' ');
547:
548: -- --------------------------------------------
549: -- Insert Missing Rates from Local Staging Into Inc Tables
542: TRUNCATE_INC;
543:
544: edw_log.put_line(' ');
545: edw_log.put_line('truncated Increment Table');
546: edw_log.put_line(' ');
547:
548: -- --------------------------------------------
549: -- Insert Missing Rates from Local Staging Into Inc Tables
550: -- to repush them next time
550: -- to repush them next time
551: -- --------------------------------------------
552: INSERT_MISSING_RATES;
553:
554: edw_log.put_line(' ');
555: edw_log.put_line('Checked records for Missing Rates');
556: edw_log.put_line(' ');
557:
558: OPEN Invalid_Rates;
551: -- --------------------------------------------
552: INSERT_MISSING_RATES;
553:
554: edw_log.put_line(' ');
555: edw_log.put_line('Checked records for Missing Rates');
556: edw_log.put_line(' ');
557:
558: OPEN Invalid_Rates;
559: FND_FILE.PUT_LINE(FND_FILE.OUTPUT,
552: INSERT_MISSING_RATES;
553:
554: edw_log.put_line(' ');
555: edw_log.put_line('Checked records for Missing Rates');
556: edw_log.put_line(' ');
557:
558: OPEN Invalid_Rates;
559: FND_FILE.PUT_LINE(FND_FILE.OUTPUT,
560: 'FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
568: end loop;
569:
570: close Invalid_Rates;
571:
572: edw_log.put_line(' ');
573: edw_log.put_line('Report created for records with Missing Rates');
574: edw_log.put_line(' ');
575:
576: -- --------------------------------------------
569:
570: close Invalid_Rates;
571:
572: edw_log.put_line(' ');
573: edw_log.put_line('Report created for records with Missing Rates');
574: edw_log.put_line(' ');
575:
576: -- --------------------------------------------
577: -- Delete records with missing rates from local staging table
570: close Invalid_Rates;
571:
572: edw_log.put_line(' ');
573: edw_log.put_line('Report created for records with Missing Rates');
574: edw_log.put_line(' ');
575:
576: -- --------------------------------------------
577: -- Delete records with missing rates from local staging table
578: -- --------------------------------------------
582: -- No exception raised so far. Call wrapup to transport
583: -- data to target database, and insert messages into logs
584: -- -----------------------------------------------
585: g_row_count := g_row_count + l_row_count1;
586: edw_log.put_line(' ');
587: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
588: ' rows into the staging table');
589: l_duration := sysdate - l_temp_date;
590: edw_log.put_line(' ');
583: -- data to target database, and insert messages into logs
584: -- -----------------------------------------------
585: g_row_count := g_row_count + l_row_count1;
586: edw_log.put_line(' ');
587: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
588: ' rows into the staging table');
589: l_duration := sysdate - l_temp_date;
590: edw_log.put_line(' ');
591: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
586: edw_log.put_line(' ');
587: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
588: ' rows into the staging table');
589: l_duration := sysdate - l_temp_date;
590: edw_log.put_line(' ');
591: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
592: edw_log.put_line(' ');
593:
594: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
587: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
588: ' rows into the staging table');
589: l_duration := sysdate - l_temp_date;
590: edw_log.put_line(' ');
591: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
592: edw_log.put_line(' ');
593:
594: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
595: P_PERIOD_START => g_push_date_range1,
588: ' rows into the staging table');
589: l_duration := sysdate - l_temp_date;
590: edw_log.put_line(' ');
591: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
592: edw_log.put_line(' ');
593:
594: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
595: P_PERIOD_START => g_push_date_range1,
596: P_PERIOD_END => g_push_date_range2);
606: end if;
607:
608: l_exception_msg := Retcode || ':' || Errbuf;
609: rollback; -- Rollback insert into local staging
610: edw_log.put_line('Inserting into local staging have failed');
611: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
612: g_push_date_range1, g_push_date_range2);
613: raise;
614:
621: end if;
622:
623: l_exception_msg := Retcode || ':' || Errbuf;
624: TRUNCATE_INC;
625: edw_log.put_line('Identifying changed records have Failed');
626: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
627: g_push_date_range1, g_push_date_range2);
628: raise;
629:
636: end if;
637:
638: l_exception_msg := Retcode || ':' || Errbuf;
639: rollback;
640: edw_log.put_line('Other errors');
641: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
642: g_push_date_range1, g_push_date_range2);
643: raise;
644: