38: as
39:
40: begin
41:
42: bis_collection_utilities.log
43: ( substr( g_pkg_name || '.' || p_proc_name || ' #' || p_stmt_id || p_message
44: , 1
45: , 1991 -- [2000 - (3*3)]
46: )
90: , x_error_message out nocopy varchar2 )
91: return number as
92: l_refresh_date date;
93: begin
94: l_refresh_date := fnd_date.displaydt_to_date(bis_collection_utilities.get_last_refresh_period(g_object_name));
95: if l_refresh_date = g_global_start_date then
96: x_error_message := 'Incremental Load can only be run after a completed initial or incremental load';
97: x_error_message := x_error_message || ' Refresh Date is '|| l_refresh_date;
98: x_error_message := x_error_message || ' global start date is '|| g_global_start_date ;
129:
130: begin
131: local_init;
132:
133: bis_collection_utilities.log( 'Begin Initial Load' );
134:
135: l_stmt_id := 0;
136: if not bis_collection_utilities.setup( g_object_name ) then
137: l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
132:
133: bis_collection_utilities.log( 'Begin Initial Load' );
134:
135: l_stmt_id := 0;
136: if not bis_collection_utilities.setup( g_object_name ) then
137: l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
138: logger( l_proc_name, l_stmt_id, l_error_message );
139: raise g_bis_setup_exception;
140: end if;
133: bis_collection_utilities.log( 'Begin Initial Load' );
134:
135: l_stmt_id := 0;
136: if not bis_collection_utilities.setup( g_object_name ) then
137: l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
138: logger( l_proc_name, l_stmt_id, l_error_message );
139: raise g_bis_setup_exception;
140: end if;
141:
343:
344:
345: l_stmt_id := 90;
346:
347: bis_collection_utilities.log( l_rowcount || ' rows inserted into base summary', 1 );
348:
349: bis_collection_utilities.wrapup( p_status => true
350: , p_period_from => l_collect_from_date
351: , p_period_to => l_collect_to_date
345: l_stmt_id := 90;
346:
347: bis_collection_utilities.log( l_rowcount || ' rows inserted into base summary', 1 );
348:
349: bis_collection_utilities.wrapup( p_status => true
350: , p_period_from => l_collect_from_date
351: , p_period_to => l_collect_to_date
352: , p_count => l_rowcount
353: );
351: , p_period_to => l_collect_to_date
352: , p_count => l_rowcount
353: );
354:
355: bis_collection_utilities.log('End Initial Load');
356:
357:
358:
359:
369: if l_error_message is null then
370: l_error_message := substr(sqlerrm,1,4000);
371: end if;
372: logger( l_proc_name, l_stmt_id, l_error_message );
373: bis_collection_utilities.wrapup(p_status => false
374: ,p_message => l_error_message
375: ,p_period_from => l_collect_from_date
376: ,p_period_to => l_collect_to_date
377: );
400:
401: begin
402: local_init;
403:
404: bis_collection_utilities.log( 'Begin Incremental Load' );
405:
406: l_stmt_id := 0;
407:
408: if not bis_collection_utilities.setup( g_object_name ) then
404: bis_collection_utilities.log( 'Begin Incremental Load' );
405:
406: l_stmt_id := 0;
407:
408: if not bis_collection_utilities.setup( g_object_name ) then
409: l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
410: logger( l_proc_name, l_stmt_id, l_error_message );
411: raise g_bis_setup_exception;
412: end if;
405:
406: l_stmt_id := 0;
407:
408: if not bis_collection_utilities.setup( g_object_name ) then
409: l_error_message := 'Error in BIS_COLLECTION_UTILITIES.Setup';
410: logger( l_proc_name, l_stmt_id, l_error_message );
411: raise g_bis_setup_exception;
412: end if;
413:
751: l_rowcount := sql%rowcount;
752: commit;
753:
754:
755: bis_collection_utilities.log( 'From: ' || fnd_date.date_to_displaydt(l_collect_from_date), 1 );
756: bis_collection_utilities.log( 'To: ' || fnd_date.date_to_displaydt(l_collect_to_date), 1 );
757: bis_collection_utilities.log( l_rowcount || ' rows merged into base summary', 1 );
758:
759: l_stmt_id := 40;
752: commit;
753:
754:
755: bis_collection_utilities.log( 'From: ' || fnd_date.date_to_displaydt(l_collect_from_date), 1 );
756: bis_collection_utilities.log( 'To: ' || fnd_date.date_to_displaydt(l_collect_to_date), 1 );
757: bis_collection_utilities.log( l_rowcount || ' rows merged into base summary', 1 );
758:
759: l_stmt_id := 40;
760:
753:
754:
755: bis_collection_utilities.log( 'From: ' || fnd_date.date_to_displaydt(l_collect_from_date), 1 );
756: bis_collection_utilities.log( 'To: ' || fnd_date.date_to_displaydt(l_collect_to_date), 1 );
757: bis_collection_utilities.log( l_rowcount || ' rows merged into base summary', 1 );
758:
759: l_stmt_id := 40;
760:
761: bis_collection_utilities.wrapup( p_status => true
757: bis_collection_utilities.log( l_rowcount || ' rows merged into base summary', 1 );
758:
759: l_stmt_id := 40;
760:
761: bis_collection_utilities.wrapup( p_status => true
762: , p_period_from => l_collect_from_date
763: , p_period_to => l_collect_to_date
764: , p_count => l_rowcount
765: );
762: , p_period_from => l_collect_from_date
763: , p_period_to => l_collect_to_date
764: , p_count => l_rowcount
765: );
766: bis_collection_utilities.log('Incremental Load complete');
767:
768: errbuf := null;
769: retcode := g_success;
770:
780: l_error_message := substr(sqlerrm,1,4000);
781: end if;
782:
783: logger( l_proc_name, l_stmt_id, l_error_message );
784: bis_collection_utilities.wrapup( p_status => false
785: ,p_message => l_error_message
786: ,p_period_from => l_collect_from_date
787: ,p_period_to => l_collect_to_date
788: );