The following lines contain the word 'select', 'insert', 'update' or 'delete':
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Pre Coll Hook',sysdate,null,'PRE-LEVEL',
'PRE-COLL-HOOK',10,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,10,'U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Pre Dimension Coll Hook',sysdate,null,'PRE-LEVEL',
'PRE-DIM-COLL-HOOK',11,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,11,'U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Load NA_EDW',sysdate,null,'PRE-LEVEL',
'NAEDW_LOAD',12,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,12,'U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Read Metadata',sysdate,null,'PRE-LEVEL',
'METADATA_READ',13,'I');
when smart update is false, turn off fk change check. this means when dim is loaded, it will pull in all the levels
in the select and from clause.
*/
if g_smart_update=false then
g_check_fk_change:=false;
write_to_log_file_n('Smart Update false. Turning OFF fk change check');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,13,'U');
insert_into_load_progress_nd(g_load_pk,g_object_name,g_object_id,'Push Down Levels',sysdate,null,'LEVEL',
'DIMENSION','PD10','I');
g_update_type,
g_load_pk,
g_op_table_space,
g_dim_push_down,
g_rollback,
g_thread_type,
g_max_threads,
g_min_job_load_size,
g_sleep_time,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options,
g_stg_join_nl
) =false then
errbuf:='FINISH push_down_all_levels WITH ERROR '||EDW_PUSH_DOWN_DIMS.g_status_message;
insert_into_load_progress_nd(g_load_pk,null,null,null,null,sysdate,null,null,'PD10','U');
insert_into_load_progress_nd(g_load_pk,null,null,null,null,sysdate,null,null,'PD10','U');
insert_into_load_progress_nd(g_load_pk,g_object_name,g_object_id,'Dimension Collection',sysdate,null,'DIMENSION',
'DIMENSION','DC10','I');
g_update_type,
g_level_order,
g_skip_cols,
g_number_skip_cols,
g_load_pk,
g_fresh_restart,
g_op_table_space,
g_rollback,
g_ltc_merge_use_nl,
g_dim_inc_refresh_derv,
g_check_fk_change,
g_ok_switch_update,
g_stg_join_nl,
g_thread_type,
g_max_threads,
g_min_job_load_size,
g_sleep_time,
g_job_status_table,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options,
g_max_fk_density,
g_analyze_frequency,
g_parallel_drill_down,
g_dd_status_table
);
insert_into_load_progress_nd(g_load_pk,null,null,null,null,sysdate,null,null,'DC10','U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Post Dimension Coll Hook',sysdate,null,'POST-LEVEL',
'POST-DIM-COLL-HOOK',14,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,14,'U');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,14,'U');
l_smart_update_cols EDW_OWB_COLLECTION_UTIL.varcharTableType;
l_number_smart_update_cols number;
l_number_smart_update_cols:=0;
for k in 1..g_number_smart_update_cols loop
for j in 1..l_numer_cols loop
if g_smart_update_cols(k)=l_tgt_cols(j) then
l_number_smart_update_cols:=l_number_smart_update_cols+1;
l_smart_update_cols(l_number_smart_update_cols):=l_src_cols(j);
insert_into_load_progress_nd(g_load_pk,g_level_order(i),g_primary_target(i),'Collect Level',sysdate,null,'LEVEL',
'LEVEL-LOAD',100+i,'I');
g_update_type,
g_mode,
g_explain_plan_check,
null,
g_key_set,
g_instance_type,
g_load_pk,
l_skip_cols,
l_number_skip_cols,
g_fresh_restart,
g_op_table_space,
l_da_cols,
l_number_da_cols,
l_da_table,
l_pp_table,
g_master_instance,
g_rollback,
g_skip_levels,
g_number_skip_levels,
g_smart_update,
g_fk_use_nl,
g_fact_smart_update,
g_auto_dang_table_extn,
g_auto_dang_recovery,--all the levels get the same flag
g_create_parent_table_records,
l_smart_update_cols,
l_number_smart_update_cols,
g_check_fk_change,
g_stg_join_nl,
g_ok_switch_update,
g_stg_make_copy_percentage,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options,
g_min_job_load_size,
g_sleep_time,
g_thread_type,
g_max_threads,
g_job_status_table,
g_analyze_frequency,
g_parallel_drill_down,
g_dd_status_table
);
insert_into_load_progress_nd(g_load_pk,null,null,null,null,sysdate,null,null,100+i,'U');
g_ins_rows_insert(1),
g_ins_rows_update(1),
g_ins_rows_delete(1),
g_ins_instance_name(1),
g_ins_request_id_table(1))=false then
null;
l_stmt:='select 1 from EDW_FACTS_MD_V where fact_name=:s';
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Pre Coll Hook',sysdate,null,'FACT',
'PRE-COLL-HOOK',20,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,20,'U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Pre Fact Coll Hook',sysdate,null,'FACT',
'PRE-FACT-COLL-HOOK',21,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,21,'U');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,21,'U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Derived Fact Collect',sysdate,null,'FACT',
'DERIVED-FACT-COLLECT',22,'I');
g_update_type,
g_skip_cols,
g_number_skip_cols,
g_load_pk,
g_fresh_restart,
g_op_table_space,
g_rollback,
g_stg_join_nl,
g_thread_type,
g_max_threads,
g_min_job_load_size,
g_sleep_time,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options
) = true then
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('EDW_DERIVED_FACT_COLLECT.COLLECT_FACT returned with success '||get_time
,FND_LOG.LEVEL_PROCEDURE);
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,22,'U');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,22,'U');
select fact_name into l_audit_name from edw_facts_md_v where fact_name=p_fact_name||'_AU' ;
select fact_name into l_net_change_name from edw_facts_md_v where fact_name=p_fact_name||'_NC' ;
insert_into_load_progress_nd(g_load_pk,g_object_name,g_object_id,'Load Fact',sysdate,null,'FACT','FACT','LF','I');
g_update_type,--for facts, we need to log into temp log table
g_mode,
g_explain_plan_check,
g_fact_dlog,
g_key_set,
g_instance_type,
g_load_pk,
g_skip_cols,
g_number_skip_cols,
g_fresh_restart,
g_op_table_space,
g_da_cols,
g_number_da_cols,
null,--g_da_table
null,--g_pp_table
g_master_instance,
g_rollback,
g_skip_levels,
g_number_skip_levels,
g_smart_update,
g_fk_use_nl,
g_fact_smart_update,
g_auto_dang_table_extn,
g_auto_dang_recovery,
g_create_parent_table_records,
g_smart_update_cols,
g_number_smart_update_cols,
g_check_fk_change,
g_stg_join_nl,
g_ok_switch_update,
g_stg_make_copy_percentage,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options,
g_min_job_load_size,
g_sleep_time,
g_thread_type,
g_max_threads,
g_job_status_table,
g_analyze_frequency,
false,
null
);
insert_into_load_progress_nd(g_load_pk,null,null,null,null,sysdate,null,null,'LF','U');
insert_into_load_progress(g_load_pk,g_object_name,g_object_id,'Post Fact Coll Hook',sysdate,null,'POST-FACT',
'POST-FACT',23,'I');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,23,'U');
insert_into_load_progress(g_load_pk,null,null,null,null,sysdate,null,null,23,'U');
delete_object_log_tables is contained in refresh_all_derived_facts
In this the snp log of base fact is truncated
*/
begin
if g_logical_object_type='FACT' then
if refresh_all_derived_facts=false then
errbuf:=g_status_message;
'DELETE') = false then
g_status_message:=EDW_OWB_COLLECTION_UTIL.g_status_message;
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Util.record_coll_progress returned with error for delete',
FND_LOG.LEVEL_STATEMENT);
g_ok_switch_update:=5;--% when to swith to update for ok table
g_fact_dlog:=g_bis_owner||'.'||substr(g_object_name,1,26)||'DLG'; --delete log for facts
set_g_fact_smart_update;
procedure set_g_fact_smart_update is
Begin
g_fact_smart_update:=50;--number of columns below which there is smart update for facts
g_fact_smart_update:=150;
g_fact_smart_update:=g_fact_smart_update+(g_max_threads/2)*(g_fact_smart_update/2);
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('g_fact_smart_update='||g_fact_smart_update,FND_LOG.LEVEL_STATEMENT);
g_fact_smart_update:=50;
g_ins_rows_insert(i),
g_ins_rows_update(i),
g_ins_rows_delete(i),
p_message(i),
l_status,
p_load_pk)= false then
g_status_message:=EDW_OWB_COLLECTION_UTIL.g_status_message;
l_stmt:='select 1 from edw_pvt_map_properties_md_v map, EDW_FACTS_MD_V tgt, EDW_FACTS_MD_V src '||
' where tgt.fact_name=:a and map.Primary_target=tgt.fact_id and map.Primary_source=src.fact_id and rownum=1';
l_stmt:='select 1 from edw_pvt_map_properties_md_v map, edw_facts_md_v tgt '||
' where map.primary_target=tgt.fact_id and map.primary_source=:a and rownum=1';
g_update_type,
g_fact_dlog,
g_fresh_restart,
g_op_table_space,
l_bu_tables,--dummy
l_bu_dimensions,--dummy
l_number_bu_tables,--dummy
l_bu_src_fact,--dummy
l_load_mode,--dummy
g_rollback,
g_stg_join_nl,
g_thread_type,
g_max_threads,
g_min_job_load_size,
g_sleep_time,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options,
g_job_queue_processes
)=false then
g_status_message:=EDW_DERIVED_FACT_COLLECT.get_status_message;
l_stmt:='select dim_name from edw_dimensions_md_v where dim_name=:a or dim_long_name=:b';
l_stmt:='select fact_name from edw_facts_md_v where fact_name=:a or fact_longname=:b';
l_dlog:=EDW_OWB_COLLECTION_UTIL.get_log_for_table(g_object_name,'Delete Log');
' as select '||g_object_name||'.*,'||g_object_name||'.rowid row_id from '||
g_object_name||' where 1=2';
procedure insert_into_load_progress(p_load_fk number,p_object_name varchar2,p_object_id number,p_load_progress varchar2,
p_start_date date,p_end_date date,p_category varchar2, p_operation varchar2,p_seq_id varchar2,p_flag varchar2) is
Begin
EDW_OWB_COLLECTION_UTIL.insert_into_load_progress(p_load_fk,p_object_name,p_object_id,p_load_progress,p_start_date,
p_end_date,p_category,p_operation,p_seq_id,p_flag,1);
procedure insert_into_load_progress_nd(p_load_fk number,p_object_name varchar2,p_object_id number,p_load_progress varchar2,
p_start_date date,p_end_date date,p_category varchar2, p_operation varchar2,p_seq_id varchar2,p_flag varchar2) is
Begin
if g_debug=false then
EDW_OWB_COLLECTION_UTIL.insert_into_load_progress(p_load_fk,p_object_name,p_object_id,p_load_progress,p_start_date,
p_end_date,p_category,p_operation,p_seq_id,p_flag,1);
l_bu_tables EDW_OWB_COLLECTION_UTIL.varcharTableType;--before update tables.prop dim change to derv
l_prot_delete varchar2(400);
l_prot_update varchar2(400);
g_before_update_table:=EDW_SUMMARY_COLLECT.g_before_update_table;--pl/sql table
g_number_before_update_table:=EDW_SUMMARY_COLLECT.g_number_before_update_table;
if g_before_update_table.count=0 then
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('There are no update tables created to refresh the derived facts',
FND_LOG.LEVEL_STATEMENT);
for j in 1..g_number_before_update_table loop
l_number_bu_tables:=1;
l_bu_tables(1):=g_before_update_table(j);
l_prot_delete:=g_bis_owner||'.PD'||l_dim_id||'_'||g_dim_derv_map_id(i)||'_'||j;
l_prot_update:=g_bis_owner||'.PU'||l_dim_id||'_'||g_dim_derv_map_id(i)||'_'||j;
g_tables_to_drop(g_number_tables_to_drop):=l_prot_delete;
g_tables_to_drop(g_number_tables_to_drop):=l_prot_update;
if EDW_OWB_COLLECTION_UTIL.check_table(l_prot_delete)=false or
EDW_OWB_COLLECTION_UTIL.check_table(l_prot_update)=false then
l_derv_bu_map_src_table:=g_bis_owner||'.BUS'||l_dim_id||'_'||g_dim_derv_map_id(i)||'_'||j;
l_derv_bu_map_src_table,g_before_update_table(j),l_bu_src_fact)=false then
return false;
l_load_mode:='BU-DELETE';
if EDW_OWB_COLLECTION_UTIL.check_table(l_prot_delete) then
goto loopend;
l_load_mode:='BU-UPDATE';
if EDW_OWB_COLLECTION_UTIL.check_table(l_prot_update) then
goto loopend;
g_update_type,
null,--the fact dlog
l_skip_cols ,
l_number_skip_cols ,
l_df_load_pk(i),
false,--fresh restart
g_op_table_space,
l_bu_tables ,--before update tables.prop dim change to derv
l_bu_dimensions ,
l_number_bu_tables ,
l_bu_src_fact ,--what table to look at as the src fact. if null, scan the actual src fact
l_load_mode,
g_rollback,
g_stg_join_nl,
g_thread_type,
g_max_threads,
g_min_job_load_size,
g_sleep_time,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options
)=false then
g_status_message:=EDW_DERIVED_FACT_COLLECT.g_status_message;
if l_load_mode='BU-DELETE' then
if EDW_OWB_COLLECTION_UTIL.create_prot_table(l_prot_delete,g_op_table_space)=false then
return false;
if EDW_OWB_COLLECTION_UTIL.create_prot_table(l_prot_update,g_op_table_space)=false then
return false;
end loop;--for j in 1..g_number_before_update_table loop
g_update_type,
l_skip_cols,
l_number_skip_cols,
l_df_load_pk(i),--p_load_pk
false,--g_fresh_restart
g_op_table_space,
g_rollback,
g_stg_join_nl,
g_thread_type,
g_max_threads,
g_min_job_load_size,
g_sleep_time,
g_hash_area_size,
g_sort_area_size,
g_trace,
g_read_cfig_options
) = false then
g_status_message:=EDW_DERIVED_FACT_COLLECT.get_status_message;
for i in 1..g_number_before_update_table loop
if EDW_OWB_COLLECTION_UTIL.drop_table(g_before_update_table(i))=false then
null;
p_derv_before_update_table varchar2,p_bu_src_table out NOCOPY varchar2)
return boolean is
l_stmt varchar2(10000);
l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
l_stmt:=l_stmt||p_src_fact||'.* from '||p_derv_before_update_table||','||p_src_fact||' where '||
p_derv_before_update_table||'.'||l_pk(1)||'='||p_src_fact||'.'||l_fk(1);
l_stmt:=l_stmt||' select /*+ORDERED*/ ';
l_stmt:=l_stmt||p_src_fact||'.rowid row_id from '||p_derv_before_update_table||','||p_src_fact||
' where '||p_derv_before_update_table||'.'||l_pk(i)||'='||p_src_fact||'.'||l_fk(i)||' UNION ';
l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
l_stmt:='select rel.relation_name,rel.relation_id '||
'from '||
'edw_pvt_map_properties_md_v map, '||
'edw_relations_md_v rel '||
'where map.mapping_id=:a '||
'and rel.relation_id=map.primary_source ';
if edw_option.get_warehouse_option(null,g_object_id,'UPDATETYPE',l_option_value)=false then
null;
g_update_type:=l_option_value;
g_update_type:='MASS';
if g_update_type<>'MASS' and g_update_type<>'ROW-BY-ROW' then
g_update_type:='MASS';
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Update Type='||g_update_type,FND_LOG.LEVEL_STATEMENT);
if edw_option.get_warehouse_option(null,g_object_id,'SMARTUPDATE',l_option_value)=false then
null;
g_smart_update:=true;
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Smart Update TRUE',FND_LOG.LEVEL_STATEMENT);
g_smart_update:=false;
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Smart Update FALSE',FND_LOG.LEVEL_STATEMENT);
g_number_smart_update_cols:=0;
if g_smart_update then
if edw_option.get_option_columns(null,g_object_id,'SMARTUPDATE',g_smart_update_cols,
g_number_smart_update_cols)=false then
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Error in getting columns for smart update '||edw_option.g_status_message,
FND_LOG.LEVEL_STATEMENT);
g_number_smart_update_cols:=0;
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('The smart update columns',FND_LOG.LEVEL_STATEMENT);
for i in 1..g_number_smart_update_cols loop
EDW_OWB_COLLECTION_UTIL.write_to_log_file(g_smart_update_cols(i),FND_LOG.LEVEL_STATEMENT);
if edw_option.get_warehouse_option(null,g_object_id,'OK_UPDATE',l_option_value)=false then
null;
g_ok_switch_update:=to_number(l_option_value);
g_update_type:=fnd_profile.value('EDW_UPDATE_TYPE');
if g_update_type is null then
g_update_type:='MASS';
if g_update_type<>'MASS' and g_update_type<>'ROW-BY-ROW' then
g_update_type:='MASS';
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Update Type='||g_update_type,FND_LOG.LEVEL_STATEMENT);
if fnd_profile.value('EDW_SMART_UPDATE')='Y' then
g_smart_update:=true;
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Smart Update TRUE',FND_LOG.LEVEL_STATEMENT);
g_smart_update:=false;
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('Smart Update FALSE',FND_LOG.LEVEL_STATEMENT);
g_number_smart_update_cols:=0;
if g_smart_update then
if EDW_OWB_COLLECTION_UTIL.get_item_set_cols(g_smart_update_cols,g_number_smart_update_cols,g_object_name,
'CHECK_COLUMNS_FOR_UPDATE')=false then
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n(EDW_OWB_COLLECTION_UTIL.g_status_message,FND_LOG.LEVEL_STATEMENT);
EDW_OWB_COLLECTION_UTIL.write_to_log_file_n('The smart update columns',FND_LOG.LEVEL_STATEMENT);
for i in 1..g_number_smart_update_cols loop
EDW_OWB_COLLECTION_UTIL.write_to_log_file(g_smart_update_cols(i),FND_LOG.LEVEL_STATEMENT);
l_num:=fnd_profile.value('EDW_OK_UPDATE');
g_ok_switch_update:=l_num;
l_stmt:='select running_processes from FND_CONCURRENT_QUEUES where concurrent_queue_name=''STANDARD''';