[Home] [Help]
794:
795: BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from the base summary');
796: FII_UTIL.Start_Timer;
797:
798: DELETE /*+ index(a, ISC_DBI_DEL_LEGS_F_U1) */ FROM isc_dbi_del_legs_f a
799: WHERE delivery_leg_id IN (SELECT /*+ index(idl,ISC_DBI_DEL_LEGS_F_U1) use_nl( log, idl)*/ idl.delivery_leg_id
800: FROM isc_dbi_tmp_wts_log log,
801: isc_dbi_del_legs_f idl
802: WHERE (log.stop_id = idl.pick_up_stop_id or log.stop_id = idl.drop_off_stop_id)
795: BIS_COLLECTION_UTILITIES.put_line('Deleting obsolete records from the base summary');
796: FII_UTIL.Start_Timer;
797:
798: DELETE /*+ index(a, ISC_DBI_DEL_LEGS_F_U1) */ FROM isc_dbi_del_legs_f a
799: WHERE delivery_leg_id IN (SELECT /*+ index(idl,ISC_DBI_DEL_LEGS_F_U1) use_nl( log, idl)*/ idl.delivery_leg_id
800: FROM isc_dbi_tmp_wts_log log,
801: isc_dbi_del_legs_f idl
802: WHERE (log.stop_id = idl.pick_up_stop_id or log.stop_id = idl.drop_off_stop_id)
803: AND NOT EXISTS (select '1' from wsh_delivery_legs wdl where wdl.delivery_leg_id = idl.delivery_leg_id));
797:
798: DELETE /*+ index(a, ISC_DBI_DEL_LEGS_F_U1) */ FROM isc_dbi_del_legs_f a
799: WHERE delivery_leg_id IN (SELECT /*+ index(idl,ISC_DBI_DEL_LEGS_F_U1) use_nl( log, idl)*/ idl.delivery_leg_id
800: FROM isc_dbi_tmp_wts_log log,
801: isc_dbi_del_legs_f idl
802: WHERE (log.stop_id = idl.pick_up_stop_id or log.stop_id = idl.drop_off_stop_id)
803: AND NOT EXISTS (select '1' from wsh_delivery_legs wdl where wdl.delivery_leg_id = idl.delivery_leg_id));
804:
805: FII_UTIL.Stop_Timer;
1109: gsb.currency_code WH_CURRENCY_CODE
1110: FROM (select distinct invoice_header_id from isc_dbi_tmp_fih_log) log,
1111: fte_invoice_headers fih,
1112: wsh_document_instances wdi,
1113: isc_dbi_del_legs_f idl,
1114: ar_system_parameters_all aspa,
1115: gl_sets_of_books gsb
1116: WHERE log.invoice_header_id = fih.invoice_header_id
1117: AND fih.mode_of_transport = 'LTL'
2210: FII_UTIL.Stop_Timer;
2211: FII_UTIL.Print_Timer('Inserted '|| l_detail_count ||' rows into isc_dbi_del_details_f in');
2212:
2213: BIS_COLLECTION_UTILITIES.put_line(' ');
2214: BIS_COLLECTION_UTILITIES.put_line('Inserting data into isc_dbi_del_legs_f');
2215: FII_UTIL.Start_Timer;
2216:
2217: INSERT /*+ APPEND PARALLEL(F) */ INTO ISC_DBI_DEL_LEGS_F F
2218: (DELIVERY_LEG_ID,
2213: BIS_COLLECTION_UTILITIES.put_line(' ');
2214: BIS_COLLECTION_UTILITIES.put_line('Inserting data into isc_dbi_del_legs_f');
2215: FII_UTIL.Start_Timer;
2216:
2217: INSERT /*+ APPEND PARALLEL(F) */ INTO ISC_DBI_DEL_LEGS_F F
2218: (DELIVERY_LEG_ID,
2219: CARRIER_ID,
2220: SHIPMENT_DIRECTION,
2221: MODE_OF_TRANSPORT,
2295: AND v.conversion_type_code = curr.conversion_type_code(+);
2296:
2297: l_leg_count := sql%rowcount;
2298: FII_UTIL.Stop_Timer;
2299: FII_UTIL.Print_Timer('Inserted '|| l_leg_count ||' rows into isc_dbi_del_legs_f in');
2300:
2301: BIS_COLLECTION_UTILITIES.put_line(' ');
2302: BIS_COLLECTION_UTILITIES.put_line('Inserting data into isc_dbi_trip_stops_f');
2303: FII_UTIL.Start_Timer;
2621: BIS_COLLECTION_UTILITIES.put_line('Merging batch '||v_batch_id);
2622:
2623: l_count := 0;
2624:
2625: MERGE INTO ISC_DBI_DEL_LEGS_F f
2626: USING
2627: (select new.*
2628: from (select tmp.delivery_leg_id DELIVERY_LEG_ID,
2629: tmp.carrier_id CARRIER_ID,
2661: and tmp.trx_currency_code = curr.trx_currency_code(+)
2662: and tmp.wh_currency_code = curr.wh_currency_code(+)
2663: and tmp.conversion_date = curr.conversion_date(+)
2664: and tmp.conversion_type_code = curr.conversion_type_code(+)
2665: and tmp.batch_id = v_batch_id) new, isc_dbi_del_legs_f old
2666: where new.delivery_leg_id = old.delivery_leg_id(+)
2667: and (old.delivery_leg_id is null
2668: or new.carrier_id <> old.carrier_id
2669: or new.shipment_direction <> old.shipment_direction
3218: BIS_COLLECTION_UTILITIES.put_line('Truncating the fact tables');
3219: FII_UTIL.Start_Timer;
3220:
3221: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_DEL_DETAILS_F';
3222: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_DEL_LEGS_F';
3223: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_TRIP_STOPS_F';
3224: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_FTE_INVOICES_F';
3225: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_FTE_PARAMETERS';
3226:
3266: BIS_COLLECTION_UTILITIES.put_line('Truncating the fact tables');
3267: FII_UTIL.Start_Timer;
3268:
3269: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_DEL_DETAILS_F';
3270: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_DEL_LEGS_F';
3271: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_TRIP_STOPS_F';
3272: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_FTE_INVOICES_F';
3273: EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || g_isc_schema ||'.ISC_DBI_FTE_PARAMETERS';
3274: