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_contract_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_contract_inc table');
58: END;
59:
60: -----------------------------------------------------------
94: -- progress until the push_to_local procedure for
95: -- all view types has completed successfully.
96: -- ------------------------------------------------
97:
98: edw_log.put_line(' ');
99: edw_log.put_line('Pushing data to local staging table...');
100:
101: l_temp_date := sysdate;
102: Insert Into POA_EDW_CONTRACT_FSTG(
95: -- all view types has completed successfully.
96: -- ------------------------------------------------
97:
98: edw_log.put_line(' ');
99: edw_log.put_line('Pushing data to local staging table...');
100:
101: l_temp_date := sysdate;
102: Insert Into POA_EDW_CONTRACT_FSTG(
103: DUNS_FK,
267:
268: l_rows_inserted := sql%rowcount;
269: l_duration := sysdate - l_temp_date;
270:
271: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0)) ||
272: ' rows into the local staging table');
273: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
274: edw_log.put_line(' ');
275:
269: l_duration := sysdate - l_temp_date;
270:
271: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0)) ||
272: ' rows into the local staging table');
273: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
274: edw_log.put_line(' ');
275:
276: RETURN (l_rows_inserted);
277:
270:
271: edw_log.put_line('...Inserted ' || to_char(nvl(l_rows_inserted,0)) ||
272: ' rows into the local staging table');
273: edw_log.put_line('Process Time: ' || edw_log.duration(l_duration));
274: edw_log.put_line(' ');
275:
276: RETURN (l_rows_inserted);
277:
278: EXCEPTION
350: SET seq_id = l_seq_id
351: WHERE seq_id IS NULL;
352:
353: p_count := sql%rowcount;
354: edw_log.put_line( 'Updated ' || p_count || ' records');
355:
356: INSERT INTO poa_edw_contract_inc(primary_key, seq_id)
357: SELECT po_header_id, l_seq_id
358: FROM PO_HEADERS_ALL
443: g_push_date_range1 := nvl(l_from_date,
444: EDW_COLLECTION_UTIL.G_local_last_push_start_date - EDW_COLLECTION_UTIL.g_offset);
445: g_push_date_range2 := nvl(l_to_date,EDW_COLLECTION_UTIL.G_local_curr_push_start_date);
446:
447: edw_log.put_line( 'The collection range is from '||
448: to_char(g_push_date_range1, 'MM/DD/YYYY HH24:MI:SS')||' to '||
449: to_char(g_push_date_range2, 'MM/DD/YYYY HH24:MI:SS'));
450: edw_log.put_line(' ');
451:
446:
447: edw_log.put_line( 'The collection range is from '||
448: to_char(g_push_date_range1, 'MM/DD/YYYY HH24:MI:SS')||' to '||
449: to_char(g_push_date_range2, 'MM/DD/YYYY HH24:MI:SS'));
450: edw_log.put_line(' ');
451:
452: l_temp_date := sysdate;
453:
454: -- --------------------------------------------
453:
454: -- --------------------------------------------
455: -- Identify Change
456: -- --------------------------------------------
457: edw_log.put_line(' ');
458: edw_log.put_line('Identifying changes...');
459: l_seq_id := IDENTIFY_CHANGE1 (1, l_row_count);
460:
461: if (l_seq_id = -1) THEN
454: -- --------------------------------------------
455: -- Identify Change
456: -- --------------------------------------------
457: edw_log.put_line(' ');
458: edw_log.put_line('Identifying changes...');
459: l_seq_id := IDENTIFY_CHANGE1 (1, l_row_count);
460:
461: if (l_seq_id = -1) THEN
462: RAISE l_iden_change_failure;
460:
461: if (l_seq_id = -1) THEN
462: RAISE l_iden_change_failure;
463: end if;
464: edw_log.put_line('Identified ' || l_row_count || ' changed records');
465:
466: -- -------------------------------------------
467: -- Delete delicates in the Inc Table
468: -- --------------------------------------------
466: -- -------------------------------------------
467: -- Delete delicates in the Inc Table
468: -- --------------------------------------------
469: DELETE_DUPLICATES;
470: edw_log.put_line('Duplicate records deleted in Inc Table');
471:
472: -- --------------------------------------------
473: -- Push to local staging table for view type 1
474: -- --------------------------------------------
472: -- --------------------------------------------
473: -- Push to local staging table for view type 1
474: -- --------------------------------------------
475:
476: edw_log.put_line(' ');
477: edw_log.put_line('Inserting into local staging table for view type 1');
478: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
479:
480: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
473: -- Push to local staging table for view type 1
474: -- --------------------------------------------
475:
476: edw_log.put_line(' ');
477: edw_log.put_line('Inserting into local staging table for view type 1');
478: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
479:
480: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
481:
478: l_row_count1 := PUSH_TO_LOCAL(1, l_seq_id);
479:
480: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
481:
482: edw_log.put_line('Inserted '|| nvl(l_row_count1, 0) ||
483: ' rows into the local staging table for view type 1');
484: edw_log.put_line(' ');
485:
486: -- --------------------------------------------
480: IF (l_row_count1 = -1) THEN RAISE L_push_local_failure; END IF;
481:
482: edw_log.put_line('Inserted '|| nvl(l_row_count1, 0) ||
483: ' rows into the local staging table for view type 1');
484: edw_log.put_line(' ');
485:
486: -- --------------------------------------------
487: -- Delete all incremental tables' record
488: -- --------------------------------------------
488: -- --------------------------------------------
489:
490: TRUNCATE_INC;
491:
492: edw_log.put_line(' ');
493: edw_log.put_line('truncated Increment Table');
494: edw_log.put_line(' ');
495:
496: -- --------------------------------------------
489:
490: TRUNCATE_INC;
491:
492: edw_log.put_line(' ');
493: edw_log.put_line('truncated Increment Table');
494: edw_log.put_line(' ');
495:
496: -- --------------------------------------------
497: -- Insert Missing Rates from Local Staging Into Inc Tables
490: TRUNCATE_INC;
491:
492: edw_log.put_line(' ');
493: edw_log.put_line('truncated Increment Table');
494: edw_log.put_line(' ');
495:
496: -- --------------------------------------------
497: -- Insert Missing Rates from Local Staging Into Inc Tables
498: -- to repush them next time
498: -- to repush them next time
499: -- --------------------------------------------
500: INSERT_MISSING_RATES;
501:
502: edw_log.put_line(' ');
503: edw_log.put_line('Checked records for Missing Rates');
504: edw_log.put_line(' ');
505:
506: OPEN Invalid_Rates;
499: -- --------------------------------------------
500: INSERT_MISSING_RATES;
501:
502: edw_log.put_line(' ');
503: edw_log.put_line('Checked records for Missing Rates');
504: edw_log.put_line(' ');
505:
506: OPEN Invalid_Rates;
507: FND_FILE.PUT_LINE(FND_FILE.OUTPUT,
500: INSERT_MISSING_RATES;
501:
502: edw_log.put_line(' ');
503: edw_log.put_line('Checked records for Missing Rates');
504: edw_log.put_line(' ');
505:
506: OPEN Invalid_Rates;
507: FND_FILE.PUT_LINE(FND_FILE.OUTPUT,
508: 'FROM CURRENCY CONVERSION DATE COLLECTION STATUS');
516: end loop;
517:
518: close Invalid_Rates;
519:
520: edw_log.put_line(' ');
521: edw_log.put_line('Report created for records with Missing Rates');
522: edw_log.put_line(' ');
523:
524: -- --------------------------------------------
517:
518: close Invalid_Rates;
519:
520: edw_log.put_line(' ');
521: edw_log.put_line('Report created for records with Missing Rates');
522: edw_log.put_line(' ');
523:
524: -- --------------------------------------------
525: -- Delete records with missing rates from local staging table
518: close Invalid_Rates;
519:
520: edw_log.put_line(' ');
521: edw_log.put_line('Report created for records with Missing Rates');
522: edw_log.put_line(' ');
523:
524: -- --------------------------------------------
525: -- Delete records with missing rates from local staging table
526: -- --------------------------------------------
530: -- No exception raised so far. Call wrapup to transport
531: -- data to target database, and insert messages into logs
532: -- -----------------------------------------------
533: g_row_count := g_row_count + l_row_count1;
534: edw_log.put_line(' ');
535: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
536: ' rows into the staging table');
537: l_duration := sysdate - l_temp_date;
538: edw_log.put_line(' ');
531: -- data to target database, and insert messages into logs
532: -- -----------------------------------------------
533: g_row_count := g_row_count + l_row_count1;
534: edw_log.put_line(' ');
535: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
536: ' rows into the staging table');
537: l_duration := sysdate - l_temp_date;
538: edw_log.put_line(' ');
539: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
534: edw_log.put_line(' ');
535: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
536: ' rows into the staging table');
537: l_duration := sysdate - l_temp_date;
538: edw_log.put_line(' ');
539: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
540: edw_log.put_line(' ');
541:
542: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
535: edw_log.put_line('Inserted '||nvl(g_row_count,0)||
536: ' rows into the staging table');
537: l_duration := sysdate - l_temp_date;
538: edw_log.put_line(' ');
539: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
540: edw_log.put_line(' ');
541:
542: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
543: P_PERIOD_START => g_push_date_range1,
536: ' rows into the staging table');
537: l_duration := sysdate - l_temp_date;
538: edw_log.put_line(' ');
539: edw_log.put_line('Process Time: '||edw_log.duration(l_duration));
540: edw_log.put_line(' ');
541:
542: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count,
543: P_PERIOD_START => g_push_date_range1,
544: P_PERIOD_END => g_push_date_range2);
554: end if;
555:
556: l_exception_msg := Retcode || ':' || Errbuf;
557: rollback; -- Rollback insert into local staging
558: edw_log.put_line('Inserting into local staging have failed');
559: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
560: g_push_date_range1, g_push_date_range2);
561: raise;
562:
569: end if;
570:
571: l_exception_msg := Retcode || ':' || Errbuf;
572: TRUNCATE_INC;
573: edw_log.put_line('Identifying changed records have Failed');
574: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
575: g_push_date_range1, g_push_date_range2);
576: raise;
577:
584: end if;
585:
586: l_exception_msg := Retcode || ':' || Errbuf;
587: rollback;
588: edw_log.put_line('Other errors');
589: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg,
590: g_push_date_range1, g_push_date_range2);
591: raise;
592: