62: BEGIN
63:
64:
65: /* Insert into ISC_TMP_BOOK_SUM2 all the orders lines for orders having at least 1 line that is present in ISC_TMP_BOOK_SUM2 */
66: FII_UTIL.Start_Timer;
67: INSERT INTO isc_tmp_book_sum2 (pk1)
68: SELECT f.line_id
69: FROM isc_book_sum2_f f
70: WHERE f.header_id IN (SELECT fact.header_id
73: WHERE fact.line_id = tmp.pk1
74: )
75: AND NOT EXISTS (SELECT 1 FROM isc_tmp_book_sum2 a WHERE a.pk1 = f.line_id);
76:
77: FII_UTIL.Stop_Timer;
78: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (updated lines) in');
79:
80: /* Insert into ISC_TMP_BOOK_SUM2 order lines from ISC_SALES_CREDITS_F to be recollected because their sales credit have been deleted from OE_SALES_CREDITS */
81: FII_UTIL.Start_Timer;
74: )
75: AND NOT EXISTS (SELECT 1 FROM isc_tmp_book_sum2 a WHERE a.pk1 = f.line_id);
76:
77: FII_UTIL.Stop_Timer;
78: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (updated lines) in');
79:
80: /* Insert into ISC_TMP_BOOK_SUM2 order lines from ISC_SALES_CREDITS_F to be recollected because their sales credit have been deleted from OE_SALES_CREDITS */
81: FII_UTIL.Start_Timer;
82: INSERT INTO isc_tmp_book_sum2 (pk1)
77: FII_UTIL.Stop_Timer;
78: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (updated lines) in');
79:
80: /* Insert into ISC_TMP_BOOK_SUM2 order lines from ISC_SALES_CREDITS_F to be recollected because their sales credit have been deleted from OE_SALES_CREDITS */
81: FII_UTIL.Start_Timer;
82: INSERT INTO isc_tmp_book_sum2 (pk1)
83: SELECT f.line_id
84: FROM isc_book_sum2_f f
85: WHERE header_id IN (SELECT fact.header_id
87: WHERE NOT EXISTS (SELECT 1 FROM oe_sales_credits WHERE sales_credit_id = fact.sales_credit_id)
88: )
89: AND NOT EXISTS (SELECT 1 FROM isc_tmp_book_sum2 a WHERE a.pk1 = f.line_id);
90:
91: FII_UTIL.Stop_Timer;
92: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (lines deleted from oe_sc..) in');
93:
94: COMMIT;
95:
88: )
89: AND NOT EXISTS (SELECT 1 FROM isc_tmp_book_sum2 a WHERE a.pk1 = f.line_id);
90:
91: FII_UTIL.Stop_Timer;
92: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (lines deleted from oe_sc..) in');
93:
94: COMMIT;
95:
96:
95:
96:
97: /* Insert into ISC_TMP_BOOK_SUM2 "SERVICE" order lines referencing parent service identified in #1 and #2 */
98: -- SERVICE rows whose ORDER or CUSTOMER_PRODUCT parent line_id has been updated
99: FII_UTIL.Start_Timer;
100: INSERT INTO ISC_TMP_BOOK_SUM2 (pk1)
101: SELECT f.line_id
102: FROM isc_book_sum2_f f
103: WHERE f.header_id IN
107: WHERE tmp.pk1 = fact.service_parent_line_id
108: AND EXISTS (SELECT 1 FROM isc_book_sum2_f WHERE line_id = fact.service_parent_line_id))
109: AND NOT EXISTS( SELECT 1 FROM isc_tmp_book_sum2 a WHERE a.pk1 = f.line_id);
110:
111: FII_UTIL.Stop_Timer;
112: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (service_parent_line_id...) in');
113:
114: COMMIT;
115:
108: AND EXISTS (SELECT 1 FROM isc_book_sum2_f WHERE line_id = fact.service_parent_line_id))
109: AND NOT EXISTS( SELECT 1 FROM isc_tmp_book_sum2 a WHERE a.pk1 = f.line_id);
110:
111: FII_UTIL.Stop_Timer;
112: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into isc_tmp_book_sum2 (service_parent_line_id...) in');
113:
114: COMMIT;
115:
116: -- Delete from ISC_SALES_CREDITS_F order lines that will be recollected --
113:
114: COMMIT;
115:
116: -- Delete from ISC_SALES_CREDITS_F order lines that will be recollected --
117: FII_UTIL.Start_Timer;
118: DELETE FROM isc_sales_credits_f
119: WHERE line_id in (SELECT pk1 from ISC_TMP_BOOK_SUM2);
120:
121: FII_UTIL.Stop_Timer;
117: FII_UTIL.Start_Timer;
118: DELETE FROM isc_sales_credits_f
119: WHERE line_id in (SELECT pk1 from ISC_TMP_BOOK_SUM2);
120:
121: FII_UTIL.Stop_Timer;
122: FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' rows from ISC_SALES_CREDITS_F in');
123: COMMIT;
124: /* Insert into ISC_SALES_CREDITS_F */
125: BIS_COLLECTION_UTILITIES.put_line(' ');
118: DELETE FROM isc_sales_credits_f
119: WHERE line_id in (SELECT pk1 from ISC_TMP_BOOK_SUM2);
120:
121: FII_UTIL.Stop_Timer;
122: FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' rows from ISC_SALES_CREDITS_F in');
123: COMMIT;
124: /* Insert into ISC_SALES_CREDITS_F */
125: BIS_COLLECTION_UTILITIES.put_line(' ');
126: BIS_COLLECTION_UTILITIES.put_line('Inserting data into sales fact table');
123: COMMIT;
124: /* Insert into ISC_SALES_CREDITS_F */
125: BIS_COLLECTION_UTILITIES.put_line(' ');
126: BIS_COLLECTION_UTILITIES.put_line('Inserting data into sales fact table');
127: FII_UTIL.Start_Timer;
128:
129: INSERT /*+ APPEND PARALLEL(f) */ INTO isc_sales_credits_f f
130: with s as (
131: select /*+ ordered use_hash(sc) parallel(sc) parallel(sr)
220: AND s.org_id = t11.org_ou_id
221: AND s.header_id = t11.header_id))
222: WHERE low_rnk = 1;
223:
224: FII_UTIL.Stop_Timer;
225: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into the sales fact table in');
226: COMMIT;
227:
228: RETURN(1);
221: AND s.header_id = t11.header_id))
222: WHERE low_rnk = 1;
223:
224: FII_UTIL.Stop_Timer;
225: FII_UTIL.Print_Timer('Inserted '||sql%rowcount||' rows into the sales fact table in');
226: COMMIT;
227:
228: RETURN(1);
229:
321: -- g_degree := bis_common_parameters.get_degree_of_parallelism;
322: -- BIS_COLLECTION_UTILITIES.put_line('The degree of parallelism is ' || g_degree);
323:
324: BIS_COLLECTION_UTILITIES.put_line('Truncating the temp table');
325: FII_UTIL.Start_Timer;
326:
327: IF (truncate_table('ISC_DBI_CHANGE_LOG') = -1) THEN
328: return(-1);
329: END IF;
339: IF (truncate_table('ISC_SERVICE_BOOK_SUM2') = -1) THEN
340: return(-1);
341: END IF;
342:
343: FII_UTIL.Stop_Timer;
344: FII_UTIL.Print_Timer('Truncated the temp table in');
345: BIS_COLLECTION_UTILITIES.Put_Line(' ');
346:
347: RETURN(1);
340: return(-1);
341: END IF;
342:
343: FII_UTIL.Stop_Timer;
344: FII_UTIL.Print_Timer('Truncated the temp table in');
345: BIS_COLLECTION_UTILITIES.Put_Line(' ');
346:
347: RETURN(1);
348:
379: -- 4 - others
380: -- --------------------------------------------------------
381:
382: BIS_COLLECTION_UTILITIES.put_line('Identifying Booked orders lines');
383: FII_UTIL.Start_Timer;
384:
385:
386: l_stmt := 'INSERT /*+ APPEND PARALLEL(F) */ '||
387: 'INTO isc_tmp_book_sum2 F('||
509:
510: EXECUTE IMMEDIATE l_stmt;
511:
512: l_count := l_count + sql%rowcount;
513: FII_UTIL.Stop_Timer;
514: FII_UTIL.Print_Timer('Identified '||l_count||' records in');
515: COMMIT;
516:
517:
510: EXECUTE IMMEDIATE l_stmt;
511:
512: l_count := l_count + sql%rowcount;
513: FII_UTIL.Stop_Timer;
514: FII_UTIL.Print_Timer('Identified '||l_count||' records in');
515: COMMIT;
516:
517:
518: FII_UTIL.Start_Timer;
514: FII_UTIL.Print_Timer('Identified '||l_count||' records in');
515: COMMIT;
516:
517:
518: FII_UTIL.Start_Timer;
519:
520: INSERT /*+ APPEND */
521: INTO isc_curr_book_sum2 F(
522: FROM_CURRENCY,
539: fii_currency.get_global_rate_secondary(to_currency3, time_booked_date_id)) RATE4
540: FROM (SELECT /*+ PARALLEL(tmp) */ distinct from_currency, to_currency1, to_currency3, time_booked_date_id, rate_type
541: FROM isc_tmp_book_sum2 tmp);
542:
543: FII_UTIL.Stop_Timer;
544: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' currency rates in');
545: COMMIT;
546:
547: FII_UTIL.Start_Timer;
540: FROM (SELECT /*+ PARALLEL(tmp) */ distinct from_currency, to_currency1, to_currency3, time_booked_date_id, rate_type
541: FROM isc_tmp_book_sum2 tmp);
542:
543: FII_UTIL.Stop_Timer;
544: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' currency rates in');
545: COMMIT;
546:
547: FII_UTIL.Start_Timer;
548:
543: FII_UTIL.Stop_Timer;
544: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' currency rates in');
545: COMMIT;
546:
547: FII_UTIL.Start_Timer;
548:
549: INSERT /*+ APPEND */
550: INTO isc_service_book_sum2 F(
551: LINE_ID,
553: SELECT pk1, ISC_DBI_BOOK_SUM2_F_C.get_cust_product_line_id(tmp.sold_to_org_id,tmp.service_reference_line_id)
554: FROM isc_tmp_book_sum2 tmp
555: WHERE service_reference_type_code = 'CUSTOMER_PRODUCT';
556:
557: FII_UTIL.Stop_Timer;
558: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' customer product line in');
559: COMMIT;
560:
561: RETURN(l_count);
554: FROM isc_tmp_book_sum2 tmp
555: WHERE service_reference_type_code = 'CUSTOMER_PRODUCT';
556:
557: FII_UTIL.Stop_Timer;
558: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' customer product line in');
559: COMMIT;
560:
561: RETURN(l_count);
562:
577:
578: BEGIN
579:
580: BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from the base summary');
581: FII_UTIL.Start_Timer;
582:
583: DELETE FROM isc_book_sum2_f
584: WHERE line_id IN (select pk1
585: from isc_tmp_book_sum2
585: from isc_tmp_book_sum2
586: where view_type = -1)
587: AND fulfilled_flag = 'N';
588:
589: FII_UTIL.Stop_Timer;
590: FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' changed records in');
591: COMMIT;
592:
593:
586: where view_type = -1)
587: AND fulfilled_flag = 'N';
588:
589: FII_UTIL.Stop_Timer;
590: FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' changed records in');
591: COMMIT;
592:
593:
594: /* Delete ont_dbi_change_log at the end */
593:
594: /* Delete ont_dbi_change_log at the end */
595:
596: -- BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from OM log table');
597: -- FII_UTIL.Start_Timer;
598:
599: -- DELETE FROM ont_dbi_change_log
600: -- WHERE rowid IN (select log_rowid
601: -- from isc_tmp_book_sum2
600: -- WHERE rowid IN (select log_rowid
601: -- from isc_tmp_book_sum2
602: -- where view_type = -1);
603:
604: -- FII_UTIL.Stop_Timer;
605: -- FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' changed records in');
606: -- COMMIT;
607:
608: BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from the temp table');
601: -- from isc_tmp_book_sum2
602: -- where view_type = -1);
603:
604: -- FII_UTIL.Stop_Timer;
605: -- FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' changed records in');
606: -- COMMIT;
607:
608: BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from the temp table');
609: FII_UTIL.Start_Timer;
605: -- FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' changed records in');
606: -- COMMIT;
607:
608: BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from the temp table');
609: FII_UTIL.Start_Timer;
610:
611: DELETE FROM isc_tmp_book_sum2
612: WHERE view_type = -1;
613: l_count := l_count + sql%rowcount;
612: WHERE view_type = -1;
613: l_count := l_count + sql%rowcount;
614: COMMIT;
615:
616: FII_UTIL.Stop_Timer;
617: FII_UTIL.Print_Timer('Deleted '||l_count||' changed records in');
618:
619: RETURN(l_count);
620:
613: l_count := l_count + sql%rowcount;
614: COMMIT;
615:
616: FII_UTIL.Stop_Timer;
617: FII_UTIL.Print_Timer('Deleted '||l_count||' changed records in');
618:
619: RETURN(l_count);
620:
621: EXCEPTION
651: -- 3 - PTO top model/KIT (shippable)
652: -- 4 - others
653: -- --------------------------------------------------------
654:
655: FII_UTIL.Start_Timer;
656:
657: INSERT INTO isc_dbi_change_log (LINE_ID, HEADER_ID, LOG_ROWID, LAST_UPDATE_DATE)
658: SELECT line_id LINE_ID, header_id HEADER_ID, rowid LOG_ROWID, last_update_date LAST_UPDATE_DATE
659: FROM ont_dbi_change_log;
657: INSERT INTO isc_dbi_change_log (LINE_ID, HEADER_ID, LOG_ROWID, LAST_UPDATE_DATE)
658: SELECT line_id LINE_ID, header_id HEADER_ID, rowid LOG_ROWID, last_update_date LAST_UPDATE_DATE
659: FROM ont_dbi_change_log;
660:
661: FII_UTIL.Stop_Timer;
662: FII_UTIL.Print_Timer('Inserted '|| sql%rowcount || ' rows into ISC_DBI_CHANGE_LOG');
663:
664: COMMIT;
665:
658: SELECT line_id LINE_ID, header_id HEADER_ID, rowid LOG_ROWID, last_update_date LAST_UPDATE_DATE
659: FROM ont_dbi_change_log;
660:
661: FII_UTIL.Stop_Timer;
662: FII_UTIL.Print_Timer('Inserted '|| sql%rowcount || ' rows into ISC_DBI_CHANGE_LOG');
663:
664: COMMIT;
665:
666:
683: -- FROM ont_dbi_change_log
684: -- GROUP BY line_id);
685: -- COMMIT;
686:
687: FII_UTIL.Start_Timer;
688:
689: INSERT INTO isc_tmp_book_sum2(pk1, view_type)
690: SELECT distinct line_id, -1
691: FROM isc_dbi_change_log log
693: from oe_order_lines_all l
694: where l.line_id = log.line_id);
695: l_delete_count := sql%rowcount;
696:
697: FII_UTIL.Stop_Timer;
698: FII_UTIL.Print_Timer('Identified '|| l_delete_count || ' deleted lines in');
699: COMMIT;
700:
701: IF l_delete_count > 0 THEN
694: where l.line_id = log.line_id);
695: l_delete_count := sql%rowcount;
696:
697: FII_UTIL.Stop_Timer;
698: FII_UTIL.Print_Timer('Identified '|| l_delete_count || ' deleted lines in');
699: COMMIT;
700:
701: IF l_delete_count > 0 THEN
702: BIS_COLLECTION_UTILITIES.Put_Line(' ');
700:
701: IF l_delete_count > 0 THEN
702: BIS_COLLECTION_UTILITIES.Put_Line(' ');
703: BIS_COLLECTION_UTILITIES.Put_Line('Analyzing table ISC_TMP_BOOK_SUM2');
704: FII_UTIL.Start_Timer;
705: IF (FND_INSTALLATION.GET_APP_INFO('ISC', l_status, l_industry, l_schema)) THEN
706: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
707: TABNAME => 'ISC_TMP_BOOK_SUM2');
708: END IF;
705: IF (FND_INSTALLATION.GET_APP_INFO('ISC', l_status, l_industry, l_schema)) THEN
706: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
707: TABNAME => 'ISC_TMP_BOOK_SUM2');
708: END IF;
709: FII_UTIL.Stop_Timer;
710: FII_UTIL.Print_Timer('Analyzed table ISC_TMP_BOOK_SUM2 in ');
711:
712: l_delete_count := DELETE_DBI_BASE;
713: IF (l_delete_count = -1) THEN
706: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
707: TABNAME => 'ISC_TMP_BOOK_SUM2');
708: END IF;
709: FII_UTIL.Stop_Timer;
710: FII_UTIL.Print_Timer('Analyzed table ISC_TMP_BOOK_SUM2 in ');
711:
712: l_delete_count := DELETE_DBI_BASE;
713: IF (l_delete_count = -1) THEN
714: return -1;
714: return -1;
715: END IF;
716: END IF;
717:
718: FII_UTIL.Start_Timer;
719:
720: INSERT
721: INTO isc_tmp_book_sum2(
722: PK1,
838: AND hoi.org_information1 = to_char(gsb1.set_of_books_id)
839: AND l.inventory_item_id = item.inventory_item_id
840: AND nvl(l.ship_from_org_id, ospa.parameter_value) = item.organization_id;
841:
842: FII_UTIL.Stop_Timer;
843: FII_UTIL.Print_Timer('Identified '|| sql%rowcount || ' lines in');
844: COMMIT;
845:
846:
839: AND l.inventory_item_id = item.inventory_item_id
840: AND nvl(l.ship_from_org_id, ospa.parameter_value) = item.organization_id;
841:
842: FII_UTIL.Stop_Timer;
843: FII_UTIL.Print_Timer('Identified '|| sql%rowcount || ' lines in');
844: COMMIT;
845:
846:
847:
848: -- In DBI5.0, we determine if a PTO/KIT top model is shippable by scanning through all it's child lines
849: -- Therefore, in the incremental load, we need to capture the top model line if the child line is changed
850: -- For DBI6.0, we do not support this logic anymore, so comment it out to improve performance
851:
852: -- FII_UTIL.Start_Timer;
853:
854: -- INSERT
855: -- INTO isc_tmp_book_sum2(
856: -- PK1,
947: -- AND hoi.org_information1 = to_char(gsb1.set_of_books_id)
948: -- AND pl.inventory_item_id = item.inventory_item_id
949: -- AND nvl(pl.ship_from_org_id, ospa.master_organization_id) = item.organization_id;
950:
951: -- FII_UTIL.Stop_Timer;
952: -- FII_UTIL.Print_Timer('Identified '|| sql%rowcount || ' top model lines in');
953: -- COMMIT;
954:
955: FII_UTIL.Start_Timer;
948: -- AND pl.inventory_item_id = item.inventory_item_id
949: -- AND nvl(pl.ship_from_org_id, ospa.master_organization_id) = item.organization_id;
950:
951: -- FII_UTIL.Stop_Timer;
952: -- FII_UTIL.Print_Timer('Identified '|| sql%rowcount || ' top model lines in');
953: -- COMMIT;
954:
955: FII_UTIL.Start_Timer;
956:
951: -- FII_UTIL.Stop_Timer;
952: -- FII_UTIL.Print_Timer('Identified '|| sql%rowcount || ' top model lines in');
953: -- COMMIT;
954:
955: FII_UTIL.Start_Timer;
956:
957: INSERT
958: INTO isc_curr_book_sum2 F(
959: FROM_CURRENCY,
976: fii_currency.get_global_rate_secondary(to_currency3, time_booked_date_id)) RATE4
977: FROM (SELECT distinct from_currency, to_currency1, to_currency3, time_booked_date_id, rate_type
978: FROM isc_tmp_book_sum2);
979:
980: FII_UTIL.Stop_Timer;
981: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' currency rates in');
982: COMMIT;
983:
984:
977: FROM (SELECT distinct from_currency, to_currency1, to_currency3, time_booked_date_id, rate_type
978: FROM isc_tmp_book_sum2);
979:
980: FII_UTIL.Stop_Timer;
981: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' currency rates in');
982: COMMIT;
983:
984:
985:
982: COMMIT;
983:
984:
985:
986: FII_UTIL.Start_Timer;
987:
988: INSERT
989: INTO isc_service_book_sum2 F(
990: LINE_ID,
992: SELECT pk1, ISC_DBI_BOOK_SUM2_F_C.get_cust_product_line_id(tmp.sold_to_org_id,tmp.service_reference_line_id)
993: FROM isc_tmp_book_sum2 tmp
994: WHERE service_reference_type_code = 'CUSTOMER_PRODUCT';
995:
996: FII_UTIL.Stop_Timer;
997: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' customer product line in');
998: COMMIT;
999:
1000:
993: FROM isc_tmp_book_sum2 tmp
994: WHERE service_reference_type_code = 'CUSTOMER_PRODUCT';
995:
996: FII_UTIL.Stop_Timer;
997: FII_UTIL.Print_Timer('Retrieved '||sql%rowcount||' customer product line in');
998: COMMIT;
999:
1000:
1001:
1000:
1001:
1002:
1003:
1004: FII_UTIL.Start_Timer;
1005:
1006:
1007:
1008:
1011: COMMIT;
1012:
1013:
1014:
1015: FII_UTIL.Stop_Timer;
1016: FII_UTIL.Print_Timer('Updated the batch id for '|| l_count || ' rows in');
1017:
1018: RETURN(l_count);
1019:
1012:
1013:
1014:
1015: FII_UTIL.Stop_Timer;
1016: FII_UTIL.Print_Timer('Updated the batch id for '|| l_count || ' rows in');
1017:
1018: RETURN(l_count);
1019:
1020: EXCEPTION
1076: l_line_2 LINES_MISSING_DATE_2%ROWTYPE;
1077:
1078: BEGIN
1079:
1080: FII_UTIL.Start_Timer;
1081:
1082: IF (g_load_mode = 'INITIAL') THEN
1083:
1084: BIS_COLLECTION_UTILITIES.Put_Line('Begin to retrieve the time boundary for the initial load');
1111: l_max_1 := greatest(l_max_booked_date, nvl(l_max_shipped_date,l_max_booked_date), nvl(l_max_ful_date, l_max_booked_date));
1112: l_min_2 := nvl(l_min_sche_date, l_min_booked_date);
1113: l_max_2 := nvl(l_max_sche_date, l_max_booked_date);
1114:
1115: FII_UTIL.Stop_Timer;
1116: FII_UTIL.Print_Timer('Retrieved the time boundary in ');
1117:
1118:
1119: FII_UTIL.Start_Timer;
1112: l_min_2 := nvl(l_min_sche_date, l_min_booked_date);
1113: l_max_2 := nvl(l_max_sche_date, l_max_booked_date);
1114:
1115: FII_UTIL.Stop_Timer;
1116: FII_UTIL.Print_Timer('Retrieved the time boundary in ');
1117:
1118:
1119: FII_UTIL.Start_Timer;
1120:
1115: FII_UTIL.Stop_Timer;
1116: FII_UTIL.Print_Timer('Retrieved the time boundary in ');
1117:
1118:
1119: FII_UTIL.Start_Timer;
1120:
1121: BIS_COLLECTION_UTILITIES.Put_Line_Out(' ');
1122: BIS_COLLECTION_UTILITIES.Put_Line_Out(' ');
1123: FII_TIME_API.check_missing_date(l_min_1, l_max_1, l_is_missing);
1214: BIS_COLLECTION_UTILITIES.Put_Line(' THERE IS NO DANGLING TIME ATTRIBUTES ');
1215: BIS_COLLECTION_UTILITIES.Put_Line('+---------------------------------------------------------------------------+');
1216: BIS_COLLECTION_UTILITIES.Put_Line(' ');
1217:
1218: FII_UTIL.Stop_Timer;
1219: FII_UTIL.Print_Timer('Completed time continuity check in');
1220:
1221: RETURN(1);
1222: end if;
1215: BIS_COLLECTION_UTILITIES.Put_Line('+---------------------------------------------------------------------------+');
1216: BIS_COLLECTION_UTILITIES.Put_Line(' ');
1217:
1218: FII_UTIL.Stop_Timer;
1219: FII_UTIL.Print_Timer('Completed time continuity check in');
1220:
1221: RETURN(1);
1222: end if;
1223:
1536: -- ----------------------------------------------------------
1537:
1538: BIS_COLLECTION_UTILITIES.put_line(' ');
1539: BIS_COLLECTION_UTILITIES.put_line('Identifying the missing currency conversion rates');
1540: FII_UTIL.Start_Timer;
1541:
1542:
1543: l_miss_conv := REPORT_MISSING_RATE;
1544:
1541:
1542:
1543: l_miss_conv := REPORT_MISSING_RATE;
1544:
1545: FII_UTIL.Stop_Timer;
1546: FII_UTIL.Print_Timer('Completed missing currency check in');
1547:
1548: IF (l_miss_conv = -1) THEN
1549: return(-1);
1542:
1543: l_miss_conv := REPORT_MISSING_RATE;
1544:
1545: FII_UTIL.Stop_Timer;
1546: FII_UTIL.Print_Timer('Completed missing currency check in');
1547:
1548: IF (l_miss_conv = -1) THEN
1549: return(-1);
1550: ELSIF (l_miss_conv > 0) THEN
1559: -- --------------------------------------------------------------
1560:
1561: BIS_COLLECTION_UTILITIES.put_line(' ');
1562: BIS_COLLECTION_UTILITIES.put_line('Identifying the missing UOM conversion rates');
1563: FII_UTIL.Start_Timer;
1564:
1565: l_miss_uom := REPORT_MISSING_UOM_RATE;
1566:
1567: FII_UTIL.Stop_Timer;
1563: FII_UTIL.Start_Timer;
1564:
1565: l_miss_uom := REPORT_MISSING_UOM_RATE;
1566:
1567: FII_UTIL.Stop_Timer;
1568: FII_UTIL.Print_Timer('Completed missing UOM check in');
1569:
1570: IF (l_miss_uom = -1) THEN
1571: return(-1);
1564:
1565: l_miss_uom := REPORT_MISSING_UOM_RATE;
1566:
1567: FII_UTIL.Stop_Timer;
1568: FII_UTIL.Print_Timer('Completed missing UOM check in');
1569:
1570: IF (l_miss_uom = -1) THEN
1571: return(-1);
1572: ELSIF (l_miss_uom > 0) THEN
1600:
1601: BIS_COLLECTION_UTILITIES.put_line(' ');
1602: BIS_COLLECTION_UTILITIES.put_line('Identifying the dangling items');
1603:
1604: FII_UTIL.Start_Timer;
1605:
1606: l_item_count := IDENTIFY_DANGLING_ITEM;
1607:
1608: FII_UTIL.Stop_Timer;
1604: FII_UTIL.Start_Timer;
1605:
1606: l_item_count := IDENTIFY_DANGLING_ITEM;
1607:
1608: FII_UTIL.Stop_Timer;
1609: FII_UTIL.Print_Timer('Identified '||l_item_count||' dangling items in');
1610:
1611: IF (l_item_count = -1)
1612: THEN return(-1);
1605:
1606: l_item_count := IDENTIFY_DANGLING_ITEM;
1607:
1608: FII_UTIL.Stop_Timer;
1609: FII_UTIL.Print_Timer('Identified '||l_item_count||' dangling items in');
1610:
1611: IF (l_item_count = -1)
1612: THEN return(-1);
1613: ELSIF (l_item_count > 0) THEN
1879: l_date := to_date('01/01/0001','DD/MM/YYYY');
1880:
1881: FOR v_batch_id IN 1..p_batch
1882: LOOP
1883: FII_UTIL.Start_Timer;
1884: BIS_COLLECTION_UTILITIES.put_line('Merging batch '||v_batch_id);
1885:
1886: l_count := 0;
1887:
2274:
2275: l_count := sql%rowcount;
2276: l_total := l_total + l_count;
2277: COMMIT;
2278: FII_UTIL.Stop_Timer;
2279: FII_UTIL.Print_Timer('Merged '||l_count|| ' rows in ');
2280:
2281: END LOOP;
2282:
2275: l_count := sql%rowcount;
2276: l_total := l_total + l_count;
2277: COMMIT;
2278: FII_UTIL.Stop_Timer;
2279: FII_UTIL.Print_Timer('Merged '||l_count|| ' rows in ');
2280:
2281: END LOOP;
2282:
2283: RETURN(l_total);
2299: -- ------------------------
2300:
2301: BIS_COLLECTION_UTILITIES.put_line(' ');
2302: BIS_COLLECTION_UTILITIES.put_line('Truncating the temp table');
2303: FII_UTIL.Start_Timer;
2304:
2305: IF (truncate_table('ISC_DBI_CHANGE_LOG') = -1) THEN
2306: return(-1);
2307: END IF;
2317: IF (truncate_table('ISC_SERVICE_BOOK_SUM2') = -1) THEN
2318: return(-1);
2319: END IF;
2320:
2321: FII_UTIL.Stop_Timer;
2322: FII_UTIL.Print_Timer('Truncated the temp table in');
2323:
2324: -- ----------------------------------------------
2325: -- No exception raised so far. Successful. Call
2318: return(-1);
2319: END IF;
2320:
2321: FII_UTIL.Stop_Timer;
2322: FII_UTIL.Print_Timer('Truncated the temp table in');
2323:
2324: -- ----------------------------------------------
2325: -- No exception raised so far. Successful. Call
2326: -- Wrapup to commit and insert messages into logs
2411:
2412: -- Fix bug 4150188
2413: BIS_COLLECTION_UTILITIES.put_line(' ');
2414: BIS_COLLECTION_UTILITIES.put_line('Truncating the fact table');
2415: FII_UTIL.Start_Timer;
2416:
2417: IF (truncate_table('ISC_BOOK_SUM2_F') = -1) THEN
2418: RAISE l_failure;
2419: END IF;
2417: IF (truncate_table('ISC_BOOK_SUM2_F') = -1) THEN
2418: RAISE l_failure;
2419: END IF;
2420:
2421: FII_UTIL.Stop_Timer;
2422: FII_UTIL.Print_Timer('Truncated the fact table in');
2423:
2424: g_row_count := 0;
2425:
2418: RAISE l_failure;
2419: END IF;
2420:
2421: FII_UTIL.Stop_Timer;
2422: FII_UTIL.Print_Timer('Truncated the fact table in');
2423:
2424: g_row_count := 0;
2425:
2426: ELSE
2429: -- --------------
2430:
2431: BIS_COLLECTION_UTILITIES.Put_Line(' ');
2432: BIS_COLLECTION_UTILITIES.Put_Line('Analyzing table ISC_TMP_BOOK_SUM2');
2433: FII_UTIL.Start_Timer;
2434:
2435: IF (FND_INSTALLATION.GET_APP_INFO('ISC', l_status, l_industry, l_schema)) THEN
2436: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
2437: TABNAME => 'ISC_TMP_BOOK_SUM2');
2440: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
2441: TABNAME => 'ISC_SERVICE_BOOK_SUM2');
2442: END IF;
2443:
2444: FII_UTIL.Stop_Timer;
2445: FII_UTIL.Print_Timer('Analyzed the temp tables in ');
2446:
2447:
2448:
2441: TABNAME => 'ISC_SERVICE_BOOK_SUM2');
2442: END IF;
2443:
2444: FII_UTIL.Stop_Timer;
2445: FII_UTIL.Print_Timer('Analyzed the temp tables in ');
2446:
2447:
2448:
2449: -- In DBI5.0, we determine if a PTO/KIT top model is shippable by scanning through all it's child lines
2450: -- For DBI6.0, we do not support this logic anymore, so comment it out to improve performance
2451:
2452: -- BIS_COLLECTION_UTILITIES.Put_Line(' ');
2453: -- BIS_COLLECTION_UTILITIES.Put_Line('Identifying non-shippable CTO lines');
2454: -- FII_UTIL.Start_Timer;
2455:
2456: -- UPDATE /*+ PARALLEL(F) */ isc_tmp_book_sum2 F
2457: -- SET view_type = 2
2458: -- WHERE view_type = 3
2462: -- where l.shippable_flag = 'Y'
2463: -- and top_model_line_id is not null);
2464: -- COMMIT;
2465:
2466: -- FII_UTIL.Stop_Timer;
2467: -- FII_UTIL.Print_Timer('Identified non-shippable CTO lines in ');
2468:
2469:
2470: IF (DANGLING_CHECK = -1) THEN
2463: -- and top_model_line_id is not null);
2464: -- COMMIT;
2465:
2466: -- FII_UTIL.Stop_Timer;
2467: -- FII_UTIL.Print_Timer('Identified non-shippable CTO lines in ');
2468:
2469:
2470: IF (DANGLING_CHECK = -1) THEN
2471: RAISE l_failure;
2477: -- --------------------------------------------
2478:
2479: BIS_COLLECTION_UTILITIES.put_line(' ');
2480: BIS_COLLECTION_UTILITIES.put_line('Truncating the fact table');
2481: FII_UTIL.Start_Timer;
2482:
2483: IF (truncate_table('ISC_BOOK_SUM2_F') = -1) THEN
2484: RAISE l_failure;
2485: END IF;
2483: IF (truncate_table('ISC_BOOK_SUM2_F') = -1) THEN
2484: RAISE l_failure;
2485: END IF;
2486:
2487: FII_UTIL.Stop_Timer;
2488: FII_UTIL.Print_Timer('Truncated the fact table in');
2489:
2490: -- --------------------------------------------
2491: -- Insert data into Sum2 table
2484: RAISE l_failure;
2485: END IF;
2486:
2487: FII_UTIL.Stop_Timer;
2488: FII_UTIL.Print_Timer('Truncated the fact table in');
2489:
2490: -- --------------------------------------------
2491: -- Insert data into Sum2 table
2492: -- --------------------------------------------
2492: -- --------------------------------------------
2493:
2494: BIS_COLLECTION_UTILITIES.put_line(' ');
2495: BIS_COLLECTION_UTILITIES.put_line('Inserting data into fact table');
2496: FII_UTIL.Start_Timer;
2497:
2498: g_row_count := Insert_fact;
2499:
2500: FII_UTIL.Stop_Timer;
2496: FII_UTIL.Start_Timer;
2497:
2498: g_row_count := Insert_fact;
2499:
2500: FII_UTIL.Stop_Timer;
2501: FII_UTIL.Print_Timer('Inserted '||nvl(g_row_count,0)||' rows into the fact table in');
2502:
2503: IF (g_row_count = -1) THEN
2504: RAISE l_failure;
2497:
2498: g_row_count := Insert_fact;
2499:
2500: FII_UTIL.Stop_Timer;
2501: FII_UTIL.Print_Timer('Inserted '||nvl(g_row_count,0)||' rows into the fact table in');
2502:
2503: IF (g_row_count = -1) THEN
2504: RAISE l_failure;
2505: END IF;
2609: -- --------------
2610:
2611: BIS_COLLECTION_UTILITIES.Put_Line(' ');
2612: BIS_COLLECTION_UTILITIES.Put_Line('Analyzing table ISC_TMP_BOOK_SUM2');
2613: FII_UTIL.Start_Timer;
2614:
2615: IF (FND_INSTALLATION.GET_APP_INFO('ISC', l_status, l_industry, l_schema)) THEN
2616: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
2617: TABNAME => 'ISC_TMP_BOOK_SUM2');
2620: FND_STATS.GATHER_TABLE_STATS(OWNNAME => l_schema,
2621: TABNAME => 'ISC_SERVICE_BOOK_SUM2');
2622: END IF;
2623:
2624: FII_UTIL.Stop_Timer;
2625: FII_UTIL.Print_Timer('Analyzed the temp tables in ');
2626:
2627:
2628:
2621: TABNAME => 'ISC_SERVICE_BOOK_SUM2');
2622: END IF;
2623:
2624: FII_UTIL.Stop_Timer;
2625: FII_UTIL.Print_Timer('Analyzed the temp tables in ');
2626:
2627:
2628:
2629:
2631: -- For DBI6.0, we do not support this logic anymore, so comment it out to improve performance
2632:
2633: -- BIS_COLLECTION_UTILITIES.Put_Line(' ');
2634: -- BIS_COLLECTION_UTILITIES.Put_Line('Identifying non-shippable CTO lines');
2635: -- FII_UTIL.Start_Timer;
2636:
2637: -- UPDATE /*+ PARALLEL(F) */ isc_tmp_book_sum2 F
2638: -- SET view_type = 2
2639: -- WHERE view_type = 3
2644: -- and top_model_line_id is not null);
2645:
2646: -- COMMIT;
2647:
2648: -- FII_UTIL.Stop_Timer;
2649: -- FII_UTIL.Print_Timer('Identified non-shippable CTO lines in ');
2650:
2651:
2652:
2645:
2646: -- COMMIT;
2647:
2648: -- FII_UTIL.Stop_Timer;
2649: -- FII_UTIL.Print_Timer('Identified non-shippable CTO lines in ');
2650:
2651:
2652:
2653:
2746: -- Delete rows from ONT_DBI_CHANGE_LOG base on rowid
2747: -- -------------------------------------------------
2748:
2749: BIS_COLLECTION_UTILITIES.put_line('Deleting rows from OM log table');
2750: FII_UTIL.Start_Timer;
2751:
2752:
2753: DELETE FROM ONT_DBI_CHANGE_LOG
2754: WHERE rowid IN (select log_rowid from isc_dbi_change_log)
2753: DELETE FROM ONT_DBI_CHANGE_LOG
2754: WHERE rowid IN (select log_rowid from isc_dbi_change_log)
2755: AND last_update_date < g_incre_start_date;
2756:
2757: FII_UTIL.Stop_Timer;
2758: FII_UTIL.Print_Timer('Deleted ' || sql%rowcount || ' rows from OM log table in');
2759: COMMIT;
2760:
2761:
2754: WHERE rowid IN (select log_rowid from isc_dbi_change_log)
2755: AND last_update_date < g_incre_start_date;
2756:
2757: FII_UTIL.Stop_Timer;
2758: FII_UTIL.Print_Timer('Deleted ' || sql%rowcount || ' rows from OM log table in');
2759: COMMIT;
2760:
2761:
2762: IF (WRAPUP = -1) THEN
2828: END IF;
2829:
2830:
2831: BIS_COLLECTION_UTILITIES.put_line('Truncating the sales fact table');
2832: FII_UTIL.Start_Timer;
2833:
2834: IF (truncate_table('ISC_SALES_CREDITS_F') = -1) THEN
2835: RAISE l_failure;
2836: END IF;
2834: IF (truncate_table('ISC_SALES_CREDITS_F') = -1) THEN
2835: RAISE l_failure;
2836: END IF;
2837:
2838: FII_UTIL.Stop_Timer;
2839: FII_UTIL.Print_Timer('Truncated the sales fact table in');
2840:
2841:
2842: /* Insert into ISC_SALES_CREDITS_F */
2835: RAISE l_failure;
2836: END IF;
2837:
2838: FII_UTIL.Stop_Timer;
2839: FII_UTIL.Print_Timer('Truncated the sales fact table in');
2840:
2841:
2842: /* Insert into ISC_SALES_CREDITS_F */
2843: BIS_COLLECTION_UTILITIES.put_line(' ');
2841:
2842: /* Insert into ISC_SALES_CREDITS_F */
2843: BIS_COLLECTION_UTILITIES.put_line(' ');
2844: BIS_COLLECTION_UTILITIES.put_line('Inserting data into sales fact table');
2845: FII_UTIL.Start_Timer;
2846:
2847: insert /*+ append parallel(f) */ into isc_sales_credits_f f
2848: with s as (
2849: select /*+ ordered use_hash(sc) parallel(sc) parallel(sr)
2937: and s.org_id = t11.org_ou_id
2938: and s.header_id = t11.header_id))
2939: where low_rnk = 1;
2940:
2941: FII_UTIL.Stop_Timer;
2942: g_row_count := sql%rowcount;
2943: FII_UTIL.Print_Timer('Inserted '||g_row_count||' rows into the sales fact table in');
2944: COMMIT;
2945:
2939: where low_rnk = 1;
2940:
2941: FII_UTIL.Stop_Timer;
2942: g_row_count := sql%rowcount;
2943: FII_UTIL.Print_Timer('Inserted '||g_row_count||' rows into the sales fact table in');
2944: COMMIT;
2945:
2946: -- ----------------------------------------------
2947: -- No exception raised so far. Successful. Call