136:
137: --Generates "Warning" message in the Status column of Concurrent Manager "Requests" table
138:
139: if g_debug_flag = 'Y' then
140: edw_log.put_line(' ');
141: edw_log.put_line('INSERTING ' || to_char(sql%rowcount) || ' rows from staging table');
142: edw_log.put_line('G_missing rates IS '||g_missing_rates);
143: edw_log.put_line('g_retcode is '||g_retcode);
144: end if;
137: --Generates "Warning" message in the Status column of Concurrent Manager "Requests" table
138:
139: if g_debug_flag = 'Y' then
140: edw_log.put_line(' ');
141: edw_log.put_line('INSERTING ' || to_char(sql%rowcount) || ' rows from staging table');
142: edw_log.put_line('G_missing rates IS '||g_missing_rates);
143: edw_log.put_line('g_retcode is '||g_retcode);
144: end if;
145:
138:
139: if g_debug_flag = 'Y' then
140: edw_log.put_line(' ');
141: edw_log.put_line('INSERTING ' || to_char(sql%rowcount) || ' rows from staging table');
142: edw_log.put_line('G_missing rates IS '||g_missing_rates);
143: edw_log.put_line('g_retcode is '||g_retcode);
144: end if;
145:
146: END;
139: if g_debug_flag = 'Y' then
140: edw_log.put_line(' ');
141: edw_log.put_line('INSERTING ' || to_char(sql%rowcount) || ' rows from staging table');
142: edw_log.put_line('G_missing rates IS '||g_missing_rates);
143: edw_log.put_line('g_retcode is '||g_retcode);
144: end if;
145:
146: END;
147:
327:
328: fii_flex_mapping.free_mem_all;
329:
330: if g_debug_flag = 'Y' then
331: edw_log.put_line('g_row_count is');
332: edw_log.put_line(TO_CHAR(sql%rowcount));
333: end if;
334:
335: RETURN(sql%rowcount);
328: fii_flex_mapping.free_mem_all;
329:
330: if g_debug_flag = 'Y' then
331: edw_log.put_line('g_row_count is');
332: edw_log.put_line(TO_CHAR(sql%rowcount));
333: end if;
334:
335: RETURN(sql%rowcount);
336:
488: WHERE program_update_date BETWEEN g_push_date_range1 and g_push_date_range2
489: and function_code NOT IN ('LRL','LRB','URL','URB');
490:
491: if g_debug_flag = 'Y' then
492: edw_log.put_line(' ');
493: edw_log.put_line('Inserted ' || nvl(SQL%ROWCOUNT,0) || ' records into labor primary key table' );
494: end if;
495:
496:
489: and function_code NOT IN ('LRL','LRB','URL','URB');
490:
491: if g_debug_flag = 'Y' then
492: edw_log.put_line(' ');
493: edw_log.put_line('Inserted ' || nvl(SQL%ROWCOUNT,0) || ' records into labor primary key table' );
494: end if;
495:
496:
497: INSERT INTO fii_pa_revenue_evt_pk
509: FROM pa_cust_event_rdl_all
510: WHERE program_update_date BETWEEN g_push_date_range1 and g_push_date_range2;
511:
512: if g_debug_flag = 'Y' then
513: edw_log.put_line(' ');
514: edw_log.put_line('Inserted ' || nvl(SQL%ROWCOUNT,0) || ' records into event primary key table' );
515: end if;
516:
517: IF (FND_INSTALLATION.GET_APP_INFO('FII', l_status, l_industry, l_fii_schema)) THEN
510: WHERE program_update_date BETWEEN g_push_date_range1 and g_push_date_range2;
511:
512: if g_debug_flag = 'Y' then
513: edw_log.put_line(' ');
514: edw_log.put_line('Inserted ' || nvl(SQL%ROWCOUNT,0) || ' records into event primary key table' );
515: end if;
516:
517: IF (FND_INSTALLATION.GET_APP_INFO('FII', l_status, l_industry, l_fii_schema)) THEN
518:
519: l_stmt := 'ANALYZE TABLE ' || l_fii_schema || '.FII_PA_REVENUE_EXP_PK COMPUTE STATISTICS';
520: EXECUTE IMMEDIATE l_stmt;
521:
522: if g_debug_flag = 'Y' then
523: edw_log.put_line('Analyzed labor primary key table' );
524: end if;
525:
526: l_stmt := 'ANALYZE TABLE ' || l_fii_schema || '.FII_PA_REVENUE_EVT_PK COMPUTE STATISTICS';
527: EXECUTE IMMEDIATE l_stmt;
526: l_stmt := 'ANALYZE TABLE ' || l_fii_schema || '.FII_PA_REVENUE_EVT_PK COMPUTE STATISTICS';
527: EXECUTE IMMEDIATE l_stmt;
528:
529: if g_debug_flag = 'Y' then
530: edw_log.put_line('Analyzed event primary key table' );
531: end if;
532:
533: END IF;
534:
601: l_date1 := g_push_date_range1;
602: l_date2 := g_push_date_range2;
603:
604: if g_debug_flag = 'Y' then
605: edw_log.put_line( 'The collection range is from '||
606: to_char(l_date1,'MM/DD/YYYY HH24:MI:SS')||' to '||
607: to_char(l_date2,'MM/DD/YYYY HH24:MI:SS'));
608: edw_log.put_line(' ');
609: end if;
604: if g_debug_flag = 'Y' then
605: edw_log.put_line( 'The collection range is from '||
606: to_char(l_date1,'MM/DD/YYYY HH24:MI:SS')||' to '||
607: to_char(l_date2,'MM/DD/YYYY HH24:MI:SS'));
608: edw_log.put_line(' ');
609: end if;
610:
611: -- --------------------------------------------------------
612: -- 1. Clean up any records left from previous process in
612: -- 1. Clean up any records left from previous process in
613: -- the local staging table.
614: -- --------------------------------------------------------
615: if g_debug_flag = 'Y' then
616: edw_log.put_line(' ');
617: edw_log.put_line('Cleaning up unprocessed records left in local staging table');
618: end if;
619:
620: IF (NOT LOCAL_SAME_AS_REMOTE) THEN
613: -- the local staging table.
614: -- --------------------------------------------------------
615: if g_debug_flag = 'Y' then
616: edw_log.put_line(' ');
617: edw_log.put_line('Cleaning up unprocessed records left in local staging table');
618: end if;
619:
620: IF (NOT LOCAL_SAME_AS_REMOTE) THEN
621: TRUNCATE_STG;
627: -- 2. Identify changed records
628: -- --------------------------------------------------------
629:
630: if g_debug_flag = 'Y' then
631: edw_log.put_line(' ');
632: fii_util.start_timer;
633: end if;
634:
635: if NOT IDENTIFY_CHANGE THEN
645: -- 3. Pushing data to local staging table
646: -- --------------------------------------------------------
647:
648: if g_debug_flag = 'Y' then
649: edw_log.put_line(' ');
650: edw_log.put_line('Pushing data');
651: fii_util.start_timer;
652: end if;
653:
646: -- --------------------------------------------------------
647:
648: if g_debug_flag = 'Y' then
649: edw_log.put_line(' ');
650: edw_log.put_line('Pushing data');
651: fii_util.start_timer;
652: end if;
653:
654: g_row_count := PUSH_TO_LOCAL;
662: RAISE L_push_local_failure;
663: END IF;
664:
665: if g_debug_flag = 'Y' then
666: edw_log.put_line('Inserted '||nvl(g_row_count,0)|| ' rows into the local staging table');
667: edw_log.put_line(' ');
668: end if;
669:
670: -- --------------------------------------------------------
663: END IF;
664:
665: if g_debug_flag = 'Y' then
666: edw_log.put_line('Inserted '||nvl(g_row_count,0)|| ' rows into the local staging table');
667: edw_log.put_line(' ');
668: end if;
669:
670: -- --------------------------------------------------------
671: -- 4. Clean up any records left from previous process in
672: -- FII_PA_REVENUE_EXP_PK and FII_PA_REVENUE_EVT_PK tables
673: -- --------------------------------------------------------
674:
675: if g_debug_flag = 'Y' then
676: edw_log.put_line(' ');
677: edw_log.put_line('Cleaning up unprocessed records left in primary key tables');
678: end if;
679:
680: -- note that TRUNCATE statement does implicit commit;
673: -- --------------------------------------------------------
674:
675: if g_debug_flag = 'Y' then
676: edw_log.put_line(' ');
677: edw_log.put_line('Cleaning up unprocessed records left in primary key tables');
678: end if;
679:
680: -- note that TRUNCATE statement does implicit commit;
681:
684: END IF;
685:
686: -- select count(*) into rows from FII_PA_BUDGET_PK ;
687: -- if g_debug_flag = 'Y' then
688: -- edw_log.put_line('Number of rows in tmp_pk after truncating or deleting '||rows );
689: -- end if;
690:
691: -- ------------------------------------------------------------------------------------------------
692: -- 4A. Insert missing rates from local fstg into tmp_pk table printing data to file
723: -- and clean up local staging
724: -- -----------------------------------------------
725:
726: if g_debug_flag = 'Y' then
727: edw_log.put_line(' ');
728: edw_log.put_line('Moving data from local staging table to remote staging table');
729: fii_util.start_timer;
730: end if;
731:
724: -- -----------------------------------------------
725:
726: if g_debug_flag = 'Y' then
727: edw_log.put_line(' ');
728: edw_log.put_line('Moving data from local staging table to remote staging table');
729: fii_util.start_timer;
730: end if;
731:
732: g_row_count := PUSH_REMOTE;
738:
739: IF (g_row_count = -1) THEN RAISE l_push_remote_failure; END IF;
740:
741: if g_debug_flag = 'Y' then
742: edw_log.put_line(' ');
743: edw_log.put_line('Cleaning local staging table');
744: fii_util.start_timer;
745: end if;
746:
739: IF (g_row_count = -1) THEN RAISE l_push_remote_failure; END IF;
740:
741: if g_debug_flag = 'Y' then
742: edw_log.put_line(' ');
743: edw_log.put_line('Cleaning local staging table');
744: fii_util.start_timer;
745: end if;
746:
747: TRUNCATE_STG;
758: -- records status 'LOCAL READY' to 'READY'
759: -- -----------------------------------------------
760:
761: if g_debug_flag = 'Y' then
762: edw_log.put_line(' ');
763: edw_log.put_line('Marking records in staging table with READY status');
764: fii_util.start_timer;
765: end if;
766:
759: -- -----------------------------------------------
760:
761: if g_debug_flag = 'Y' then
762: edw_log.put_line(' ');
763: edw_log.put_line('Marking records in staging table with READY status');
764: fii_util.start_timer;
765: end if;
766:
767: g_row_count := SET_STATUS_READY;
779: -- Successful. Commit and call
780: -- wrapup to commit and insert messages into logs
781: -- -----------------------------------------------
782: if g_debug_flag = 'Y' then
783: edw_log.put_line(' ');
784: edw_log.put_line('Inserted '||nvl(g_row_count,0)|| ' rows into the staging table');
785: edw_log.put_line(' ');
786: end if;
787:
780: -- wrapup to commit and insert messages into logs
781: -- -----------------------------------------------
782: if g_debug_flag = 'Y' then
783: edw_log.put_line(' ');
784: edw_log.put_line('Inserted '||nvl(g_row_count,0)|| ' rows into the staging table');
785: edw_log.put_line(' ');
786: end if;
787:
788: COMMIT;
781: -- -----------------------------------------------
782: if g_debug_flag = 'Y' then
783: edw_log.put_line(' ');
784: edw_log.put_line('Inserted '||nvl(g_row_count,0)|| ' rows into the staging table');
785: edw_log.put_line(' ');
786: end if;
787:
788: COMMIT;
789:
809: EDW_COLLECTION_UTIL.wrapup(TRUE, g_row_count, null, g_push_date_range1, g_push_date_range2);
810: if (g_missing_rates >0) then
811:
812: if g_debug_flag = 'Y' then
813: edw_log.put_line ('Records with missing rates identified in source and not loaded to warehouse');
814: end if;
815:
816: end if;
817: Exception
820: Errbuf:=g_errbuf;
821: Retcode:=g_retcode;
822: l_exception_msg := Retcode || ':' || Errbuf;
823: if g_debug_flag = 'Y' then
824: edw_log.put_line('ERROR: Identifying changed records have Failed');
825: end if;
826: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg, g_push_date_range1, g_push_date_range2);
827: WHEN L_PUSH_LOCAL_FAILURE THEN
828: rollback;
829: Errbuf:=g_errbuf;
830: Retcode:=g_retcode;
831: l_exception_msg := Retcode || ':' || Errbuf;
832: if g_debug_flag = 'Y' then
833: edw_log.put_line('ERROR: Inserting into local staging have failed');
834: end if;
835: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg, g_push_date_range1, g_push_date_range2);
836: WHEN L_PUSH_REMOTE_FAILURE THEN
837: rollback;
838: Errbuf:=g_errbuf;
839: Retcode:=g_retcode;
840: l_exception_msg := Retcode || ':' || Errbuf;
841: if g_debug_flag = 'Y' then
842: edw_log.put_line('ERROR: Data migration from local to remote staging have failed');
843: end if;
844: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg, g_push_date_range1, g_push_date_range2);
845: WHEN L_SET_STATUS_FAILURE THEN
846: rollback;
847: Errbuf:=g_errbuf;
848: Retcode:=g_retcode;
849: l_exception_msg := Retcode || ':' || Errbuf;
850: if g_debug_flag = 'Y' then
851: edw_log.put_line('ERROR: Setting status to READY have failed');
852: end if;
853: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg, g_push_date_range1, g_push_date_range2);
854: WHEN L_TRUNCATE_TMP_PK_FAILURE THEN
855: rollback;
856: Errbuf:=g_errbuf;
857: Retcode:=g_retcode;
858: l_exception_msg := Retcode || ':' || Errbuf;
859: if g_debug_flag = 'Y' then
860: edw_log.put_line('ERROR: Clean-up of primary key table failed');
861: edw_log.put_line(' ');
862: end if;
863: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg, g_push_date_range1, g_push_date_range2);
864: WHEN OTHERS THEN
857: Retcode:=g_retcode;
858: l_exception_msg := Retcode || ':' || Errbuf;
859: if g_debug_flag = 'Y' then
860: edw_log.put_line('ERROR: Clean-up of primary key table failed');
861: edw_log.put_line(' ');
862: end if;
863: EDW_COLLECTION_UTIL.wrapup(FALSE, 0, l_exception_msg, g_push_date_range1, g_push_date_range2);
864: WHEN OTHERS THEN
865: rollback;