435:
436: --l_date1 := g_push_date_range1;
437: --l_date2 := g_push_date_range2;
438:
439: edw_log.put_line( 'The collection range is from '||
440: to_char(g_push_from_date,'MM/DD/YYYY HH24:MI:SS')||' to '||
441: to_char(g_push_to_date,'MM/DD/YYYY HH24:MI:SS'));
442: edw_log.put_line(' ');
443:
438:
439: edw_log.put_line( 'The collection range is from '||
440: to_char(g_push_from_date,'MM/DD/YYYY HH24:MI:SS')||' to '||
441: to_char(g_push_to_date,'MM/DD/YYYY HH24:MI:SS'));
442: edw_log.put_line(' ');
443:
444: -- --------------------------------------------------------
445: -- Identify Change for View Type 1
446: -- --------------------------------------------------------
443:
444: -- --------------------------------------------------------
445: -- Identify Change for View Type 1
446: -- --------------------------------------------------------
447: edw_log.put_line(' ');
448: edw_log.put_line('Identifying change in view type 1');
449:
450: l_row_count := 0;
451: l_seq_id_view1 := identify_change( p_view_id => 1,
444: -- --------------------------------------------------------
445: -- Identify Change for View Type 1
446: -- --------------------------------------------------------
447: edw_log.put_line(' ');
448: edw_log.put_line('Identifying change in view type 1');
449:
450: l_row_count := 0;
451: l_seq_id_view1 := identify_change( p_view_id => 1,
452: p_count => l_row_count );
453: IF (l_seq_id_view1 = -1 ) THEN
454: RAISE l_iden_change_failure;
455: END IF;
456:
457: edw_log.put_line('Identified '|| l_row_count
458: || ' changed records in view type 1. ');
459:
460: --RAISE l_iden_change_failure;
461: -- --------------------------------------------------------
469:
470: -- --------------------------------------------------------
471: -- Pushing data to local staging table
472: -- --------------------------------------------------------
473: edw_log.put_line(' ');
474: edw_log.put_line('Inserting into local staging table for view type 1');
475:
476: l_row_count_view1 := push_to_local( p_view_id => 1,
477: p_seq_id => l_seq_id_view1 );
470: -- --------------------------------------------------------
471: -- Pushing data to local staging table
472: -- --------------------------------------------------------
473: edw_log.put_line(' ');
474: edw_log.put_line('Inserting into local staging table for view type 1');
475:
476: l_row_count_view1 := push_to_local( p_view_id => 1,
477: p_seq_id => l_seq_id_view1 );
478: IF l_row_count_view1 = -1 THEN
478: IF l_row_count_view1 = -1 THEN
479: RAISE l_push_local_failure;
480: END IF;
481:
482: edw_log.put_line('Inserted ' || Nvl(l_row_count_view1,0) ||
483: ' rows into local staging table for view type 1');
484: edw_log.put_line(' ');
485:
486: --
480: END IF;
481:
482: edw_log.put_line('Inserted ' || Nvl(l_row_count_view1,0) ||
483: ' rows into local staging table for view type 1');
484: edw_log.put_line(' ');
485:
486: --
487: g_row_count := l_row_count_view1;
488:
485:
486: --
487: g_row_count := l_row_count_view1;
488:
489: edw_log.put_line('For all view types, inserted ' || Nvl(g_row_count,0)
490: || ' rows into local staging table.');
491: edw_log.put_line(' ');
492:
493:
487: g_row_count := l_row_count_view1;
488:
489: edw_log.put_line('For all view types, inserted ' || Nvl(g_row_count,0)
490: || ' rows into local staging table.');
491: edw_log.put_line(' ');
492:
493:
494: -- ---------------------------------------
495: -- Delete all incremental table's records
517: OPEN cur_missing_rates;
518: FETCH cur_missing_rates INTO L_SOB_CURRENCY_FK, L_C_DATE, l_COLLECTION_STATUS;
519: IF cur_missing_rates%FOUND THEN
520:
521: edw_log.put_line(' ');
522: edw_log.put_line('There are missing currency rates/invalid currencies. Please check the output file.');
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
518: FETCH cur_missing_rates INTO L_SOB_CURRENCY_FK, L_C_DATE, l_COLLECTION_STATUS;
519: IF cur_missing_rates%FOUND THEN
520:
521: edw_log.put_line(' ');
522: edw_log.put_line('There are missing currency rates/invalid currencies. Please check the output file.');
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
519: IF cur_missing_rates%FOUND THEN
520:
521: edw_log.put_line(' ');
522: edw_log.put_line('There are missing currency rates/invalid currencies. Please check the output file.');
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
520:
521: edw_log.put_line(' ');
522: edw_log.put_line('There are missing currency rates/invalid currencies. Please check the output file.');
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
528: edw_log.put_line ('============= =============== =================' );
521: edw_log.put_line(' ');
522: edw_log.put_line('There are missing currency rates/invalid currencies. Please check the output file.');
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
528: edw_log.put_line ('============= =============== =================' );
529: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
522: edw_log.put_line('There are missing currency rates/invalid currencies. Please check the output file.');
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
528: edw_log.put_line ('============= =============== =================' );
529: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
530:
523: edw_log.put_line(' ');
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
528: edw_log.put_line ('============= =============== =================' );
529: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
530:
531: LOOP
524: edw_log.put_line ('MISSING RATES');
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
528: edw_log.put_line ('============= =============== =================' );
529: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
530:
531: LOOP
532: FETCH cur_missing_rates INTO L_SOB_CURRENCY_FK, L_C_DATE, l_COLLECTION_STATUS;
525: edw_log.put_line ('=============');
526: edw_log.put_line (' ');
527: edw_log.put_line ('FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
528: edw_log.put_line ('============= =============== =================' );
529: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
530:
531: LOOP
532: FETCH cur_missing_rates INTO L_SOB_CURRENCY_FK, L_C_DATE, l_COLLECTION_STATUS;
533: EXIT WHEN cur_missing_rates%NOTFOUND;
530:
531: LOOP
532: FETCH cur_missing_rates INTO L_SOB_CURRENCY_FK, L_C_DATE, l_COLLECTION_STATUS;
533: EXIT WHEN cur_missing_rates%NOTFOUND;
534: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
535: END LOOP;
536: edw_log.put_line (' ');
537: edw_log.put_line ('--- END OF FILE ----');
538: END IF;
532: FETCH cur_missing_rates INTO L_SOB_CURRENCY_FK, L_C_DATE, l_COLLECTION_STATUS;
533: EXIT WHEN cur_missing_rates%NOTFOUND;
534: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
535: END LOOP;
536: edw_log.put_line (' ');
537: edw_log.put_line ('--- END OF FILE ----');
538: END IF;
539: CLOSE cur_missing_rates;
540:
533: EXIT WHEN cur_missing_rates%NOTFOUND;
534: edw_log.put_line ( RPAD(L_SOB_CURRENCY_FK,13,' ') || ' ' || RPAD(L_C_DATE,15,' ') || ' ' || l_COLLECTION_STATUS);
535: END LOOP;
536: edw_log.put_line (' ');
537: edw_log.put_line ('--- END OF FILE ----');
538: END IF;
539: CLOSE cur_missing_rates;
540:
541: if EDW_COLLECTION_UTIL.source_same_as_target then
542: DELETE FROM OPI_EDW_JOB_DETAIL_FSTG
543: WHERE SUBSTRB(JOB_DETAIL_PK,LENGTH(JOB_DETAIL_PK)-2,3) = 'OPI'
544: AND COLLECTION_STATUS IN ('RATE NOT AVAILABLE', 'INVALID CURRENCY');
545: l_rows_deleted:= sql%rowcount;
546: edw_log.put_line(' ');
547:
548: edw_log.put_line('Deleted '||nvl(l_rows_deleted,0)||
549: ' missing rate/invalid currency rows from local staging table');
550: edw_log.put_line(' ');
544: AND COLLECTION_STATUS IN ('RATE NOT AVAILABLE', 'INVALID CURRENCY');
545: l_rows_deleted:= sql%rowcount;
546: edw_log.put_line(' ');
547:
548: edw_log.put_line('Deleted '||nvl(l_rows_deleted,0)||
549: ' missing rate/invalid currency rows from local staging table');
550: edw_log.put_line(' ');
551:
552: edw_log.put_line('There are ' || to_char(Nvl(g_row_count,0) - nvl(l_rows_deleted,0))
546: edw_log.put_line(' ');
547:
548: edw_log.put_line('Deleted '||nvl(l_rows_deleted,0)||
549: ' missing rate/invalid currency rows from local staging table');
550: edw_log.put_line(' ');
551:
552: edw_log.put_line('There are ' || to_char(Nvl(g_row_count,0) - nvl(l_rows_deleted,0))
553: || ' remaining rows in local staging table.');
554: edw_log.put_line(' ');
548: edw_log.put_line('Deleted '||nvl(l_rows_deleted,0)||
549: ' missing rate/invalid currency rows from local staging table');
550: edw_log.put_line(' ');
551:
552: edw_log.put_line('There are ' || to_char(Nvl(g_row_count,0) - nvl(l_rows_deleted,0))
553: || ' remaining rows in local staging table.');
554: edw_log.put_line(' ');
555: end if;
556:
550: edw_log.put_line(' ');
551:
552: edw_log.put_line('There are ' || to_char(Nvl(g_row_count,0) - nvl(l_rows_deleted,0))
553: || ' remaining rows in local staging table.');
554: edw_log.put_line(' ');
555: end if;
556:
557: -- --------------------------------------------------------
558: -- No exception raised so far. Call wrapup to transport
557: -- --------------------------------------------------------
558: -- No exception raised so far. Call wrapup to transport
559: -- data to target database, and insert messages into logs
560: -- --------------------------------------------------------
561: edw_log.put_line(' ');
562: edw_log.put_line('Inserted '|| to_char(nvl(g_row_count,0) - nvl(l_rows_deleted,0))||
563: ' rows into the staging table');
564: edw_log.put_line(' ');
565:
558: -- No exception raised so far. Call wrapup to transport
559: -- data to target database, and insert messages into logs
560: -- --------------------------------------------------------
561: edw_log.put_line(' ');
562: edw_log.put_line('Inserted '|| to_char(nvl(g_row_count,0) - nvl(l_rows_deleted,0))||
563: ' rows into the staging table');
564: edw_log.put_line(' ');
565:
566: EDW_COLLECTION_UTIL.wrapup(TRUE,
560: -- --------------------------------------------------------
561: edw_log.put_line(' ');
562: edw_log.put_line('Inserted '|| to_char(nvl(g_row_count,0) - nvl(l_rows_deleted,0))||
563: ' rows into the staging table');
564: edw_log.put_line(' ');
565:
566: EDW_COLLECTION_UTIL.wrapup(TRUE,
567: g_row_count,
568: l_exception_msg,
578: Errbuf:=g_errbuf;
579: Retcode:=g_retcode;
580: l_exception_msg := Retcode || ':' || Errbuf;
581: rollback; -- Rollback insert into local staging
582: edw_log.put_line('Inserting into local staging have failed');
583: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,g_push_from_date,g_push_to_date);
584: raise;
585:
586: WHEN L_IDEN_CHANGE_FAILURE THEN
592: l_industry, l_opi_schema) THEN
593: execute immediate 'truncate table ' || l_opi_schema
594: || '.opi_edw_opi_job_detail_inc ';
595: END IF;
596: edw_log.put_line('Identifying changed records have Failed');
597: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,g_push_from_date,g_push_to_date);
598: raise;
599:
600: WHEN OTHERS THEN
601: Errbuf:= Sqlerrm;
602: Retcode:=sqlcode;
603: l_exception_msg := Retcode || ':' || Errbuf;
604: rollback;
605: edw_log.put_line('Other errors');
606: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
607: g_push_from_date, g_push_to_date);
608: raise;
609: