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
71: FROM isc_sales_credits_f fact,
72: isc_tmp_book_sum2 tmp
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;
82: INSERT INTO isc_tmp_book_sum2 (pk1)
83: SELECT f.line_id
84: FROM isc_book_sum2_f f
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
86: FROM isc_sales_credits_f fact
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:
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 --
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:
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;
122: FII_UTIL.Print_Timer('Deleted '||sql%rowcount||' rows from ISC_SALES_CREDITS_F in');
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');
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');
127: FII_UTIL.Start_Timer;
128:
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)
132: pq_distribute(sr,hash,hash) */
133: sc.sales_credit_id, sc.percent, sc.sales_credit_type_id,
2704: WHERE object_name IN (SELECT distinct bis.object_name
2705: FROM BIS_OBJ_DEPENDENCY bis,
2706: (SELECT object_name
2707: FROM bis_obj_dependency
2708: START WITH depend_object_name = 'ISC_SALES_CREDITS_F'
2709: CONNECT BY PRIOR object_name = depend_object_name
2710: ORDER BY 1) inline
2711: WHERE bis.object_name = inline.object_name
2712: AND bis.object_type = 'PAGE'));
2821: BEGIN
2822:
2823: BIS_COLLECTION_UTILITIES.put_line(' ');
2824:
2825: IF (NOT BIS_COLLECTION_UTILITIES.setup('ISC_SALES_CREDITS_F')) THEN
2826: RAISE_APPLICATION_ERROR (-20000,'Error in SETUP: ' || errbuf);
2827: return;
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;
2837:
2838: FII_UTIL.Stop_Timer;
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(' ');
2844: BIS_COLLECTION_UTILITIES.put_line('Inserting data into sales fact table');
2845: FII_UTIL.Start_Timer;
2846:
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)
2850: pq_distribute(sr,hash,hash) */
2851: sc.sales_credit_id, sc.percent, sc.sales_credit_type_id,