34: -- Set default directory in case if the profile option
35: -- BIS_DEBUG_LOG_DIRECTORY is not set up
36: ------------------------------------------------------
37: if l_dir is NULL then
38: l_dir := FII_UTIL.get_utl_file_dir;
39: end if;
40:
41: ----------------------------------------------------------------
42: -- FII_UTIL.initialize will get profile options FII_DEBUG_MODE
38: l_dir := FII_UTIL.get_utl_file_dir;
39: end if;
40:
41: ----------------------------------------------------------------
42: -- FII_UTIL.initialize will get profile options FII_DEBUG_MODE
43: -- and BIS_DEBUG_LOG_DIRECTORY and set up the directory where
44: -- the log files and output files are written to
45: ----------------------------------------------------------------
46: FII_UTIL.initialize('FII_AR_CUSTOMER_DIMENSION_PKG.log',
42: -- FII_UTIL.initialize will get profile options FII_DEBUG_MODE
43: -- and BIS_DEBUG_LOG_DIRECTORY and set up the directory where
44: -- the log files and output files are written to
45: ----------------------------------------------------------------
46: FII_UTIL.initialize('FII_AR_CUSTOMER_DIMENSION_PKG.log',
47: 'FII_AR_CUSTOMER_DIMENSION_PKG.out', l_dir,
48: 'FII_AR_CUSTOMER_DIMENSION_PKG');
49:
50:
48: 'FII_AR_CUSTOMER_DIMENSION_PKG');
49:
50:
51: --Obtain FII schema name.
52: g_schema_name := FII_UTIL.get_schema_name ('FII');
53:
54: --Obtain user ID, login ID and initialize package variables.
55: g_fii_user_id := FND_GLOBAL.USER_ID;
56: g_fii_login_id := FND_GLOBAL.LOGIN_ID;
60: RAISE G_LOGIN_INFO_NOT_AVABLE;
61: END IF;
62:
63: if g_debug_flag = 'Y' then
64: FII_UTIL.put_line('User ID: ' || g_fii_user_id || ' Login ID: ' || g_fii_login_id);
65: end if;
66:
67:
68: EXCEPTION
69: WHEN G_LOGIN_INFO_NOT_AVABLE THEN
70: g_errbuf := 'Can not get User ID and Login ID, program exit';
71: RAISE;
72: WHEN OTHERS THEN
73: FII_UTIL.put_line('Unexpected error when calling Initialize.');
74: g_errbuf := 'Error Message: '|| substr(sqlerrm,1,180);
75: RAISE;
76:
77: END INITIALIZE;
90: BEGIN
91:
92: g_state := 'Inside the INIT_LOAD procedure.';
93: if g_debug_flag = 'Y' then
94: FII_UTIL.put_line(g_state);
95: end if;
96:
97: g_state := 'Calling BIS_COLLECTION_UTILITIES.setup';
98: IF(NOT BIS_COLLECTION_UTILITIES.setup('FII_AR_CUST_DIM_INIT')) THEN
101: END IF;
102:
103: g_state := 'Calling the INITIALIZE procedure to initialize global variables.';
104: if g_debug_flag = 'Y' then
105: FII_UTIL.put_line(g_state);
106: end if;
107:
108:
109: INITIALIZE;
110:
111:
112: g_state := 'Truncating customer dimension tables.';
113: if g_debug_flag = 'Y' then
114: FII_UTIL.put_line(g_state);
115: end if;
116:
117: --Truncate customer dimension tables.
118: FII_UTIL.truncate_table('FII_CUSTOMER_HIERARCHIES', 'FII', g_retcode);
114: FII_UTIL.put_line(g_state);
115: end if;
116:
117: --Truncate customer dimension tables.
118: FII_UTIL.truncate_table('FII_CUSTOMER_HIERARCHIES', 'FII', g_retcode);
119: FII_UTIL.truncate_table('FII_CUST_ACCOUNTS', 'FII', g_retcode);
120:
121:
122: g_state := 'Inserting dummy record.';
115: end if;
116:
117: --Truncate customer dimension tables.
118: FII_UTIL.truncate_table('FII_CUSTOMER_HIERARCHIES', 'FII', g_retcode);
119: FII_UTIL.truncate_table('FII_CUST_ACCOUNTS', 'FII', g_retcode);
120:
121:
122: g_state := 'Inserting dummy record.';
123: if g_debug_flag = 'Y' then
120:
121:
122: g_state := 'Inserting dummy record.';
123: if g_debug_flag = 'Y' then
124: FII_UTIL.put_line(g_state);
125: end if;
126:
127: --Insert dummy record required by the MVs.
128: INSERT INTO FII_Customer_Hierarchies (
157:
158: --Store the current maximum batch party id to be used in incremental loads.
159: g_state := 'Storing the current maximum batch party id.';
160: if g_debug_flag = 'Y' then
161: FII_UTIL.put_line(g_state);
162: end if;
163:
164: SELECT nvl(MAX(Batch_Party_ID), -1) INTO l_max_batch_party_id
165: FROM HZ_Merge_Party_History;
183: IF g_hierarchy_type IS NOT NULL THEN
184:
185: g_state := 'Populating intermediate tables FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.';
186: if g_debug_flag = 'Y' then
187: FII_UTIL.put_line(g_state);
188: FII_UTIL.start_timer;
189: end if;
190:
191: /* With one scan of HZ_Hierarchy_Nodes, this sql populates 2 intermediate
184:
185: g_state := 'Populating intermediate tables FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.';
186: if g_debug_flag = 'Y' then
187: FII_UTIL.put_line(g_state);
188: FII_UTIL.start_timer;
189: end if;
190:
191: /* With one scan of HZ_Hierarchy_Nodes, this sql populates 2 intermediate
192: tables to be used later:
228: (Level_Number = 0 AND (Top_Parent_Flag = 'Y' OR Leaf_Child_Flag = 'Y')) )
229: AND g_sysdate BETWEEN Effective_Start_Date AND Effective_End_Date;
230:
231: if g_debug_flag = 'Y' then
232: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT');
233: FII_UTIL.stop_timer;
234: FII_UTIL.print_timer('Duration');
235: end if;
236:
229: AND g_sysdate BETWEEN Effective_Start_Date AND Effective_End_Date;
230:
231: if g_debug_flag = 'Y' then
232: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT');
233: FII_UTIL.stop_timer;
234: FII_UTIL.print_timer('Duration');
235: end if;
236:
237: g_state := 'Populating FII_Customer_Hierarchies with hierarchical parties.';
230:
231: if g_debug_flag = 'Y' then
232: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT');
233: FII_UTIL.stop_timer;
234: FII_UTIL.print_timer('Duration');
235: end if;
236:
237: g_state := 'Populating FII_Customer_Hierarchies with hierarchical parties.';
238: if g_debug_flag = 'Y' then
235: end if;
236:
237: g_state := 'Populating FII_Customer_Hierarchies with hierarchical parties.';
238: if g_debug_flag = 'Y' then
239: FII_UTIL.put_line(g_state);
240: FII_UTIL.start_timer;
241: end if;
242:
243: INSERT INTO FII_Customer_Hierarchies(
236:
237: g_state := 'Populating FII_Customer_Hierarchies with hierarchical parties.';
238: if g_debug_flag = 'Y' then
239: FII_UTIL.put_line(g_state);
240: FII_UTIL.start_timer;
241: end if;
242:
243: INSERT INTO FII_Customer_Hierarchies(
244: Parent_Party_ID,
278: AND g_sysdate BETWEEN HN.Effective_Start_Date AND HN.Effective_End_Date
279: AND PTN.Next_ID = Leaf.Leaf_Node_ID (+);
280:
281: if g_debug_flag = 'Y' then
282: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies');
283: FII_UTIL.stop_timer;
284: FII_UTIL.print_timer('Duration');
285: end if;
286:
279: AND PTN.Next_ID = Leaf.Leaf_Node_ID (+);
280:
281: if g_debug_flag = 'Y' then
282: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies');
283: FII_UTIL.stop_timer;
284: FII_UTIL.print_timer('Duration');
285: end if;
286:
287: END IF; --IF g_hierarchy_type IS NOT NULL
280:
281: if g_debug_flag = 'Y' then
282: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies');
283: FII_UTIL.stop_timer;
284: FII_UTIL.print_timer('Duration');
285: end if;
286:
287: END IF; --IF g_hierarchy_type IS NOT NULL
288:
288:
289: --Store the current maximum customer account id to be used in incremental loads.
290: g_state := 'Storing the current maximum customer account id.';
291: if g_debug_flag = 'Y' then
292: FII_UTIL.put_line(g_state);
293: end if;
294:
295: SELECT nvl(MAX(Cust_Account_ID),-1) INTO l_max_cust_account_id
296: FROM HZ_Cust_Accounts;
311: --2. Populate FII_Cust_Accounts with hierarchical and non-hierarchical customers.
312:
313: g_state := 'Populating FII_Customer_Hierarchies with non-hierarchical customers and FII_Cust_Accounts with all customers.';
314: if g_debug_flag = 'Y' then
315: FII_UTIL.put_line(g_state);
316: FII_UTIL.start_timer;
317: end if;
318:
319: INSERT ALL
312:
313: g_state := 'Populating FII_Customer_Hierarchies with non-hierarchical customers and FII_Cust_Accounts with all customers.';
314: if g_debug_flag = 'Y' then
315: FII_UTIL.put_line(g_state);
316: FII_UTIL.start_timer;
317: end if;
318:
319: INSERT ALL
320: WHEN (Parent_Party_ID IS NOT NULL AND Parent_Party_ID <> -999)
421: WHERE CA.Party_ID = Hier.Child_Party_ID (+)
422: AND CA.Cust_Account_ID <= l_max_cust_account_id;
423:
424: if g_debug_flag = 'Y' then
425: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies');
426: FII_UTIL.stop_timer;
427: FII_UTIL.print_timer('Duration');
428: end if;
429:
422: AND CA.Cust_Account_ID <= l_max_cust_account_id;
423:
424: if g_debug_flag = 'Y' then
425: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies');
426: FII_UTIL.stop_timer;
427: FII_UTIL.print_timer('Duration');
428: end if;
429:
430:
423:
424: if g_debug_flag = 'Y' then
425: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies');
426: FII_UTIL.stop_timer;
427: FII_UTIL.print_timer('Duration');
428: end if;
429:
430:
431: g_state := 'Calling BIS_COLLECTION_UTILITIES.wrapup';
440: g_retcode := -1;
441: retcode := g_retcode;
442:
443: g_exception_msg := g_retcode || ':' || sqlerrm;
444: FII_UTIL.put_line('Error occured while ' || g_state);
445: FII_UTIL.put_line(g_exception_msg);
446:
447:
448: END INIT_LOAD;
441: retcode := g_retcode;
442:
443: g_exception_msg := g_retcode || ':' || sqlerrm;
444: FII_UTIL.put_line('Error occured while ' || g_state);
445: FII_UTIL.put_line(g_exception_msg);
446:
447:
448: END INIT_LOAD;
449:
516: BEGIN
517:
518: g_state := 'Inside the INCRE_UPDATE procedure.';
519: if g_debug_flag = 'Y' then
520: FII_UTIL.put_line(g_state);
521: end if;
522:
523: g_state := 'Calling BIS API to get last refresh dates.';
524: if g_debug_flag = 'Y' then
521: end if;
522:
523: g_state := 'Calling BIS API to get last refresh dates.';
524: if g_debug_flag = 'Y' then
525: FII_UTIL.put_line(g_state);
526: end if;
527:
528: BIS_COLLECTION_UTILITIES.get_last_refresh_dates('FII_AR_CUST_DIM_INIT',
529: l_start_date, l_end_date,
538: g_last_load_date := GREATEST(NVL(l_start_date, BIS_COMMON_PARAMETERS.Get_Global_Start_Date),
539: NVL(l_start_date_temp, BIS_COMMON_PARAMETERS.Get_Global_Start_Date));
540:
541: if g_debug_flag = 'Y' then
542: FII_UTIL.put_line('Incremental load will collect data from ' || to_char(g_last_load_date, 'YYYY/MM/DD HH24:MI:SS') || ' to ' || to_char(g_sysdate, 'YYYY/MM/DD HH24:MI:SS') || '.');
543: end if;
544:
545: g_state := 'Calling BIS_COLLECTION_UTILITIES.setup';
546: IF(NOT BIS_COLLECTION_UTILITIES.setup('FII_AR_CUST_DIM_INC')) THEN
549: END IF;
550:
551: g_state := 'Calling the INITIALIZE procedure to initialize global variables.';
552: if g_debug_flag = 'Y' then
553: FII_UTIL.put_line(g_state);
554: end if;
555: INITIALIZE;
556:
557: g_state := 'Storing previous maximum batch party id.';
555: INITIALIZE;
556:
557: g_state := 'Storing previous maximum batch party id.';
558: if g_debug_flag = 'Y' then
559: FII_UTIL.put_line(g_state);
560: end if;
561:
562: SELECT item_value
563: INTO l_prev_max_batch_party_id
565: WHERE log_item = 'MAX_BATCH_PARTY_ID';
566:
567: g_state := 'Storing the current maximum batch party id.';
568: if g_debug_flag = 'Y' then
569: FII_UTIL.put_line(g_state);
570: end if;
571:
572: SELECT nvl(MAX(Batch_Party_ID), -1) INTO l_max_batch_party_id
573: FROM HZ_Merge_Party_History
581: WHERE log_item = 'MAX_BATCH_PARTY_ID';
582:
583: g_state := 'Populate FII_AR_Parties_Delta_GT with parties that have been merged.';
584: if g_debug_flag = 'Y' then
585: FII_UTIL.put_line(g_state);
586: FII_UTIL.start_timer;
587: end if;
588:
589: INSERT ALL
582:
583: g_state := 'Populate FII_AR_Parties_Delta_GT with parties that have been merged.';
584: if g_debug_flag = 'Y' then
585: FII_UTIL.put_line(g_state);
586: FII_UTIL.start_timer;
587: end if;
588:
589: INSERT ALL
590: WHEN (1=1)
601: AND M.batch_party_id <= l_max_batch_party_id
602: AND D.entity_name = 'HZ_PARTIES';
603:
604: if g_debug_flag = 'Y' then
605: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT');
606: FII_UTIL.stop_timer;
607: FII_UTIL.print_timer('Duration');
608: end if;
609:
602: AND D.entity_name = 'HZ_PARTIES';
603:
604: if g_debug_flag = 'Y' then
605: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT');
606: FII_UTIL.stop_timer;
607: FII_UTIL.print_timer('Duration');
608: end if;
609:
610: END IF;
603:
604: if g_debug_flag = 'Y' then
605: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT');
606: FII_UTIL.stop_timer;
607: FII_UTIL.print_timer('Duration');
608: end if;
609:
610: END IF;
611:
612: IF g_hierarchy_type IS NOT NULL THEN
613:
614: g_state := 'Populate FII_AR_Parties_Delta_GT with potentially deleted parties and FII_AR_Parties_Level1_GT with potentially new or updated parent parties.';
615: if g_debug_flag = 'Y' then
616: FII_UTIL.put_line(g_state);
617: FII_UTIL.start_timer;
618: end if;
619:
620: INSERT ALL
613:
614: g_state := 'Populate FII_AR_Parties_Delta_GT with potentially deleted parties and FII_AR_Parties_Level1_GT with potentially new or updated parent parties.';
615: if g_debug_flag = 'Y' then
616: FII_UTIL.put_line(g_state);
617: FII_UTIL.start_timer;
618: end if;
619:
620: INSERT ALL
621: WHEN (Level_Number = 0)
652: OR Effective_Start_Date BETWEEN g_last_load_date AND g_sysdate
653: OR Last_Update_Date BETWEEN g_last_load_date AND g_sysdate);
654:
655: if g_debug_flag = 'Y' then
656: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT and FII_AR_Parties_Level1_GT');
657: FII_UTIL.stop_timer;
658: FII_UTIL.print_timer('Duration');
659: end if;
660:
653: OR Last_Update_Date BETWEEN g_last_load_date AND g_sysdate);
654:
655: if g_debug_flag = 'Y' then
656: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT and FII_AR_Parties_Level1_GT');
657: FII_UTIL.stop_timer;
658: FII_UTIL.print_timer('Duration');
659: end if;
660:
661: g_state := 'Populate FII_AR_Parties_Level2_GT while looping through FII_AR_Parties_Level1_GT.';
654:
655: if g_debug_flag = 'Y' then
656: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT and FII_AR_Parties_Level1_GT');
657: FII_UTIL.stop_timer;
658: FII_UTIL.print_timer('Duration');
659: end if;
660:
661: g_state := 'Populate FII_AR_Parties_Level2_GT while looping through FII_AR_Parties_Level1_GT.';
662: if g_debug_flag = 'Y' then
659: end if;
660:
661: g_state := 'Populate FII_AR_Parties_Level2_GT while looping through FII_AR_Parties_Level1_GT.';
662: if g_debug_flag = 'Y' then
663: FII_UTIL.put_line(g_state);
664: FII_UTIL.start_timer;
665: end if;
666:
667: FOR Party_Record IN Party_Delta
660:
661: g_state := 'Populate FII_AR_Parties_Level2_GT while looping through FII_AR_Parties_Level1_GT.';
662: if g_debug_flag = 'Y' then
663: FII_UTIL.put_line(g_state);
664: FII_UTIL.start_timer;
665: end if;
666:
667: FOR Party_Record IN Party_Delta
668: LOOP
703:
704: END LOOP;
705:
706: if g_debug_flag = 'Y' then
707: FII_UTIL.put_line('Completed population of FII_AR_Parties_Level2_GT.');
708: FII_UTIL.stop_timer;
709: FII_UTIL.print_timer('Duration');
710: end if;
711:
704: END LOOP;
705:
706: if g_debug_flag = 'Y' then
707: FII_UTIL.put_line('Completed population of FII_AR_Parties_Level2_GT.');
708: FII_UTIL.stop_timer;
709: FII_UTIL.print_timer('Duration');
710: end if;
711:
712: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of parties in FII_AR_Parties_Level2_GT.';
705:
706: if g_debug_flag = 'Y' then
707: FII_UTIL.put_line('Completed population of FII_AR_Parties_Level2_GT.');
708: FII_UTIL.stop_timer;
709: FII_UTIL.print_timer('Duration');
710: end if;
711:
712: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of parties in FII_AR_Parties_Level2_GT.';
713: if g_debug_flag = 'Y' then
710: end if;
711:
712: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of parties in FII_AR_Parties_Level2_GT.';
713: if g_debug_flag = 'Y' then
714: FII_UTIL.put_line(g_state);
715: FII_UTIL.start_timer;
716: end if;
717:
718: INSERT INTO FII_AR_Parties_Delta_GT(Party_ID, Type_ID)
711:
712: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of parties in FII_AR_Parties_Level2_GT.';
713: if g_debug_flag = 'Y' then
714: FII_UTIL.put_line(g_state);
715: FII_UTIL.start_timer;
716: end if;
717:
718: INSERT INTO FII_AR_Parties_Delta_GT(Party_ID, Type_ID)
719: SELECT HN.Child_ID, 1
723: AND HN.Hierarchy_Type = g_hierarchy_type
724: AND g_sysdate BETWEEN HN.Effective_Start_Date AND HN.Effective_End_Date;
725:
726: if g_debug_flag = 'Y' then
727: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT.');
728: FII_UTIL.stop_timer;
729: FII_UTIL.print_timer('Duration');
730: end if;
731:
724: AND g_sysdate BETWEEN HN.Effective_Start_Date AND HN.Effective_End_Date;
725:
726: if g_debug_flag = 'Y' then
727: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT.');
728: FII_UTIL.stop_timer;
729: FII_UTIL.print_timer('Duration');
730: end if;
731:
732: g_state := 'Populate FII_AR_Top_To_Source_GT with descendants of parties already in FII_AR_Top_To_Source_GT.';
725:
726: if g_debug_flag = 'Y' then
727: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT.');
728: FII_UTIL.stop_timer;
729: FII_UTIL.print_timer('Duration');
730: end if;
731:
732: g_state := 'Populate FII_AR_Top_To_Source_GT with descendants of parties already in FII_AR_Top_To_Source_GT.';
733: if g_debug_flag = 'Y' then
730: end if;
731:
732: g_state := 'Populate FII_AR_Top_To_Source_GT with descendants of parties already in FII_AR_Top_To_Source_GT.';
733: if g_debug_flag = 'Y' then
734: FII_UTIL.put_line(g_state);
735: FII_UTIL.start_timer;
736: end if;
737:
738: INSERT INTO FII_AR_Top_To_Source_GT(
731:
732: g_state := 'Populate FII_AR_Top_To_Source_GT with descendants of parties already in FII_AR_Top_To_Source_GT.';
733: if g_debug_flag = 'Y' then
734: FII_UTIL.put_line(g_state);
735: FII_UTIL.start_timer;
736: end if;
737:
738: INSERT INTO FII_AR_Top_To_Source_GT(
739: Top_Node_ID,
749: AND g_sysdate BETWEEN HN.Effective_Start_Date AND HN.Effective_End_Date
750: AND HN.Level_Number > 0;
751:
752: if g_debug_flag = 'Y' then
753: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Top_To_Source_GT.');
754: FII_UTIL.stop_timer;
755: FII_UTIL.print_timer('Duration');
756: end if;
757:
750: AND HN.Level_Number > 0;
751:
752: if g_debug_flag = 'Y' then
753: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Top_To_Source_GT.');
754: FII_UTIL.stop_timer;
755: FII_UTIL.print_timer('Duration');
756: end if;
757:
758: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of deleted relationships.';
751:
752: if g_debug_flag = 'Y' then
753: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Top_To_Source_GT.');
754: FII_UTIL.stop_timer;
755: FII_UTIL.print_timer('Duration');
756: end if;
757:
758: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of deleted relationships.';
759: if g_debug_flag = 'Y' then
756: end if;
757:
758: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of deleted relationships.';
759: if g_debug_flag = 'Y' then
760: FII_UTIL.put_line(g_state);
761: FII_UTIL.start_timer;
762: end if;
763:
764: INSERT INTO FII_AR_Parties_Delta_GT(
757:
758: g_state := 'Populate FII_AR_Parties_Delta_GT with descendants of deleted relationships.';
759: if g_debug_flag = 'Y' then
760: FII_UTIL.put_line(g_state);
761: FII_UTIL.start_timer;
762: end if;
763:
764: INSERT INTO FII_AR_Parties_Delta_GT(
765: Party_ID,
776: AND g_sysdate BETWEEN HN.Effective_Start_Date AND HN.Effective_End_Date
777: AND HN.Level_Number > 0;
778:
779: if g_debug_flag = 'Y' then
780: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT.');
781: FII_UTIL.stop_timer;
782: FII_UTIL.print_timer('Duration');
783: end if;
784:
777: AND HN.Level_Number > 0;
778:
779: if g_debug_flag = 'Y' then
780: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT.');
781: FII_UTIL.stop_timer;
782: FII_UTIL.print_timer('Duration');
783: end if;
784:
785:
778:
779: if g_debug_flag = 'Y' then
780: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Parties_Delta_GT.');
781: FII_UTIL.stop_timer;
782: FII_UTIL.print_timer('Duration');
783: end if;
784:
785:
786: g_state := 'Populate FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.';
784:
785:
786: g_state := 'Populate FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.';
787: if g_debug_flag = 'Y' then
788: FII_UTIL.put_line(g_state);
789: FII_UTIL.start_timer;
790: end if;
791:
792: INSERT ALL
785:
786: g_state := 'Populate FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.';
787: if g_debug_flag = 'Y' then
788: FII_UTIL.put_line(g_state);
789: FII_UTIL.start_timer;
790: end if;
791:
792: INSERT ALL
793: WHEN (Leaf_Child_Flag = 'Y')
815: (Level_Number = 0 AND (Top_Parent_Flag = 'Y' OR Leaf_Child_Flag = 'Y')) )
816: AND g_sysdate BETWEEN Effective_Start_Date AND Effective_End_Date;
817:
818: if g_debug_flag = 'Y' then
819: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.');
820: FII_UTIL.stop_timer;
821: FII_UTIL.print_timer('Duration');
822: end if;
823:
816: AND g_sysdate BETWEEN Effective_Start_Date AND Effective_End_Date;
817:
818: if g_debug_flag = 'Y' then
819: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.');
820: FII_UTIL.stop_timer;
821: FII_UTIL.print_timer('Duration');
822: end if;
823:
824: g_state := 'Populate FII_AR_Cust_Hier_Tmp_GT.';
817:
818: if g_debug_flag = 'Y' then
819: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_LNodes_GT and FII_AR_Cust_Rlns_GT.');
820: FII_UTIL.stop_timer;
821: FII_UTIL.print_timer('Duration');
822: end if;
823:
824: g_state := 'Populate FII_AR_Cust_Hier_Tmp_GT.';
825: if g_debug_flag = 'Y' then
822: end if;
823:
824: g_state := 'Populate FII_AR_Cust_Hier_Tmp_GT.';
825: if g_debug_flag = 'Y' then
826: FII_UTIL.put_line(g_state);
827: FII_UTIL.start_timer;
828: end if;
829:
830: INSERT INTO FII_AR_Cust_Hier_Tmp_GT(
823:
824: g_state := 'Populate FII_AR_Cust_Hier_Tmp_GT.';
825: if g_debug_flag = 'Y' then
826: FII_UTIL.put_line(g_state);
827: FII_UTIL.start_timer;
828: end if;
829:
830: INSERT INTO FII_AR_Cust_Hier_Tmp_GT(
831: Parent_Party_ID,
855: AND g_sysdate BETWEEN HN.Effective_Start_Date AND HN.Effective_End_Date
856: AND PTN.Next_ID = Leaf.Leaf_Node_ID (+);
857:
858: if g_debug_flag = 'Y' then
859: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_Hier_Tmp_GT.');
860: FII_UTIL.stop_timer;
861: FII_UTIL.print_timer('Duration');
862: end if;
863:
856: AND PTN.Next_ID = Leaf.Leaf_Node_ID (+);
857:
858: if g_debug_flag = 'Y' then
859: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_Hier_Tmp_GT.');
860: FII_UTIL.stop_timer;
861: FII_UTIL.print_timer('Duration');
862: end if;
863:
864: END IF; --IF g_hierarchy_type IS NOT NULL
857:
858: if g_debug_flag = 'Y' then
859: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_Hier_Tmp_GT.');
860: FII_UTIL.stop_timer;
861: FII_UTIL.print_timer('Duration');
862: end if;
863:
864: END IF; --IF g_hierarchy_type IS NOT NULL
865:
864: END IF; --IF g_hierarchy_type IS NOT NULL
865:
866: g_state := 'Storing previous maximum customer account id.';
867: if g_debug_flag = 'Y' then
868: FII_UTIL.put_line(g_state);
869: end if;
870:
871: SELECT item_value
872: INTO l_prev_max_cust_account_id
874: WHERE log_item = 'MAX_CUST_ACCOUNT_ID';
875:
876: g_state := 'Storing the current maximum customer account id.';
877: if g_debug_flag = 'Y' then
878: FII_UTIL.put_line(g_state);
879: end if;
880:
881: SELECT nvl(MAX(Cust_Account_ID),-1) INTO l_max_cust_account_id
882: FROM HZ_Cust_Accounts
888: WHERE log_item = 'MAX_CUST_ACCOUNT_ID';
889:
890: g_state := 'Populate FII_AR_CAccts_Delta_GT with customer accounts that are new or in an updated hierarchy.';
891: if g_debug_flag = 'Y' then
892: FII_UTIL.put_line(g_state);
893: FII_UTIL.start_timer;
894: end if;
895:
896: INSERT INTO FII_AR_Caccts_Delta_GT(Cust_Account_ID, Party_ID, Account_Number)
889:
890: g_state := 'Populate FII_AR_CAccts_Delta_GT with customer accounts that are new or in an updated hierarchy.';
891: if g_debug_flag = 'Y' then
892: FII_UTIL.put_line(g_state);
893: FII_UTIL.start_timer;
894: end if;
895:
896: INSERT INTO FII_AR_Caccts_Delta_GT(Cust_Account_ID, Party_ID, Account_Number)
897: SELECT Cust_Account_ID, Party_ID, Account_Number
901: OR (Cust_Account_ID > l_prev_max_cust_account_id
902: AND Cust_Account_ID <= l_max_cust_account_id);
903:
904: if g_debug_flag = 'Y' then
905: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_CAccts_Delta_GT.');
906: FII_UTIL.stop_timer;
907: FII_UTIL.print_timer('Duration');
908: end if;
909:
902: AND Cust_Account_ID <= l_max_cust_account_id);
903:
904: if g_debug_flag = 'Y' then
905: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_CAccts_Delta_GT.');
906: FII_UTIL.stop_timer;
907: FII_UTIL.print_timer('Duration');
908: end if;
909:
910: g_state := 'Populating FII_AR_Cust_Hier_Tmp_GT with new non-hierarchical customers and FII_AR_CAccts_Tmp_GT with all new customers.';
903:
904: if g_debug_flag = 'Y' then
905: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_CAccts_Delta_GT.');
906: FII_UTIL.stop_timer;
907: FII_UTIL.print_timer('Duration');
908: end if;
909:
910: g_state := 'Populating FII_AR_Cust_Hier_Tmp_GT with new non-hierarchical customers and FII_AR_CAccts_Tmp_GT with all new customers.';
911: if g_debug_flag = 'Y' then
908: end if;
909:
910: g_state := 'Populating FII_AR_Cust_Hier_Tmp_GT with new non-hierarchical customers and FII_AR_CAccts_Tmp_GT with all new customers.';
911: if g_debug_flag = 'Y' then
912: FII_UTIL.put_line(g_state);
913: FII_UTIL.start_timer;
914: end if;
915:
916: INSERT ALL
909:
910: g_state := 'Populating FII_AR_Cust_Hier_Tmp_GT with new non-hierarchical customers and FII_AR_CAccts_Tmp_GT with all new customers.';
911: if g_debug_flag = 'Y' then
912: FII_UTIL.put_line(g_state);
913: FII_UTIL.start_timer;
914: end if;
915:
916: INSERT ALL
917: WHEN (Parent_Party_ID IS NOT NULL AND Parent_Party_ID <> -999)
980: AND g_sysdate BETWEEN Effective_Start_Date AND Effective_End_Date) Hier
981: WHERE CA.Party_ID = Hier.Child_ID (+);
982:
983: if g_debug_flag = 'Y' then
984: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_Hier_Tmp_GT and FII_AR_CAccts_Tmp_GT.');
985: FII_UTIL.stop_timer;
986: FII_UTIL.print_timer('Duration');
987: end if;
988:
981: WHERE CA.Party_ID = Hier.Child_ID (+);
982:
983: if g_debug_flag = 'Y' then
984: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_Hier_Tmp_GT and FII_AR_CAccts_Tmp_GT.');
985: FII_UTIL.stop_timer;
986: FII_UTIL.print_timer('Duration');
987: end if;
988:
989: g_state := 'Merging records in FII_Customer_Hierarchies using FII_AR_Top_To_Source_GT.';
982:
983: if g_debug_flag = 'Y' then
984: FII_UTIL.put_line('Inserted ' || SQL%ROWCOUNT || ' records into FII_AR_Cust_Hier_Tmp_GT and FII_AR_CAccts_Tmp_GT.');
985: FII_UTIL.stop_timer;
986: FII_UTIL.print_timer('Duration');
987: end if;
988:
989: g_state := 'Merging records in FII_Customer_Hierarchies using FII_AR_Top_To_Source_GT.';
990: if g_debug_flag = 'Y' then
987: end if;
988:
989: g_state := 'Merging records in FII_Customer_Hierarchies using FII_AR_Top_To_Source_GT.';
990: if g_debug_flag = 'Y' then
991: FII_UTIL.put_line(g_state);
992: FII_UTIL.start_timer;
993: end if;
994:
995: MERGE INTO FII_Customer_Hierarchies CH
988:
989: g_state := 'Merging records in FII_Customer_Hierarchies using FII_AR_Top_To_Source_GT.';
990: if g_debug_flag = 'Y' then
991: FII_UTIL.put_line(g_state);
992: FII_UTIL.start_timer;
993: end if;
994:
995: MERGE INTO FII_Customer_Hierarchies CH
996: USING (SELECT DISTINCT Top_Node_ID, Source_Node_ID, Level_Number
1030: g_fii_user_id,
1031: g_fii_login_id);
1032:
1033: if g_debug_flag = 'Y' then
1034: FII_UTIL.put_line('Merged ' || SQL%ROWCOUNT || ' records in FII_Customer_Hierarchies.');
1035: FII_UTIL.stop_timer;
1036: FII_UTIL.print_timer('Duration');
1037: end if;
1038:
1031: g_fii_login_id);
1032:
1033: if g_debug_flag = 'Y' then
1034: FII_UTIL.put_line('Merged ' || SQL%ROWCOUNT || ' records in FII_Customer_Hierarchies.');
1035: FII_UTIL.stop_timer;
1036: FII_UTIL.print_timer('Duration');
1037: end if;
1038:
1039: --Compare old and new data in memory before update/insert/delete.
1032:
1033: if g_debug_flag = 'Y' then
1034: FII_UTIL.put_line('Merged ' || SQL%ROWCOUNT || ' records in FII_Customer_Hierarchies.');
1035: FII_UTIL.stop_timer;
1036: FII_UTIL.print_timer('Duration');
1037: end if;
1038:
1039: --Compare old and new data in memory before update/insert/delete.
1040: --1. Bulk collect new data into memory structures.
1045: --5. Use update/insert and delete tables to merge and delete customer dimension tables.
1046:
1047: g_state := 'Populate memory structure FII_Cust_Hier_New_MS.';
1048: if g_debug_flag = 'Y' then
1049: FII_UTIL.put_line(g_state);
1050: FII_UTIL.start_timer;
1051: end if;
1052:
1053: SELECT *
1046:
1047: g_state := 'Populate memory structure FII_Cust_Hier_New_MS.';
1048: if g_debug_flag = 'Y' then
1049: FII_UTIL.put_line(g_state);
1050: FII_UTIL.start_timer;
1051: end if;
1052:
1053: SELECT *
1054: BULK COLLECT INTO FII_Cust_Hier_New_MS
1055: FROM FII_AR_Cust_Hier_Tmp_GT CH
1056: ORDER BY Parent_Party_ID, Next_Level_Party_ID, Child_Party_ID;
1057:
1058: if g_debug_flag = 'Y' then
1059: FII_UTIL.put_line('Inserted ' || FII_Cust_Hier_New_MS.COUNT || ' records into FII_Cust_Hier_New_MS.');
1060: FII_UTIL.stop_timer;
1061: FII_UTIL.print_timer('Duration');
1062: end if;
1063:
1056: ORDER BY Parent_Party_ID, Next_Level_Party_ID, Child_Party_ID;
1057:
1058: if g_debug_flag = 'Y' then
1059: FII_UTIL.put_line('Inserted ' || FII_Cust_Hier_New_MS.COUNT || ' records into FII_Cust_Hier_New_MS.');
1060: FII_UTIL.stop_timer;
1061: FII_UTIL.print_timer('Duration');
1062: end if;
1063:
1064: g_state := 'Populate memory structure FII_CAcct_Denorm_New_MS.';
1057:
1058: if g_debug_flag = 'Y' then
1059: FII_UTIL.put_line('Inserted ' || FII_Cust_Hier_New_MS.COUNT || ' records into FII_Cust_Hier_New_MS.');
1060: FII_UTIL.stop_timer;
1061: FII_UTIL.print_timer('Duration');
1062: end if;
1063:
1064: g_state := 'Populate memory structure FII_CAcct_Denorm_New_MS.';
1065: if g_debug_flag = 'Y' then
1062: end if;
1063:
1064: g_state := 'Populate memory structure FII_CAcct_Denorm_New_MS.';
1065: if g_debug_flag = 'Y' then
1066: FII_UTIL.put_line(g_state);
1067: FII_UTIL.start_timer;
1068: end if;
1069:
1070: SELECT *
1063:
1064: g_state := 'Populate memory structure FII_CAcct_Denorm_New_MS.';
1065: if g_debug_flag = 'Y' then
1066: FII_UTIL.put_line(g_state);
1067: FII_UTIL.start_timer;
1068: end if;
1069:
1070: SELECT *
1071: BULK COLLECT INTO FII_CAcct_Denorm_New_MS
1072: FROM FII_AR_CAccts_Tmp_GT CH
1073: ORDER BY Parent_Party_ID, Cust_Account_ID;
1074:
1075: if g_debug_flag = 'Y' then
1076: FII_UTIL.put_line('Inserted ' || FII_CAcct_Denorm_New_MS.COUNT || ' records into FII_CAcct_Denorm_New_MS.');
1077: FII_UTIL.stop_timer;
1078: FII_UTIL.print_timer('Duration');
1079: end if;
1080:
1073: ORDER BY Parent_Party_ID, Cust_Account_ID;
1074:
1075: if g_debug_flag = 'Y' then
1076: FII_UTIL.put_line('Inserted ' || FII_CAcct_Denorm_New_MS.COUNT || ' records into FII_CAcct_Denorm_New_MS.');
1077: FII_UTIL.stop_timer;
1078: FII_UTIL.print_timer('Duration');
1079: end if;
1080:
1081: g_state := 'Populate memory structure FII_Cust_Hier_Old_MS.';
1074:
1075: if g_debug_flag = 'Y' then
1076: FII_UTIL.put_line('Inserted ' || FII_CAcct_Denorm_New_MS.COUNT || ' records into FII_CAcct_Denorm_New_MS.');
1077: FII_UTIL.stop_timer;
1078: FII_UTIL.print_timer('Duration');
1079: end if;
1080:
1081: g_state := 'Populate memory structure FII_Cust_Hier_Old_MS.';
1082: if g_debug_flag = 'Y' then
1079: end if;
1080:
1081: g_state := 'Populate memory structure FII_Cust_Hier_Old_MS.';
1082: if g_debug_flag = 'Y' then
1083: FII_UTIL.put_line(g_state);
1084: FII_UTIL.start_timer;
1085: end if;
1086:
1087: SELECT *
1080:
1081: g_state := 'Populate memory structure FII_Cust_Hier_Old_MS.';
1082: if g_debug_flag = 'Y' then
1083: FII_UTIL.put_line(g_state);
1084: FII_UTIL.start_timer;
1085: end if;
1086:
1087: SELECT *
1088: BULK COLLECT INTO FII_Cust_Hier_Old_MS
1100: OR Log.Type_ID = 5))
1101: ORDER BY Parent_Party_ID, Next_Level_Party_ID, Child_Party_ID;
1102:
1103: if g_debug_flag = 'Y' then
1104: FII_UTIL.put_line('Inserted ' || FII_Cust_Hier_Old_MS.COUNT || ' records into FII_Cust_Hier_Old_MS.');
1105: FII_UTIL.stop_timer;
1106: FII_UTIL.print_timer('Duration');
1107: end if;
1108:
1101: ORDER BY Parent_Party_ID, Next_Level_Party_ID, Child_Party_ID;
1102:
1103: if g_debug_flag = 'Y' then
1104: FII_UTIL.put_line('Inserted ' || FII_Cust_Hier_Old_MS.COUNT || ' records into FII_Cust_Hier_Old_MS.');
1105: FII_UTIL.stop_timer;
1106: FII_UTIL.print_timer('Duration');
1107: end if;
1108:
1109: g_state := 'Populate memory structure FII_CAcct_Denorm_Old_MS.';
1102:
1103: if g_debug_flag = 'Y' then
1104: FII_UTIL.put_line('Inserted ' || FII_Cust_Hier_Old_MS.COUNT || ' records into FII_Cust_Hier_Old_MS.');
1105: FII_UTIL.stop_timer;
1106: FII_UTIL.print_timer('Duration');
1107: end if;
1108:
1109: g_state := 'Populate memory structure FII_CAcct_Denorm_Old_MS.';
1110: if g_debug_flag = 'Y' then
1107: end if;
1108:
1109: g_state := 'Populate memory structure FII_CAcct_Denorm_Old_MS.';
1110: if g_debug_flag = 'Y' then
1111: FII_UTIL.put_line(g_state);
1112: FII_UTIL.start_timer;
1113: end if;
1114:
1115: SELECT *
1108:
1109: g_state := 'Populate memory structure FII_CAcct_Denorm_Old_MS.';
1110: if g_debug_flag = 'Y' then
1111: FII_UTIL.put_line(g_state);
1112: FII_UTIL.start_timer;
1113: end if;
1114:
1115: SELECT *
1116: BULK COLLECT INTO FII_CAcct_Denorm_Old_MS
1119: WHERE Log.Cust_Account_ID = CAD.Cust_Account_ID)
1120: ORDER BY Parent_Party_ID, Cust_Account_ID;
1121:
1122: if g_debug_flag = 'Y' then
1123: FII_UTIL.put_line('Inserted ' || FII_CAcct_Denorm_Old_MS.COUNT || ' records into FII_CAcct_Denorm_Old_MS.');
1124: FII_UTIL.stop_timer;
1125: FII_UTIL.print_timer('Duration');
1126: end if;
1127:
1120: ORDER BY Parent_Party_ID, Cust_Account_ID;
1121:
1122: if g_debug_flag = 'Y' then
1123: FII_UTIL.put_line('Inserted ' || FII_CAcct_Denorm_Old_MS.COUNT || ' records into FII_CAcct_Denorm_Old_MS.');
1124: FII_UTIL.stop_timer;
1125: FII_UTIL.print_timer('Duration');
1126: end if;
1127:
1128: g_state := 'Looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.';
1121:
1122: if g_debug_flag = 'Y' then
1123: FII_UTIL.put_line('Inserted ' || FII_CAcct_Denorm_Old_MS.COUNT || ' records into FII_CAcct_Denorm_Old_MS.');
1124: FII_UTIL.stop_timer;
1125: FII_UTIL.print_timer('Duration');
1126: end if;
1127:
1128: g_state := 'Looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.';
1129: if g_debug_flag = 'Y' then
1126: end if;
1127:
1128: g_state := 'Looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.';
1129: if g_debug_flag = 'Y' then
1130: FII_UTIL.put_line(g_state);
1131: FII_UTIL.start_timer;
1132: end if;
1133:
1134: l_cust_hier_old_marker := FII_Cust_Hier_Old_MS.FIRST;
1127:
1128: g_state := 'Looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.';
1129: if g_debug_flag = 'Y' then
1130: FII_UTIL.put_line(g_state);
1131: FII_UTIL.start_timer;
1132: end if;
1133:
1134: l_cust_hier_old_marker := FII_Cust_Hier_Old_MS.FIRST;
1135: l_cust_hier_new_marker := FII_Cust_Hier_New_MS.FIRST;
1231: l_cust_hier_new_marker := FII_Cust_Hier_New_MS.Next(l_cust_hier_new_marker);
1232: END LOOP;
1233:
1234: if g_debug_flag = 'Y' then
1235: FII_UTIL.put_line('Completed looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.');
1236: FII_UTIL.stop_timer;
1237: FII_UTIL.print_timer('Duration');
1238: end if;
1239:
1232: END LOOP;
1233:
1234: if g_debug_flag = 'Y' then
1235: FII_UTIL.put_line('Completed looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.');
1236: FII_UTIL.stop_timer;
1237: FII_UTIL.print_timer('Duration');
1238: end if;
1239:
1240: g_state := 'Looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.';
1233:
1234: if g_debug_flag = 'Y' then
1235: FII_UTIL.put_line('Completed looping through FII_Cust_Hier_New_MS and FII_Cust_Hier_Old_MS.');
1236: FII_UTIL.stop_timer;
1237: FII_UTIL.print_timer('Duration');
1238: end if;
1239:
1240: g_state := 'Looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.';
1241: if g_debug_flag = 'Y' then
1238: end if;
1239:
1240: g_state := 'Looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.';
1241: if g_debug_flag = 'Y' then
1242: FII_UTIL.put_line(g_state);
1243: FII_UTIL.start_timer;
1244: end if;
1245:
1246: l_cacct_denorm_old_marker := FII_CAcct_Denorm_Old_MS.FIRST;
1239:
1240: g_state := 'Looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.';
1241: if g_debug_flag = 'Y' then
1242: FII_UTIL.put_line(g_state);
1243: FII_UTIL.start_timer;
1244: end if;
1245:
1246: l_cacct_denorm_old_marker := FII_CAcct_Denorm_Old_MS.FIRST;
1247: l_cacct_denorm_new_marker := FII_CAcct_Denorm_New_MS.FIRST;
1345: l_cacct_denorm_new_marker := FII_CAcct_Denorm_New_MS.Next(l_cacct_denorm_new_marker);
1346: END LOOP;
1347:
1348: if g_debug_flag = 'Y' then
1349: FII_UTIL.put_line('Completed looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.');
1350: FII_UTIL.stop_timer;
1351: FII_UTIL.print_timer('Duration');
1352: end if;
1353:
1346: END LOOP;
1347:
1348: if g_debug_flag = 'Y' then
1349: FII_UTIL.put_line('Completed looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.');
1350: FII_UTIL.stop_timer;
1351: FII_UTIL.print_timer('Duration');
1352: end if;
1353:
1354: g_state := 'Bulk inserting into FII_AR_Cust_Hier_UI_GT from FII_Cust_Hier_UI_MS.';
1347:
1348: if g_debug_flag = 'Y' then
1349: FII_UTIL.put_line('Completed looping through FII_CAcct_Denorm_New_MS and FII_CAcct_Denorm_Old_MS.');
1350: FII_UTIL.stop_timer;
1351: FII_UTIL.print_timer('Duration');
1352: end if;
1353:
1354: g_state := 'Bulk inserting into FII_AR_Cust_Hier_UI_GT from FII_Cust_Hier_UI_MS.';
1355: if g_debug_flag = 'Y' then
1352: end if;
1353:
1354: g_state := 'Bulk inserting into FII_AR_Cust_Hier_UI_GT from FII_Cust_Hier_UI_MS.';
1355: if g_debug_flag = 'Y' then
1356: FII_UTIL.put_line(g_state);
1357: FII_UTIL.start_timer;
1358: end if;
1359:
1360: IF FII_Cust_Hier_UI_MS.Count > 0 THEN
1353:
1354: g_state := 'Bulk inserting into FII_AR_Cust_Hier_UI_GT from FII_Cust_Hier_UI_MS.';
1355: if g_debug_flag = 'Y' then
1356: FII_UTIL.put_line(g_state);
1357: FII_UTIL.start_timer;
1358: end if;
1359:
1360: IF FII_Cust_Hier_UI_MS.Count > 0 THEN
1361: FORALL i IN FII_Cust_Hier_UI_MS.First..FII_Cust_Hier_UI_MS.Last
1362: INSERT INTO FII_AR_Cust_Hier_UI_GT VALUES FII_Cust_Hier_UI_MS(i);
1363: END IF;
1364:
1365: if g_debug_flag = 'Y' then
1366: FII_UTIL.put_line('Completed populating FII_AR_Cust_Hier_UI_GT.');
1367: FII_UTIL.stop_timer;
1368: FII_UTIL.print_timer('Duration');
1369: end if;
1370:
1363: END IF;
1364:
1365: if g_debug_flag = 'Y' then
1366: FII_UTIL.put_line('Completed populating FII_AR_Cust_Hier_UI_GT.');
1367: FII_UTIL.stop_timer;
1368: FII_UTIL.print_timer('Duration');
1369: end if;
1370:
1371: g_state := 'Bulk inserting into FII_AR_Cust_Hier_D_GT from FII_Cust_Hier_D_MS.';
1364:
1365: if g_debug_flag = 'Y' then
1366: FII_UTIL.put_line('Completed populating FII_AR_Cust_Hier_UI_GT.');
1367: FII_UTIL.stop_timer;
1368: FII_UTIL.print_timer('Duration');
1369: end if;
1370:
1371: g_state := 'Bulk inserting into FII_AR_Cust_Hier_D_GT from FII_Cust_Hier_D_MS.';
1372: if g_debug_flag = 'Y' then
1369: end if;
1370:
1371: g_state := 'Bulk inserting into FII_AR_Cust_Hier_D_GT from FII_Cust_Hier_D_MS.';
1372: if g_debug_flag = 'Y' then
1373: FII_UTIL.put_line(g_state);
1374: FII_UTIL.start_timer;
1375: end if;
1376:
1377: IF FII_Cust_Hier_D_MS.Count > 0 THEN
1370:
1371: g_state := 'Bulk inserting into FII_AR_Cust_Hier_D_GT from FII_Cust_Hier_D_MS.';
1372: if g_debug_flag = 'Y' then
1373: FII_UTIL.put_line(g_state);
1374: FII_UTIL.start_timer;
1375: end if;
1376:
1377: IF FII_Cust_Hier_D_MS.Count > 0 THEN
1378: FORALL i IN FII_Cust_Hier_D_MS.First..FII_Cust_Hier_D_MS.Last
1379: INSERT INTO FII_AR_Cust_Hier_D_GT VALUES FII_Cust_Hier_D_MS(i);
1380: END IF;
1381:
1382: if g_debug_flag = 'Y' then
1383: FII_UTIL.put_line('Completed populating FII_AR_Cust_Hier_D_GT.');
1384: FII_UTIL.stop_timer;
1385: FII_UTIL.print_timer('Duration');
1386: end if;
1387:
1380: END IF;
1381:
1382: if g_debug_flag = 'Y' then
1383: FII_UTIL.put_line('Completed populating FII_AR_Cust_Hier_D_GT.');
1384: FII_UTIL.stop_timer;
1385: FII_UTIL.print_timer('Duration');
1386: end if;
1387:
1388: g_state := 'Bulk inserting into FII_AR_CAccts_D_GT from FII_CAcct_Denorm_D_MS.';
1381:
1382: if g_debug_flag = 'Y' then
1383: FII_UTIL.put_line('Completed populating FII_AR_Cust_Hier_D_GT.');
1384: FII_UTIL.stop_timer;
1385: FII_UTIL.print_timer('Duration');
1386: end if;
1387:
1388: g_state := 'Bulk inserting into FII_AR_CAccts_D_GT from FII_CAcct_Denorm_D_MS.';
1389: if g_debug_flag = 'Y' then
1386: end if;
1387:
1388: g_state := 'Bulk inserting into FII_AR_CAccts_D_GT from FII_CAcct_Denorm_D_MS.';
1389: if g_debug_flag = 'Y' then
1390: FII_UTIL.put_line(g_state);
1391: FII_UTIL.start_timer;
1392: end if;
1393:
1394: IF FII_CAcct_Denorm_D_MS.Count > 0 THEN
1387:
1388: g_state := 'Bulk inserting into FII_AR_CAccts_D_GT from FII_CAcct_Denorm_D_MS.';
1389: if g_debug_flag = 'Y' then
1390: FII_UTIL.put_line(g_state);
1391: FII_UTIL.start_timer;
1392: end if;
1393:
1394: IF FII_CAcct_Denorm_D_MS.Count > 0 THEN
1395: FORALL i IN FII_CAcct_Denorm_D_MS.First..FII_CAcct_Denorm_D_MS.Last
1396: INSERT INTO FII_AR_CAccts_D_GT VALUES FII_CAcct_Denorm_D_MS(i);
1397: END IF;
1398:
1399: if g_debug_flag = 'Y' then
1400: FII_UTIL.put_line('Completed populating FII_AR_CAccts_D_GT.');
1401: FII_UTIL.stop_timer;
1402: FII_UTIL.print_timer('Duration');
1403: end if;
1404:
1397: END IF;
1398:
1399: if g_debug_flag = 'Y' then
1400: FII_UTIL.put_line('Completed populating FII_AR_CAccts_D_GT.');
1401: FII_UTIL.stop_timer;
1402: FII_UTIL.print_timer('Duration');
1403: end if;
1404:
1405: g_state := 'Deleting records from FII_Customer_Hierarchies using FII_AR_Cust_Hier_D_GT';
1398:
1399: if g_debug_flag = 'Y' then
1400: FII_UTIL.put_line('Completed populating FII_AR_CAccts_D_GT.');
1401: FII_UTIL.stop_timer;
1402: FII_UTIL.print_timer('Duration');
1403: end if;
1404:
1405: g_state := 'Deleting records from FII_Customer_Hierarchies using FII_AR_Cust_Hier_D_GT';
1406: if g_debug_flag = 'Y' then
1403: end if;
1404:
1405: g_state := 'Deleting records from FII_Customer_Hierarchies using FII_AR_Cust_Hier_D_GT';
1406: if g_debug_flag = 'Y' then
1407: FII_UTIL.put_line(g_state);
1408: FII_UTIL.start_timer;
1409: end if;
1410:
1411: DELETE FROM FII_Customer_Hierarchies CH
1404:
1405: g_state := 'Deleting records from FII_Customer_Hierarchies using FII_AR_Cust_Hier_D_GT';
1406: if g_debug_flag = 'Y' then
1407: FII_UTIL.put_line(g_state);
1408: FII_UTIL.start_timer;
1409: end if;
1410:
1411: DELETE FROM FII_Customer_Hierarchies CH
1412: WHERE EXISTS (SELECT 1
1415: AND D.Next_Level_Party_ID = CH.Next_Level_Party_ID
1416: AND D.Child_Party_ID = CH.Child_Party_ID);
1417:
1418: if g_debug_flag = 'Y' then
1419: FII_UTIL.put_line('Deleted ' || SQL%ROWCOUNT || ' records from FII_Customer_Hierarchies.');
1420: FII_UTIL.stop_timer;
1421: FII_UTIL.print_timer('Duration');
1422: end if;
1423:
1416: AND D.Child_Party_ID = CH.Child_Party_ID);
1417:
1418: if g_debug_flag = 'Y' then
1419: FII_UTIL.put_line('Deleted ' || SQL%ROWCOUNT || ' records from FII_Customer_Hierarchies.');
1420: FII_UTIL.stop_timer;
1421: FII_UTIL.print_timer('Duration');
1422: end if;
1423:
1424:
1417:
1418: if g_debug_flag = 'Y' then
1419: FII_UTIL.put_line('Deleted ' || SQL%ROWCOUNT || ' records from FII_Customer_Hierarchies.');
1420: FII_UTIL.stop_timer;
1421: FII_UTIL.print_timer('Duration');
1422: end if;
1423:
1424:
1425: g_state := 'Merging records into FII_Customer_Hierarchies using FII_AR_Cust_Hier_UI_GT.';
1423:
1424:
1425: g_state := 'Merging records into FII_Customer_Hierarchies using FII_AR_Cust_Hier_UI_GT.';
1426: if g_debug_flag = 'Y' then
1427: FII_UTIL.put_line(g_state);
1428: FII_UTIL.start_timer;
1429: end if;
1430:
1431: MERGE INTO FII_Customer_Hierarchies CH
1424:
1425: g_state := 'Merging records into FII_Customer_Hierarchies using FII_AR_Cust_Hier_UI_GT.';
1426: if g_debug_flag = 'Y' then
1427: FII_UTIL.put_line(g_state);
1428: FII_UTIL.start_timer;
1429: end if;
1430:
1431: MERGE INTO FII_Customer_Hierarchies CH
1432: USING FII_AR_Cust_Hier_UI_GT UI
1466: g_fii_user_id,
1467: g_fii_login_id);
1468:
1469: if g_debug_flag = 'Y' then
1470: FII_UTIL.put_line('Merged ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies.');
1471: FII_UTIL.stop_timer;
1472: FII_UTIL.print_timer('Duration');
1473: end if;
1474:
1467: g_fii_login_id);
1468:
1469: if g_debug_flag = 'Y' then
1470: FII_UTIL.put_line('Merged ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies.');
1471: FII_UTIL.stop_timer;
1472: FII_UTIL.print_timer('Duration');
1473: end if;
1474:
1475: g_state := 'Deleting records from FII_Cust_Accounts using FII_AR_CAccts_D_GT';
1468:
1469: if g_debug_flag = 'Y' then
1470: FII_UTIL.put_line('Merged ' || SQL%ROWCOUNT || ' records into FII_Customer_Hierarchies.');
1471: FII_UTIL.stop_timer;
1472: FII_UTIL.print_timer('Duration');
1473: end if;
1474:
1475: g_state := 'Deleting records from FII_Cust_Accounts using FII_AR_CAccts_D_GT';
1476: if g_debug_flag = 'Y' then
1473: end if;
1474:
1475: g_state := 'Deleting records from FII_Cust_Accounts using FII_AR_CAccts_D_GT';
1476: if g_debug_flag = 'Y' then
1477: FII_UTIL.put_line(g_state);
1478: FII_UTIL.start_timer;
1479: end if;
1480:
1481: DELETE FROM FII_Cust_Accounts CAD
1474:
1475: g_state := 'Deleting records from FII_Cust_Accounts using FII_AR_CAccts_D_GT';
1476: if g_debug_flag = 'Y' then
1477: FII_UTIL.put_line(g_state);
1478: FII_UTIL.start_timer;
1479: end if;
1480:
1481: DELETE FROM FII_Cust_Accounts CAD
1482: WHERE EXISTS (SELECT 1
1484: WHERE D.Parent_Party_ID = CAD.Parent_Party_ID
1485: AND D.Cust_Account_ID = CAD.Cust_Account_ID);
1486:
1487: if g_debug_flag = 'Y' then
1488: FII_UTIL.put_line('Deleted ' || SQL%ROWCOUNT || ' records from FII_Cust_Accounts.');
1489: FII_UTIL.stop_timer;
1490: FII_UTIL.print_timer('Duration');
1491: end if;
1492:
1485: AND D.Cust_Account_ID = CAD.Cust_Account_ID);
1486:
1487: if g_debug_flag = 'Y' then
1488: FII_UTIL.put_line('Deleted ' || SQL%ROWCOUNT || ' records from FII_Cust_Accounts.');
1489: FII_UTIL.stop_timer;
1490: FII_UTIL.print_timer('Duration');
1491: end if;
1492:
1493: g_state := 'Bulk inserting into FII_Cust_Accounts from FII_CAcct_Denorm_I_MS.';
1486:
1487: if g_debug_flag = 'Y' then
1488: FII_UTIL.put_line('Deleted ' || SQL%ROWCOUNT || ' records from FII_Cust_Accounts.');
1489: FII_UTIL.stop_timer;
1490: FII_UTIL.print_timer('Duration');
1491: end if;
1492:
1493: g_state := 'Bulk inserting into FII_Cust_Accounts from FII_CAcct_Denorm_I_MS.';
1494: if g_debug_flag = 'Y' then
1491: end if;
1492:
1493: g_state := 'Bulk inserting into FII_Cust_Accounts from FII_CAcct_Denorm_I_MS.';
1494: if g_debug_flag = 'Y' then
1495: FII_UTIL.put_line(g_state);
1496: FII_UTIL.start_timer;
1497: end if;
1498:
1499: IF FII_CAcct_Denorm_I_MS.Count > 0 THEN
1492:
1493: g_state := 'Bulk inserting into FII_Cust_Accounts from FII_CAcct_Denorm_I_MS.';
1494: if g_debug_flag = 'Y' then
1495: FII_UTIL.put_line(g_state);
1496: FII_UTIL.start_timer;
1497: end if;
1498:
1499: IF FII_CAcct_Denorm_I_MS.Count > 0 THEN
1500: FORALL i IN FII_CAcct_Denorm_I_MS.First..FII_CAcct_Denorm_I_MS.Last
1501: INSERT INTO FII_Cust_Accounts VALUES FII_CAcct_Denorm_I_MS(i);
1502: END IF;
1503:
1504: if g_debug_flag = 'Y' then
1505: FII_UTIL.put_line('Completed populating FII_Cust_Accounts.');
1506: FII_UTIL.stop_timer;
1507: FII_UTIL.print_timer('Duration');
1508: end if;
1509:
1502: END IF;
1503:
1504: if g_debug_flag = 'Y' then
1505: FII_UTIL.put_line('Completed populating FII_Cust_Accounts.');
1506: FII_UTIL.stop_timer;
1507: FII_UTIL.print_timer('Duration');
1508: end if;
1509:
1510: g_state := 'Calling BIS_COLLECTION_UTILITIES.wrapup';
1503:
1504: if g_debug_flag = 'Y' then
1505: FII_UTIL.put_line('Completed populating FII_Cust_Accounts.');
1506: FII_UTIL.stop_timer;
1507: FII_UTIL.print_timer('Duration');
1508: end if;
1509:
1510: g_state := 'Calling BIS_COLLECTION_UTILITIES.wrapup';
1511: BIS_COLLECTION_UTILITIES.wrapup(
1519: g_retcode := -1;
1520: retcode := g_retcode;
1521:
1522: g_exception_msg := g_retcode || ':' || sqlerrm;
1523: FII_UTIL.put_line('Error occured while ' || g_state);
1524: FII_UTIL.put_line(g_exception_msg);
1525:
1526:
1527: END INCRE_UPDATE;
1520: retcode := g_retcode;
1521:
1522: g_exception_msg := g_retcode || ':' || sqlerrm;
1523: FII_UTIL.put_line('Error occured while ' || g_state);
1524: FII_UTIL.put_line(g_exception_msg);
1525:
1526:
1527: END INCRE_UPDATE;
1528: