DBA Data[Home] [Help]

APPS.EDW_MAPPING_COLLECT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 34

    p_update_type varchar2,
    p_mode varchar2,
    p_explain_plan_check boolean,
    p_fact_dlog varchar2,
    p_key_set number,
    p_instance_type varchar2,
    p_load_pk number,
    p_skip_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_skip_cols number,
    p_fresh_restart boolean,
    p_op_table_space varchar2,
    p_da_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_da_cols number,
    p_da_table varchar2,
    p_pp_table varchar2,
    p_master_instance varchar2,
    p_rollback varchar2,
    p_skip_levels EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_skip_levels number,
    p_smart_update boolean,
    p_fk_use_nl number,
    p_fact_smart_update number,
    p_auto_dang_table_extn varchar2,
    p_log_dang_keys boolean,
    p_create_parent_table_records boolean,
    p_smart_update_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_smart_update_cols number,
    p_check_fk_change boolean,
    p_stg_join_nl_percentage number,
    p_ok_switch_update number,
    p_stg_make_copy_percentage number,
    p_hash_area_size number,
    p_sort_area_size number,
    p_trace boolean,
    p_read_cfig_options boolean,
    p_min_job_load_size number,
    p_sleep_time number,
    p_thread_type varchar2,
    p_max_threads number,
    p_job_status_table varchar2,
    p_analyze_frequency number,
    p_parallel_drill_down boolean,
    p_dd_status_table varchar2
    ) IS
Begin
  if p_max_threads>1 then
    --multi threading
    COLLECT_MULTI_THREAD(
    p_object_name,
    p_mapping_id,
    p_map_type,
    p_primary_src,
    p_primary_target,
    p_primary_target_name,
    p_object_type,
    p_conc_id,
    p_conc_program_name,
    p_status,
    p_fact_audit,
    p_net_change,
    p_fact_audit_name,
    p_net_change_name,
    p_fact_audit_is_name,
    p_net_change_is_name,
    p_debug,
    p_duplicate_collect,
    p_execute_flag,
    p_request_id,
    p_collection_size,
    p_parallel,
    p_table_owner,
    p_bis_owner,
    p_temp_log,
    p_forall_size,
    p_update_type,
    p_mode,
    p_explain_plan_check,
    p_fact_dlog,
    p_key_set,
    p_instance_type,
    p_load_pk,
    p_skip_cols,
    p_number_skip_cols,
    p_fresh_restart,
    p_op_table_space,
    p_da_cols,
    p_number_da_cols,
    p_da_table,
    p_pp_table,
    p_master_instance,
    p_rollback,
    p_skip_levels,
    p_number_skip_levels,
    p_smart_update,
    p_fk_use_nl,
    p_fact_smart_update,
    p_auto_dang_table_extn,
    p_log_dang_keys,
    p_create_parent_table_records,
    p_smart_update_cols,
    p_number_smart_update_cols,
    p_check_fk_change,
    p_stg_join_nl_percentage,
    p_ok_switch_update,
    p_stg_make_copy_percentage,
    p_hash_area_size,
    p_sort_area_size,
    p_trace,
    p_read_cfig_options,
    p_min_job_load_size,
    p_sleep_time,
    p_thread_type,
    p_max_threads,
    p_job_status_table,
    p_analyze_frequency,
    p_parallel_drill_down,
    p_dd_status_table
    );
Line: 181

    p_update_type,
    p_mode,
    p_explain_plan_check,
    p_fact_dlog,
    p_key_set,
    p_instance_type,
    p_load_pk,
    p_skip_cols,
    p_number_skip_cols,
    p_fresh_restart,
    p_op_table_space,
    p_da_cols,
    p_number_da_cols,
    p_da_table,
    p_pp_table,
    p_master_instance,
    p_rollback,
    p_skip_levels,
    p_number_skip_levels,
    p_smart_update,
    p_fk_use_nl,
    p_fact_smart_update,
    p_auto_dang_table_extn,
    p_log_dang_keys,
    p_create_parent_table_records,
    p_smart_update_cols,
    p_number_smart_update_cols,
    p_check_fk_change,
    p_stg_join_nl_percentage,
    p_ok_switch_update,
    p_stg_make_copy_percentage,
    p_read_cfig_options,
    p_analyze_frequency
    );
Line: 249

    p_update_type varchar2,
    p_mode varchar2,
    p_explain_plan_check boolean,
    p_fact_dlog varchar2,
    p_key_set number,
    p_instance_type varchar2,
    p_load_pk number,
    p_skip_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_skip_cols number,
    p_fresh_restart boolean,
    p_op_table_space varchar2,
    p_da_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_da_cols number,
    p_da_table varchar2,
    p_pp_table varchar2,
    p_master_instance varchar2,
    p_rollback varchar2,
    p_skip_levels EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_skip_levels number,
    p_smart_update boolean,
    p_fk_use_nl number,
    p_fact_smart_update number,
    p_auto_dang_table_extn varchar2,
    p_log_dang_keys boolean,
    p_create_parent_table_records boolean,
    p_smart_update_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_smart_update_cols number,
    p_check_fk_change boolean,
    p_stg_join_nl_percentage number,
    p_ok_switch_update number,
    p_stg_make_copy_percentage number,
    p_hash_area_size number,
    p_sort_area_size number,
    p_trace boolean,
    p_read_cfig_options boolean,
    p_min_job_load_size number,
    p_sleep_time number,
    p_thread_type varchar2,
    p_max_threads number,
    p_job_status_table varchar2,
    p_analyze_frequency number,
    p_parallel_drill_down boolean,
    p_dd_status_table varchar2
    ) IS
l_input_table varchar2(200);
Line: 359

    p_update_type,
    p_mode,
    p_explain_plan_check,
    p_fact_dlog,
    p_key_set,
    p_instance_type,
    p_load_pk,
    p_skip_cols,
    p_number_skip_cols,
    p_fresh_restart,
    p_op_table_space,
    p_da_cols,
    p_number_da_cols,
    p_da_table,
    p_pp_table,
    p_master_instance,
    p_rollback,
    p_skip_levels,
    p_number_skip_levels,
    p_smart_update,
    p_fk_use_nl,
    p_fact_smart_update,
    p_auto_dang_table_extn,
    p_log_dang_keys,
    p_create_parent_table_records,
    p_smart_update_cols,
    p_number_smart_update_cols,
    p_check_fk_change,
    p_stg_join_nl_percentage,
    p_ok_switch_update,
    p_stg_make_copy_percentage,
    null,--ok table name
    p_hash_area_size,
    p_sort_area_size,
    p_trace,
    p_read_cfig_options,
    p_job_status_table,
    null,
    null,
    null,
    p_sleep_time,
    g_parallel_drill_down
    )=false then
    p_status:=false;
Line: 427

      if EDW_OWB_COLLECTION_UTIL.update_load_input_table(
        l_input_table,
        l_ok_table,
        g_max_round,
        g_update_dlog_lookup_table,
        g_dlog_has_data,
        g_total_records,
        g_stg_copy_table_flag
        )=false then
        g_status_message:=EDW_OWB_COLLECTION_UTIL.get_status_message;
Line: 604

    if EDW_OWB_COLLECTION_UTIL.drop_table(g_update_dlog_lookup_table)=false then
      null;
Line: 648

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Pre Mapping Collection Hook',sysdate,null,'MAPPING',
  'PRE-MAP',1010,'I');
Line: 655

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1010,'U');
Line: 657

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Read Metadata',sysdate,null,'MAPPING',
  'METADATA-READ',1020,'I');
Line: 666

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1020,'U');
Line: 670

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Recover from any Previous Error',sysdate,null,'MAPPING',
  'ERROR-RECOVERY',1040,'I');
Line: 690

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1040,'U');
Line: 691

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Check Number of Records to Load',sysdate,null,'MAPPING',
  'LOAD-CHECK',1050,'I');
Line: 696

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1050,'U');
Line: 705

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Create Data Alignment Tables',sysdate,null,'MAPPING',
    'CREATE-TABLE','DATC','I');
Line: 708

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,'DATC','U');
Line: 712

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,'DATC','U');
Line: 715

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,'DATC','U');
Line: 726

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Duplicate Check',sysdate,null,'MAPPING',
  'DUPLICATE-CHECK',1100,'I');
Line: 730

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1100,'U');
Line: 742

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1100,'U');
Line: 767

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Post Mapping Collection Hook',sysdate,null,'HOOK',
  'POST-MAP',1070,'I');
Line: 774

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1070,'U');
Line: 934

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Read Metadata',sysdate,null,'MAPPING',
    'METADATA-READ',g_jobid_stmt||'1020','I');
Line: 943

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'1020','U');
Line: 1019

    p_update_type varchar2,
    p_mode varchar2,
    p_explain_plan_check boolean,
    p_fact_dlog varchar2,
    p_key_set number,
    p_instance_type varchar2,
    p_load_pk number,
    p_skip_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_skip_cols number,
    p_fresh_restart boolean,
    p_op_table_space varchar2,
    p_da_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_da_cols number,
    p_da_table varchar2,
    p_pp_table varchar2,
    p_master_instance varchar2,
    p_rollback varchar2,
    p_skip_levels EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_skip_levels number,
    p_smart_update boolean,
    p_fk_use_nl number,
    p_fact_smart_update number,
    p_auto_dang_table_extn varchar2,
    p_log_dang_keys boolean,
    p_create_parent_table_records boolean,
    p_smart_update_cols EDW_OWB_COLLECTION_UTIL.varcharTableType,
    p_number_smart_update_cols number,
    p_check_fk_change boolean,
    p_stg_join_nl_percentage number,
    p_ok_switch_update number,
    p_stg_make_copy_percentage number,
    p_read_cfig_options boolean,
    p_analyze_frequency number
    ) IS
begin
g_object_name:=p_object_name; --name of the dim or fact
Line: 1080

g_update_type :=p_update_type;
Line: 1100

g_smart_update:=p_smart_update;
Line: 1102

g_fact_smart_update:=p_fact_smart_update;
Line: 1107

g_smart_update_cols:=p_smart_update_cols;
Line: 1108

g_number_smart_update_cols:=p_number_smart_update_cols;
Line: 1111

g_ok_switch_update:=p_ok_switch_update;
Line: 1150

  write_to_log_file('g_update_type='||g_update_type);
Line: 1197

  if g_smart_update then
    write_to_log_file('g_smart_update TRUE');
Line: 1200

    write_to_log_file('g_smart_update FALSE');
Line: 1203

  write_to_log_file('g_fact_smart_update '||g_fact_smart_update);
Line: 1216

  write_to_log_file('Smart Update columns');
Line: 1217

  for i in 1..g_number_smart_update_cols loop
    write_to_log_file(g_smart_update_cols(i));
Line: 1226

  write_to_log_file('g_ok_switch_update='||g_ok_switch_update);
Line: 1246

insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Pre Mapping Collection Hook',sysdate,null,'MAPPING',
'PRE-MAP',1010,'I');
Line: 1255

insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1010,'U');
Line: 1261

insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Read Metadata',sysdate,null,'MAPPING',
'METADATA-READ',1020,'I');
Line: 1270

insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1020,'U');
Line: 1278

insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Recover from any Previous Error',sysdate,null,'MAPPING',
'ERROR-RECOVERY',1040,'I');
Line: 1299

insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1040,'U');
Line: 1300

insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Check Number of Records to Load',sysdate,null,'MAPPING',
'LOAD-CHECK',1050,'I');
Line: 1306

insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1050,'U');
Line: 1316

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Create Data Alignment Tables',sysdate,null,'MAPPING',
  'CREATE-TABLE','DATC','I');
Line: 1319

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,'DATC','U');
Line: 1324

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,'DATC','U');
Line: 1328

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,'DATC','U');
Line: 1340

insert_into_load_progress_d(g_load_pk,g_primary_target_name,'Duplicate Check',sysdate,null,'MAPPING',
'DUPLICATE-CHECK',1100,'I');
Line: 1344

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1100,'U');
Line: 1348

insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,1100,'U');
Line: 1408

      insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Generate Explain Plan',sysdate,null,'MAPPING',
      'EXPLAIN-PLAN',g_jobid_stmt||'1080','I');
Line: 1411

        insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'1080','U');
Line: 1414

          insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Generate Dimension Lookup Tables',sysdate,
          null,'MAPPING','LOOKUP',g_jobid_stmt||'1090','I');
Line: 1419

          insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'1090','U');
Line: 1422

        insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'1080','U');
Line: 1428

    select_fact_audit;--make the stmts
Line: 1430

      write_to_log_file_n('select_fact_audit has errors');
Line: 1436

    select_net_change;--make the stmts
Line: 1438

      write_to_log_file_n('select_net_change ERROR');
Line: 1443

    make_data_into_dlog_stmt;--if this is a derived fact then we need to move the data into dlog for updates
Line: 1471

      insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Mark Records for Processing',sysdate,null,
      'MAPPING','UPDATE',g_jobid_stmt||'MKRP'||l_count,'I');
Line: 1473

      if g_skip_ilog_update=false then
        make_records_processing; --makes ready records to processing.
Line: 1476

        g_skip_ilog_update:=false;
Line: 1478

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MKRP'||l_count,'U');
Line: 1485

    g_skip_ilog_update:=false;
Line: 1506

    if g_type_ok_generation='UPDATE' then
      --else, make_records_processing will create the ok table
      insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Mark Records as Processed',sysdate,null,
      'MAPPING','UPDATE',g_jobid_stmt||'MKRPP'||l_count,'I');
Line: 1510

      if update_ok_status_2= false then
        return false;
Line: 1513

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MKRPP'||l_count,'U');
Line: 1521

    we only need to insert into temp log and not worry about updates. the logic for updates are handled
    in get_lowest_level_log in EDW_ALL_COLLECT
    this ing is only for the lowest level. so we need to control that with g_temp_log
    also true for facts
    */
    if g_temp_log then
      if EDW_OWB_COLLECTION_UTIL.insert_temp_log_table(
          g_object_name,
          g_object_type,
          g_conc_program_id,
          g_ins_instance_name,
          g_ins_request_id_table,
          g_ins_rows_ready,
          g_ins_rows_processed,
          g_ins_rows_collected,
          g_ins_rows_dangling,
          g_ins_rows_duplicate,
          g_ins_rows_error,
          g_total_records,
          g_total_insert,
          g_total_update,
          g_total_delete,
          g_number_ins_req_coll) = false then
        g_status_message:=EDW_OWB_COLLECTION_UTIL.g_status_message;
Line: 1559

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Load Into PP Table',sysdate,null,
    'MAPPING','INSERT',g_jobid_stmt||'LOADPP','I');
Line: 1562

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'LOADPP','U');
Line: 1565

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'LOADPP','U');
Line: 1615

  l_stmt:='select 1 from '||g_surr_table||' having count(*)>1 group by row_id';
Line: 1647

    l_stmt:=l_stmt||' as select row_id';
Line: 1668

    l_stmt:=l_stmt||' as select * from  '||l_table1;
Line: 1949

l_stmt:=l_stmt||' as select ';
Line: 1988

if g_update_type='DELETE-INSERT' then
  l_stmt:=l_stmt||','||g_opcode_table||'.'||g_fstgPKName||' '||g_fstgPKName||','||
  g_opcode_table||'.CREATION_DATE CREATION_DATE';
Line: 2031

  l_stmt:=' select ';
Line: 2078

procedure make_hd_insert_stmt is
l_divide number:=2;
Line: 2097

    write_to_log_file_n('In make_hd_insert_stmt');
Line: 2106

  if g_smart_update then
    if edw_owb_collection_util.get_db_columns_for_table(
      g_factTableName,
      l_cols,
      l_cols_datatype,
      l_data_length,
      l_num_distinct,
      l_num_nulls,
      l_avg_col_length,
      l_number_cols,
      g_table_owner)=false then
      g_status_message:=EDW_OWB_COLLECTION_UTIL.g_status_message;
Line: 2124

    l_number_itemset_cols:=g_number_smart_update_cols;
Line: 2125

    l_itemset_cols:=g_smart_update_cols;
Line: 2154

           ',cannot do smart update');
Line: 2156

          g_smart_update:=false;
Line: 2161

    if g_smart_update then
      l_count:=0;
Line: 2168

      if g_fact_smart_update is not null and g_fact_smart_update>0 then
        if l_count>g_fact_smart_update then
          g_smart_update:=false;
Line: 2185

    if g_smart_update then
      write_to_log_file_n('Smart update TRUE');
Line: 2188

      write_to_log_file_n('Smart update FALSE');
Line: 2191

  if g_smart_update then
    g_hd_insert_stmt:='create table '||g_hold_table_temp||' tablespace '||g_op_table_space;
Line: 2194

    g_hd_insert_stmt:='create table '||g_hold_table||' tablespace '||g_op_table_space;
Line: 2212

    g_hd_insert_stmt:=g_hd_insert_stmt||' storage(initial '||l_extent||' next '||
    l_extent||' pctincrease 0 MAXEXTENTS 2147483645) ';
Line: 2216

    g_hd_insert_stmt:=g_hd_insert_stmt||' parallel (degree '||g_parallel||') ';
Line: 2218

  g_hd_insert_stmt:=g_hd_insert_stmt||' as select ';
Line: 2220

    g_hd_insert_stmt:=g_hd_insert_stmt||' /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 2222

    g_hd_insert_stmt:=g_hd_insert_stmt||' /*+ORDERED*/ ';
Line: 2225

    g_hd_insert_stmt:=g_hd_insert_stmt||' /*+PARALLEL ('||g_fstgTableName||','||g_parallel||')*/ ';
Line: 2229

      if g_update_type='DELETE-INSERT' then
        if g_fact_mapping_columns(i) <> g_factPKNameKey then
          g_hd_insert_stmt:=g_hd_insert_stmt||g_fstg_mapping_columns(i)||' '||g_fact_mapping_columns(i)||',';
Line: 2236

            g_hd_insert_stmt:=g_hd_insert_stmt||g_fstg_mapping_columns(i)||' '||g_fact_mapping_columns(i)||',';
Line: 2240

            g_hd_insert_stmt:=g_hd_insert_stmt||g_fstg_mapping_columns(i)||' '||g_fact_mapping_columns(i)||',';
Line: 2246

  if g_update_type='DELETE-INSERT' then
    g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.'||g_fstgPKNameKey||' '||g_factPKNameKey||',';
Line: 2248

    g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.CREATION_DATE CREATION_DATE,';
Line: 2251

      g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.'||g_fstgPKNameKey||' '||g_factPKNameKey||',';
Line: 2256

     g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.'||g_fstgActualFKName(i)||' '||g_factFKName(i)||',';
Line: 2258

     g_hd_insert_stmt:=g_hd_insert_stmt||g_fstg_fk_load_value(i)||' '||g_factFKName(i)||',';
Line: 2260

     g_hd_insert_stmt:=g_hd_insert_stmt||g_fstgTableName||'.'||g_fstgActualFKName(i)||' '||g_factFKName(i)||',';
Line: 2264

  g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.row_id1 row_id1 from '||g_surr_table||',';
Line: 2266

    g_hd_insert_stmt:=g_hd_insert_stmt||g_stg_copy_table||' '||g_fstgTableName;
Line: 2267

    g_hd_insert_stmt:=g_hd_insert_stmt||' where '||g_surr_table||'.operation_code=1 and '||
    g_fstgTableName||'.rowid='||g_surr_table||'.row_id_copy';
Line: 2270

    g_hd_insert_stmt:=g_hd_insert_stmt||g_user_measure_table||' '||g_fstgTableName;
Line: 2271

    g_hd_insert_stmt:=g_hd_insert_stmt||' where '||g_surr_table||'.operation_code=1 and '||
    g_fstgTableName||'.rowid='||g_surr_table||'.row_id_copy';
Line: 2274

    g_hd_insert_stmt:=g_hd_insert_stmt||g_fstgTableName;
Line: 2275

    g_hd_insert_stmt:=g_hd_insert_stmt||' where '||g_surr_table||'.operation_code=1 and '||
    g_fstgTableName||'.rowid='||g_surr_table||'.row_id';
Line: 2279

    g_hd_insert_stmt:=g_hd_insert_stmt||' group by ';
Line: 2282

        g_hd_insert_stmt:=g_hd_insert_stmt||g_fstgTableName||'.'||g_groupby_cols(i)||',';
Line: 2287

        g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.'||g_fstgActualFKName(i)||',';
Line: 2289

        g_hd_insert_stmt:=g_hd_insert_stmt||g_fstgTableName||'.'||g_fstgActualFKName(i)||',';
Line: 2292

    g_hd_insert_stmt:=g_hd_insert_stmt||g_surr_table||'.row_id1 ';
Line: 2296

    write_to_log_file_n('g_hd_insert_stmt is '||g_hd_insert_stmt);
Line: 2304

procedure make_insert_update_stmt IS
l_stmt varchar2(30000);
Line: 2311

write_to_debug_n('In make_insert_update_stmt');
Line: 2319

      g_num_ff_map_cols,'LAST_UPDATE_DATE')= false then
  g_last_update_date_flag:=true;
Line: 2322

  g_last_update_date_flag:=false;
Line: 2333

  l_stmt:=l_stmt||' as select ';
Line: 2364

  g_insert_stmt_ctas:='create table '||g_insert_ctas_table||' tablespace '||g_op_table_space;
Line: 2366

    g_insert_stmt_ctas:=g_insert_stmt_ctas||' parallel (degree '||g_parallel||')';
Line: 2368

  g_insert_stmt_ctas:=g_insert_stmt_ctas||'  as ';
Line: 2369

  g_insert_stmt_row:=' insert into '||g_factTableName||'( ';
Line: 2370

  l_stmt:=' insert ';
Line: 2379

    g_insert_stmt_row:=g_insert_stmt_row||g_factPKNameKey||',';
Line: 2385

        g_insert_stmt_row:=g_insert_stmt_row||g_fact_mapping_columns(i)||',';
Line: 2390

  g_insert_stmt_row:=substr(g_insert_stmt_row,1,length(g_insert_stmt_row)-1);
Line: 2394

   g_insert_stmt_row:=g_insert_stmt_row||','||g_factFKName(i)||' ';
Line: 2398

    g_insert_stmt_row:=g_insert_stmt_row||',CREATION_DATE ';
Line: 2400

  if g_last_update_date_flag then
    l_stmt:=l_stmt||',LAST_UPDATE_DATE ';
Line: 2402

    g_insert_stmt_row:=g_insert_stmt_row||',LAST_UPDATE_DATE ';
Line: 2404

  l_stmt:=l_stmt||' ) select ';
Line: 2405

  g_insert_stmt_row:=g_insert_stmt_row||' ) select ';
Line: 2408

    g_insert_stmt_ctas:=g_insert_stmt_ctas||' /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 2411

    g_insert_stmt_ctas:=g_insert_stmt_ctas||' /*+ORDERED*/ ';
Line: 2415

    g_insert_stmt_ctas:=g_insert_stmt_ctas||' /*+PARALLEL ('||g_fstgTableName||','||
    g_parallel||')*/  ';
Line: 2420

    g_insert_stmt_row:=g_insert_stmt_row||g_factPKNameKey||',';
Line: 2421

    g_insert_stmt_ctas:=g_insert_stmt_ctas||g_surr_table||'.'||g_fstgPKNameKey||' '||g_factPKNameKey||',';
Line: 2427

        g_insert_stmt_row:=g_insert_stmt_row||g_fact_mapping_columns(i)||',';
Line: 2428

        g_insert_stmt_ctas:=g_insert_stmt_ctas||g_fstg_mapping_columns(i)||' '||g_fact_mapping_columns(i)||',';
Line: 2433

  g_insert_stmt_row:=substr(g_insert_stmt_row,1,length(g_insert_stmt_row)-1);
Line: 2434

  g_insert_stmt_ctas:=substr(g_insert_stmt_ctas,1,length(g_insert_stmt_ctas)-1);
Line: 2437

    g_insert_stmt_row:=g_insert_stmt_row||','||g_factFKName(i)||' ';
Line: 2440

      g_insert_stmt_ctas:=g_insert_stmt_ctas||','||g_surr_table||'.'||g_fstgActualFKName(i)||' '||
      g_factFKName(i)||' ';
Line: 2444

      g_insert_stmt_ctas:=g_insert_stmt_ctas||','||g_fstg_fk_load_value(i)||' '||g_factFKName(i)||' ';
Line: 2447

      g_insert_stmt_ctas:=g_insert_stmt_ctas||','||g_fstgTableName||'.'||g_fstgActualFKName(i)||' '||
      g_factFKName(i)||' ';
Line: 2453

    g_insert_stmt_row:=g_insert_stmt_row||',SYSDATE ';
Line: 2454

    g_insert_stmt_ctas:=g_insert_stmt_ctas||',SYSDATE CREATION_DATE ';
Line: 2456

  if g_last_update_date_flag then
    l_stmt:=l_stmt||',SYSDATE ';
Line: 2458

    g_insert_stmt_row:=g_insert_stmt_row||',SYSDATE ';
Line: 2459

    g_insert_stmt_ctas:=g_insert_stmt_ctas||',SYSDATE LAST_UPDATE_DATE ';
Line: 2464

g_insert_stmt_ctas:=g_insert_stmt_ctas||' from '||g_surr_table||',';
Line: 2469

  g_insert_stmt_ctas:=g_insert_stmt_ctas||g_stg_copy_table||' '||g_fstgTableName;
Line: 2470

  g_insert_stmt_ctas:=g_insert_stmt_ctas||' where '||g_surr_table||'.operation_code=0 and '||
  g_fstgTableName||'.rowid='||g_surr_table||'.row_id_copy';
Line: 2476

  g_insert_stmt_ctas:=g_insert_stmt_ctas||g_user_measure_table||' '||g_fstgTableName;
Line: 2477

  g_insert_stmt_ctas:=g_insert_stmt_ctas||' where '||g_surr_table||'.operation_code=0 and '||
  g_fstgTableName||'.rowid='||g_surr_table||'.row_id_copy';
Line: 2483

  g_insert_stmt_ctas:=g_insert_stmt_ctas||g_fstgTableName;
Line: 2484

  g_insert_stmt_ctas:=g_insert_stmt_ctas||' where '||g_surr_table||'.operation_code=0 and '||
  g_fstgTableName||'.rowid='||g_surr_table||'.row_id';
Line: 2487

g_insert_stmt_row:=g_insert_stmt_row||' from '||g_insert_ctas_table||' where rowid=:a';
Line: 2490

  g_insert_stmt_ctas:=g_insert_stmt_ctas||' group by ';
Line: 2494

      g_insert_stmt_ctas:=g_insert_stmt_ctas||g_fstgTableName||'.'||g_groupby_cols(i)||',';
Line: 2500

      g_insert_stmt_ctas:=g_insert_stmt_ctas||g_surr_table||'.'||g_fstgActualFKName(i)||',';
Line: 2503

      g_insert_stmt_ctas:=g_insert_stmt_ctas||g_fstgTableName||'.'||g_fstgActualFKName(i)||',';
Line: 2507

  g_insert_stmt_ctas:=substr(g_insert_stmt_ctas,1,length(g_insert_stmt_ctas)-1);
Line: 2509

g_insert_stmt:=l_stmt;
Line: 2511

  write_to_log_file_n('Insert stmt '||g_insert_stmt);
Line: 2514

  write_to_log_file_n('Insert stmt row-by-row '||g_insert_stmt_row);
Line: 2517

  g_audit_net_insert_stmt_row:='insert into '||g_factTableName||'( ';
Line: 2519

    l_stmt:='insert into '||g_factTableName||'( ';
Line: 2522

      l_stmt:=' insert /*+PARALLEL ('||g_factTableName||','||g_parallel||') */ into '||
      g_factTableName||' ( ';
Line: 2525

      l_stmt:=' insert into '||g_factTableName||'( ';
Line: 2531

      g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||g_fact_mapping_columns(i)||',';
Line: 2535

  g_audit_net_insert_stmt_row:=substr(g_audit_net_insert_stmt_row,1,length(g_audit_net_insert_stmt_row)-1);
Line: 2539

   g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||','||g_factFKName(i)||' ';
Line: 2543

    g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||',CREATION_DATE ';
Line: 2545

  if g_last_update_date_flag then
    l_stmt:=l_stmt||',LAST_UPDATE_DATE ';
Line: 2547

    g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||',LAST_UPDATE_DATE ';
Line: 2549

  l_stmt:=l_stmt||' ) select ';
Line: 2550

  g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||') select ';
Line: 2557

      g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||g_fact_mapping_columns(i)||',';
Line: 2561

  g_audit_net_insert_stmt_row:=substr(g_audit_net_insert_stmt_row,1,length(g_audit_net_insert_stmt_row)-1);
Line: 2565

    g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||','||g_factFKName(i)||' ';
Line: 2569

    g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||',SYSDATE ';
Line: 2571

  if g_last_update_date_flag then
    l_stmt:=l_stmt||',SYSDATE ';
Line: 2573

    g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||',SYSDATE ';
Line: 2576

  g_audit_net_insert_stmt_row:=g_audit_net_insert_stmt_row||' from '||g_fact_audit_net_table||
  ' where rowid=:a';
Line: 2578

  g_audit_net_insert_stmt:=l_stmt;
Line: 2580

    write_to_log_file_n('g_audit_net_insert_stmt '||g_audit_net_insert_stmt);
Line: 2583

    write_to_log_file_n('g_audit_net_insert_stmt_row '||g_audit_net_insert_stmt_row);
Line: 2587

if g_update_type='DELETE-INSERT' then
  --g_update_stmt:='insert /*+APPEND*/ into '||g_factTableName||'( ';
Line: 2591

    g_update_stmt:='insert into '||g_factTableName||'( ';
Line: 2594

      l_stmt:=' insert /*+PARALLEL ('||g_factTableName||','||g_parallel||') */ into '||
      g_factTableName||' ( ';
Line: 2597

      l_stmt:=' insert into '||g_factTableName||'( ';
Line: 2602

      g_update_stmt:=g_update_stmt||g_fact_mapping_columns(i)||',';
Line: 2606

   g_update_stmt:=g_update_stmt||g_factFKName(i)||',';
Line: 2609

    g_update_stmt:=g_update_stmt||'CREATION_DATE,';
Line: 2611

  if g_last_update_date_flag then
    g_update_stmt:=g_update_stmt||'LAST_UPDATE_DATE,';
Line: 2614

  g_update_stmt:=substr(g_update_stmt,1,length(g_update_stmt)-1);
Line: 2615

  g_update_stmt:=g_update_stmt||' )  select ';
Line: 2618

      g_update_stmt:=g_update_stmt||g_fact_mapping_columns(i)||',';
Line: 2622

   g_update_stmt:=g_update_stmt||g_factFKName(i)||',';
Line: 2625

    g_update_stmt:=g_update_stmt||g_hold_table||'.CREATION_DATE,';
Line: 2627

  if g_last_update_date_flag then
    g_update_stmt:=g_update_stmt||'SYSDATE,';
Line: 2630

  g_update_stmt:=substr(g_update_stmt,1,length(g_update_stmt)-1);
Line: 2631

  g_update_stmt:=g_update_stmt||' from '||g_hold_table;
Line: 2633

  g_update_stmt_row:=' update '||g_factTableName||' set ( ';
Line: 2634

  if g_update_type='ROW-BY-ROW' then
    g_update_stmt:=' update '||g_factTableName||' set ( ';
Line: 2636

  elsif g_update_type='MASS' then
    g_update_stmt:=' update /*+ ORDERED USE_NL('||g_factTableName||')*/ ';
Line: 2640

        g_update_stmt:=g_update_stmt||' /*+PARALLEL ('||g_factTableName||','||g_parallel||') */ ';
Line: 2643

    g_update_stmt:=g_update_stmt||g_factTableName||' set ( ';
Line: 2650

        g_update_stmt:=g_update_stmt||g_fact_mapping_columns(i)||',';
Line: 2651

        g_update_stmt_row:=g_update_stmt_row||g_fact_mapping_columns(i)||',';
Line: 2656

   g_update_stmt:=g_update_stmt||g_factFKName(i)||',';
Line: 2657

   g_update_stmt_row:=g_update_stmt_row||g_factFKName(i)||',';
Line: 2659

  if g_last_update_date_flag then
    g_update_stmt:=g_update_stmt||' LAST_UPDATE_DATE ';
Line: 2661

    g_update_stmt_row:=g_update_stmt_row||' LAST_UPDATE_DATE ';
Line: 2663

    g_update_stmt:=substr(g_update_stmt,1,length(g_update_stmt)-1);
Line: 2664

    g_update_stmt_row:=substr(g_update_stmt_row,1,length(g_update_stmt_row)-1);
Line: 2666

  g_update_stmt:=g_update_stmt||')=( select ';
Line: 2667

  g_update_stmt_row:=g_update_stmt_row||')=( select ';
Line: 2671

        g_update_stmt:=g_update_stmt||g_fact_mapping_columns(i)||',';
Line: 2672

        g_update_stmt_row:=g_update_stmt_row||g_fact_mapping_columns(i)||',';
Line: 2677

   g_update_stmt:=g_update_stmt||g_factFKName(i)||',';
Line: 2678

   g_update_stmt_row:=g_update_stmt_row||g_factFKName(i)||',';
Line: 2680

  if g_last_update_date_flag then
    g_update_stmt:=g_update_stmt||' SYSDATE ';
Line: 2682

    g_update_stmt_row:=g_update_stmt_row||' SYSDATE ';
Line: 2684

    g_update_stmt:=substr(g_update_stmt,1,length(g_update_stmt)-1);
Line: 2685

    g_update_stmt_row:=substr(g_update_stmt_row,1,length(g_update_stmt_row)-1);
Line: 2688

  g_update_stmt_row:=g_update_stmt_row||' from '||g_hold_table||' where '||g_hold_table||'.row_id1=:a) where '||
      g_factTableName||'.rowid=:b';
Line: 2690

  if g_update_type='ROW-BY-ROW' then
    g_update_stmt:=g_update_stmt||' from '||g_hold_table||' where '||g_hold_table||'.row_id1=:a) where '||
      g_factTableName||'.rowid=:b';
Line: 2693

  elsif g_update_type='MASS' then
    g_update_stmt:=g_update_stmt||' from '||g_hold_table||' where '||g_factTableName||'.rowid='||
      g_hold_table||'.row_id1) where '||g_factTableName||'.rowid in (select row_id1 from '||g_hold_table||')';
Line: 2699

  write_to_debug_n('Update  stmt '||g_update_stmt);
Line: 2700

  write_to_debug_n('Update  stmt for ROW_BY_ROW is '||g_update_stmt_row);
Line: 2703

if g_update_type='ROW-BY-ROW' then
  g_delete_stmt :='delete '||g_factTableName||' where rowid=:a ';
Line: 2705

elsif g_update_type='MASS' or g_update_type='DELETE-INSERT' then
  g_delete_stmt :='delete /*+ ORDERED USE_NL('||g_factTableName||')*/ '||
  g_factTableName||' where rowid in (select row_id1 from '||g_surr_table||' where operation_code=2 ';
Line: 2709

    g_delete_stmt :=g_delete_stmt||'and row_id1<>''I'')';
Line: 2711

    g_delete_stmt :=g_delete_stmt||')';
Line: 2715

  write_to_debug_n('Delete  stmt '||g_delete_stmt);
Line: 2724

set the insert and update flags
*/
procedure set_execute_flags is
Begin
  g_insert_flag:=false;
Line: 2729

  g_update_flag:=false;
Line: 2732

    g_insert_flag:=true;
Line: 2734

      write_to_log_file_n('Insert Needed');
Line: 2737

    g_insert_flag:=false;
Line: 2739

      write_to_log_file_n('NO Insert Needed');
Line: 2744

    g_update_flag:=true;
Line: 2746

      write_to_log_file_n('Update Needed');
Line: 2749

    g_update_flag:=false;
Line: 2751

      write_to_log_file_n('NO Update Needed');
Line: 2756

    g_delete_flag:=true;
Line: 2758

      write_to_log_file_n('Delete Needed');
Line: 2761

    g_delete_flag:=false;
Line: 2763

      write_to_log_file_n('NO Delete Needed');
Line: 2968

        g_update_type||''','''||l_low_system_mem||''','''||l_rollback||''','''||l_status_table(l_number_jobs)||''');');
Line: 2988

          argument13=>g_update_type,
          argument14=>l_low_system_mem,
          argument15=>l_rollback,
          argument16=>l_status_table(l_number_jobs));
Line: 3004

          g_update_type||''','''||l_low_system_mem||''','''||l_rollback||''','''||l_status_table(l_number_jobs)||''');');
Line: 3039

        g_update_type,
        l_low_system_mem,
        l_rollback,
        l_status_table(l_number_jobs)
        );
Line: 3058

      g_stmt:='select status,count from '||l_status_table(i);
Line: 3075

      if EDW_OWB_COLLECTION_UTIL.delete_conc_program(
        l_temp_conc_short_name,
        l_temp_exe_name,
        l_bis_short_name,
        'SHORT')=false then
        null;
Line: 3110

p_update_type varchar2,
p_low_system_mem varchar2,
p_rollback varchar2,
p_status_table varchar2
) is
Begin
  retcode:='0';
Line: 3130

  p_update_type,
  p_low_system_mem,
  p_rollback,
  p_status_table);
Line: 3157

p_update_type varchar2,
p_low_system_mem varchar2,
p_rollback varchar2,
p_status_table varchar2
) is
l_file_name varchar2(200);
Line: 3212

  g_stmt:=g_stmt||' as select row_id from '||p_dup_hold_table||' where row_num between '||p_low_end||' and '||
  p_high_end;
Line: 3228

  p_update_type,
  g_low_system_mem,
  p_fstgTableName,
  l_dup_hold_table,
  g_rollback);
Line: 3259

  g_update_type,
  g_low_system_mem,
  g_fstgTableName,
  g_dup_hold_table,
  g_rollback);
Line: 3273

p_update_type varchar2,
p_low_system_mem boolean,
p_fstgTableName varchar2,
p_dup_hold_table varchar2,
p_rollback varchar2
) return number is
l_stmt varchar2(5000);
Line: 3282

l_update_type varchar2(400);
Line: 3297

  l_update_type:=p_update_type;
Line: 3299

    l_update_type:='ROW-BY-ROW';
Line: 3301

  if l_update_type='MASS' or l_update_type='DELETE-INSERT' then
    l_stmt:='update /*+ORDERED USE_NL('||p_fstgTableName||')*/ ';
Line: 3306

    l_stmt:=l_stmt||p_fstgTableName||' set collection_status=:a where rowid in (select row_id from '||
    p_dup_hold_table||') ';
Line: 3319

  elsif l_update_type='ROW-BY-ROW' then
    l_stmt:='update '||p_fstgTableName||' set collection_status=:b where rowid=:a';
Line: 3321

    l_stmt1:='select row_id from '||p_dup_hold_table;
Line: 3336

      write_to_log_file('Updated '||l_total_count||' rows in '||p_fstgTableName||' to '||l_status||get_time);
Line: 3347

function execute_surr_insert return boolean is
Begin
  if g_debug then
    write_to_log_file_n('In execute_surr_insert'||get_time);
Line: 3352

  if g_use_mti=false then --if true, insert_fm_ff_table will populate g_user_fk_table
    if g_user_fk_table <> g_fstgTableName then
      if create_user_fk_table=false then
        return false;
Line: 3399

      execute immediate g_surrogate_stmt; --this is create table as select
Line: 3420

  set_execute_flags; --is there insert and or update
Line: 3439

to boost the performance of the updates
*/
function create_hd_table(p_count number) return boolean is
l_stmt varchar2(32000);
Line: 3458

  if g_smart_update then
    if EDW_OWB_COLLECTION_UTIL.drop_table(g_hold_table_temp) = false then
      null;
Line: 3468

      write_to_log_file_n('Going to execute g_hd_insert_stmt'||get_time);
Line: 3470

    execute immediate g_hd_insert_stmt;
Line: 3479

    write_to_log_file('Problem stmt '||g_hd_insert_stmt);
Line: 3482

  if g_smart_update then
    l_number_itemset_cols:=g_number_smart_update_cols;
Line: 3484

    l_itemset_cols:=g_smart_update_cols;
Line: 3509

          if l_cols(i)<>'LAST_UPDATE_DATE' and l_cols(i)<>'CREATION_DATE' and l_cols(i)<>'ROW_ID1' then
            l_cols_flag(i):=true;
Line: 3520

            if l_cols(i)<>'LAST_UPDATE_DATE' and l_cols(i)<>'CREATION_DATE' and l_cols(i)<>'ROW_ID1' then
              l_cols_flag(i):=true;
Line: 3560

      l_stmt:=l_stmt||'  as select /*+ordered use_nl('||g_factTableName||')*/ ';
Line: 3562

      l_stmt:=l_stmt||'  as select /*+ordered*/ ';
Line: 3604

  if g_smart_update then
    if EDW_OWB_COLLECTION_UTIL.drop_table(g_hold_table_temp) = false then
      null;
Line: 3618

    l_stmt:=l_stmt||' as select row_id1 row_id from '||g_hold_table;
Line: 3639

function execute_update_stmt return number is
l_stmt varchar2(10000);
Line: 3645

l_total_update number:=0;
Line: 3646

l_update_type varchar2(400);
Line: 3650

    write_to_log_file_n('In execute_update_stmt'||get_time);
Line: 3652

  l_update_type:=g_update_type;
Line: 3654

    l_update_type:='ROW-BY-ROW';
Line: 3658

  <>

  if l_update_type='ROW-BY-ROW' then
    l_stmt:='create table '||l_hold_table||' tablespace '||g_op_table_space;
Line: 3665

    l_stmt:=l_stmt||'  as select row_id1 from '||g_hold_table;
Line: 3676

    l_stmt:='select row_id1 from '||l_hold_table;
Line: 3684

          execute immediate g_update_stmt_row using l_rowid(i),l_rowid(i);
Line: 3686

        l_total_update:=l_total_update+l_count;
Line: 3696

        execute immediate g_update_stmt_row using l_rowid(i),l_rowid(i);
Line: 3698

      l_total_update:=l_total_update+l_count;
Line: 3703

  elsif l_update_type='MASS' then
    begin
      EDW_OWB_COLLECTION_UTIL.set_rollback(g_rollback);
Line: 3706

      execute immediate g_update_stmt;
Line: 3707

      l_total_update:=sql%rowcount;
Line: 3712

        write_to_log_file_n('Memory issue with Mass Update. Retrying using ROW_BY_ROW');
Line: 3713

        l_update_type:='ROW-BY-ROW';
Line: 3714

        goto start_update;
Line: 3720

        goto start_update;
Line: 3725

      write_to_log_file('Problem stmt '||g_update_stmt);
Line: 3728

  elsif l_update_type='DELETE-INSERT' then
    --first delete
    l_stmt:='delete '||g_factTableName||' where exists (select 1 from '||g_hold_table||' where '||
      g_hold_table||'.row_id1='||g_factTableName||'.rowid)';
Line: 3739

        write_to_log_file_n('Deleted '||sql%rowcount||' rows'||get_time);
Line: 3750

        write_to_log_file_n('Going to execute g_update_stmt'||get_time);
Line: 3753

      execute immediate g_update_stmt;
Line: 3754

      l_total_update:=sql%rowcount;
Line: 3759

      write_to_log_file('Problem stmt '||g_update_stmt);
Line: 3765

    write_to_log_file_n('Updated '||l_total_update||' records'||get_time);
Line: 3768

  return l_total_update;
Line: 3776

function execute_delete_stmt return number is
l_stmt varchar2(10000);
Line: 3782

l_total_delete number:=0;
Line: 3785

    write_to_log_file_n('In execute_delete_stmt'||get_time);
Line: 3787

  if g_update_type='ROW-BY-ROW' then
    l_stmt:='select row_id1 from '||g_surr_table||' where operation_code=2';
Line: 3796

          execute immediate g_delete_stmt using l_rowid(i);
Line: 3798

        l_total_delete:=l_total_delete+l_count;
Line: 3808

        execute immediate g_delete_stmt using l_rowid(i);
Line: 3810

      l_total_delete:=l_total_delete+l_count;
Line: 3812

  elsif g_update_type='MASS' or g_update_type='DELETE-INSERT' then
    begin
      --create a rowid table here and use that for deletes
      EDW_OWB_COLLECTION_UTIL.set_rollback(g_rollback);
Line: 3816

      execute immediate g_delete_stmt;
Line: 3817

      l_total_delete:=sql%rowcount;
Line: 3822

      write_to_log_file('Problem stmt '||g_delete_stmt);
Line: 3828

    write_to_log_file_n('Deleted '||l_total_delete||' records'||get_time);
Line: 3831

  return l_total_delete;
Line: 3839

function execute_fa_nc_insert(p_flag varchar2) return boolean is
Begin
  if p_flag='INSERT' then
    --here, if there is fact audit or net change, insert into those tables
    if g_fact_audit then
      if insert_fa_fact_insert=false then
        return false;
Line: 3849

      if insert_nc_fact_insert=false then
        return false;
Line: 3860

  if p_flag='UPDATE' then
    if g_fact_audit then
      if insert_fa_fact_update = false then
        return false;
Line: 3867

      if insert_nc_fact_update = false then
        return false;
Line: 3880

function execute_insert_update_delete(p_count number) return boolean is
l_count number;
Line: 3885

    write_to_log_file_n('In execute_insert_update_delete'||get_time);
Line: 3888

  if g_insert_flag then
    if execute_insert_stmt(p_count)=false then
      return false;
Line: 3893

  if g_update_flag and g_skip_update=false then
    --create the hold table on the fly insert into it all the values
    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Create Hold Table',sysdate,
    null,'MAPPING','CREATE-TABLE',g_jobid_stmt||'CHT'||p_count,'I');
Line: 3899

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'CHT'||p_count,'U');
Line: 3902

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'CHT'||p_count,'U');
Line: 3908

          insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Move Update data into dlog ',sysdate,
          null,'MAPPING','INSERT',g_jobid_stmt||'MUDL'||p_count,'I');
Line: 3910

          if excecute_data_into_dlog('UPDATE') = false then
            write_to_log_file_n('excecute_data_into_dlog returned with error');
Line: 3912

            insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MUDL'||p_count,'U');
Line: 3915

          insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MUDL'||p_count,'U');
Line: 3919

        insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Process Audit or Netchange Records',sysdate,
        null,'MAPPING','UPDATE',g_jobid_stmt||'PANU'||p_count,'I');
Line: 3921

        if execute_fa_nc_insert('UPDATE') = false then
          insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'PANU'||p_count,'U');
Line: 3925

        insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'PANU'||p_count,'U');
Line: 3927

      insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Update '||g_primary_target_name,sysdate,
      null,'MAPPING','UPDATE',g_jobid_stmt||'UPDATE'||p_count,'I');
Line: 3943

      l_count:=execute_update_stmt;
Line: 3944

      g_total_update:=l_count;
Line: 3951

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'UPDATE'||p_count,'U');
Line: 3954

      g_total_update:=0;
Line: 3956

        write_to_log_file_n('No change to update');
Line: 3962

    if g_delete_flag and g_skip_delete=false then
      if g_mapping_type='FACT' then
        if g_is_source=true or g_is_custom_source=true then
          if g_is_delete_trigger_imp=false then
            insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Move Delete data into dlog ',sysdate,
            null,'MAPPING','INSERT',g_jobid_stmt||'MDDDL'||p_count,'I');
Line: 3968

            if excecute_data_into_dlog('DELETE') = false then
              write_to_log_file_n('excecute_data_into_dlog returned with error');
Line: 3970

              insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MDDDL'||p_count,'U');
Line: 3973

            insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MDDDL'||p_count,'U');
Line: 3977

      insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Delete '||g_primary_target_name,sysdate,
      null,'MAPPING','DELETE',g_jobid_stmt||'DELETE'||p_count,'I');
Line: 3979

      l_count:=execute_delete_stmt;
Line: 3980

      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'DELETE'||p_count,'U');
Line: 3981

      g_total_delete:=l_count;
Line: 3988

  how is deletes to be handled in fact audit and net change?
  */
  return true;
Line: 4015

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Create User Measure FK Table',
    sysdate,null,'MAPPING','CREATE-TABLE',g_jobid_stmt||'CRUSMESFK'||p_count,'I');
Line: 4022

    if insert_fm_ff_table=false then
      g_status:=false;
Line: 4027

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'CRUSMESFK'||p_count,'U');
Line: 4029

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Create OP Code Table',sysdate,null,
  'MAPPING','CREATE-TABLE',g_jobid_stmt||'CROPTAB'||p_count,'I');
Line: 4042

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'CROPTAB'||p_count,'U');
Line: 4056

  make_hd_insert_stmt;
Line: 4060

  make_insert_update_stmt;
Line: 4064

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Create FK Key Table',sysdate,null,
  'MAPPING','CREATE-TABLE',g_jobid_stmt||'CRFKT'||p_count,'I');
Line: 4066

  if execute_surr_insert=false then
    write_to_log_file_n('execute_surr_insert returned with error');
Line: 4071

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'CRFKT'||p_count,'U');
Line: 4089

  if execute_insert_update_delete(p_count) = false then
    g_status:=false;
Line: 4091

    write_to_log_file_n('execute_insert_update_delete returned with error');
Line: 4204

    ''''||g_update_type||''','||
    ''''||l_low_system_mem||''','||
    ''''||g_op_table_space||''','||
    ''||nvl(g_parallel,0)||','||
    ''||nvl(g_sort_area_size,0)||','||
    ''||nvl(g_hash_area_size,0)||','||
    ''''||nvl(g_rollback,'null')||''','||
    ''''||l_version_GT_1159||''','||
    ''''||p_table||''');');
Line: 4233

  ''''||g_update_type||''','||
  ''''||l_low_system_mem||''','||
  ''''||g_op_table_space||''','||
  ''||nvl(g_parallel,0)||','||
  ''||nvl(g_sort_area_size,0)||','||
  ''||nvl(g_hash_area_size,0)||','||
  ''''||nvl(g_rollback,'null')||''','||
  ''''||l_version_GT_1159||''','||
  ''''||p_table||''');');
Line: 4273

p_update_type varchar2,
p_low_system_mem varchar2,
p_op_table_space varchar2,
p_parallel number,
p_sort_area_size number,
p_hash_area_size number,
p_rollback varchar2,
p_version_GT_1159 varchar2,
p_table varchar2 --this is the status table
) is
---
l_stmt varchar2(3000);
Line: 4315

  g_update_type:=p_update_type;
Line: 4364

    execute immediate 'insert into '||p_table||'(status,message) values(:1,:2)' using
    'ERROR',g_status_message;
Line: 4367

    execute immediate 'insert into '||p_table||'(status,message) values(:1,:2)' using
    'SUCCESSS','SUCCESS';
Line: 4376

  execute immediate 'insert into '||p_table||'(status,message) values(:1,:2)' using
  'ERROR',sqlerrm;
Line: 4410

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Create Error Rowid Table',sysdate,null,
  'MAPPING','CREATE-TABLE',g_jobid_stmt||'CRERT'||p_count,'I');
Line: 4416

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'CRERT'||p_count,'U');
Line: 4418

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Log dangling keys',sysdate,null,
    'MAPPING','CREATE-TABLE',g_jobid_stmt||'LDKD'||p_count,'I');
Line: 4424

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'LDKD'||p_count,'U');
Line: 4426

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Mark DANGLING in Interfact Table',sysdate,null,
  'MAPPING','UPDATE',g_jobid_stmt||'MKDNG'||p_count,'I');
Line: 4432

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MKDNG'||p_count,'U');
Line: 4446

l_update_type varchar2(400);
Line: 4455

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Mark Records as COLLECTED',sysdate,null,
  'MAPPING','UPDATE',g_jobid_stmt||'MKRC'||p_count,'I');
Line: 4457

  if update_stg_status_column(g_surr_table,'row_id',null,'COLLECTED',true)=false then
    return false;
Line: 4460

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'MKRC'||p_count,'U');
Line: 4469

function update_stg_status_column(
p_src_table varchar2,
p_rowid_col varchar2,
p_where_stmt varchar2,
p_status varchar2, --COLLECTED OR READY
p_create_iot boolean
) return boolean is
---
l_stmt varchar2(4000);
Line: 4481

l_update_type varchar2(400);
Line: 4489

    write_to_log_file_n('In update_stg_status_column'||get_time);
Line: 4491

  l_update_type:=g_update_type;
Line: 4493

    l_update_type:='ROW-BY-ROW';
Line: 4495

  if l_update_type='MASS' or l_update_type='DELETE-INSERT' then
    if p_create_iot then
      l_surr_rowid_table:=p_src_table||'R';
Line: 4505

      l_stmt:=l_stmt||' as select '||p_rowid_col||' from '||p_src_table||' '||p_where_stmt;
Line: 4523

    l_stmt:='update /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 4528

    '(select '||p_rowid_col||' from '||l_surr_rowid_table||')';
Line: 4535

      write_to_log_file_n('Updated '||sql%rowcount||' records to '''||p_status||''''||get_time);
Line: 4543

  elsif l_update_type='ROW-BY-ROW' then
    l_stmt:='update '||g_fstgTableName||' set collection_status='''||p_status||''' where rowid=:a';
Line: 4545

    l_stmt1:='select '||p_rowid_col||' row_id from '||p_src_table||' '||p_where_stmt;
Line: 4560

      write_to_log_file_n('Updated '||l_total_count||' records to '''||p_status||''''||get_time);
Line: 4566

  write_to_log_file_n('Error in update_stg_status_column '||sqlerrm||get_time);
Line: 4580

    l_stmt:='select max(round) from '||g_fact_dlog;
Line: 4594

  l_stmt:='create table '||g_update_dlog_lookup_table||' tablespace '||g_op_table_space;
Line: 4598

  l_stmt:=l_stmt||'  as select ';
Line: 4603

  if EDW_OWB_COLLECTION_UTIL.drop_table(g_update_dlog_lookup_table)=false then
    null;
Line: 4611

    write_to_log_file('Created '||g_update_dlog_lookup_table||' with '||sql%rowcount||' rows '||get_time);
Line: 4613

  EDW_OWB_COLLECTION_UTIL.analyze_table_stats(substr(g_update_dlog_lookup_table,instr(g_update_dlog_lookup_table,'.')+1,
  length(g_update_dlog_lookup_table)),substr(g_update_dlog_lookup_table,1,instr(g_update_dlog_lookup_table,'.')-1));
Line: 4625

if this is a source for derived facts, then we need to move the FACT data into the dlog table before update
*/
procedure make_data_into_dlog_stmt is
l_stmt varchar2(4000);
Line: 4638

  g_fact_delete_dlog_stmt:=null;
Line: 4641

    write_to_log_file_n('No delete log');
Line: 4658

    write_to_log_file_n('No columns found for delete log '||g_fact_dlog);
Line: 4668

    g_fact_dlog_stmt:='insert into '||g_fact_dlog||'(';
Line: 4670

    g_fact_dlog_stmt:='insert /*+PARALLEL ('||g_fact_dlog||','||g_parallel||')*/ into '||g_fact_dlog||'(';
Line: 4673

    if upper(g_dlog_columns(i)) <> 'ROW_ID' and upper(g_dlog_columns(i)) <> 'DLOG_LAST_UPDATE_DATE'
    and upper(g_dlog_columns(i)) <> 'PK_KEY' and upper(g_dlog_columns(i)) <> 'ROUND' then
      g_fact_dlog_stmt:=g_fact_dlog_stmt||g_dlog_columns(i)||',';
Line: 4679

  if EDW_OWB_COLLECTION_UTIL.value_in_table(g_dlog_columns,g_number_dlog_columns,'DLOG_LAST_UPDATE_DATE')=true then
    g_fact_dlog_stmt:=g_fact_dlog_stmt||',DLOG_LAST_UPDATE_DATE ';
Line: 4682

  g_fact_dlog_stmt:=g_fact_dlog_stmt||') select /*+ORDERED USE_NL('||g_object_name||')*/ ';
Line: 4687

    if upper(g_dlog_columns(i)) <> 'ROW_ID' and upper(g_dlog_columns(i)) <> 'DLOG_LAST_UPDATE_DATE'
    and upper(g_dlog_columns(i)) <> 'PK_KEY' and upper(g_dlog_columns(i)) <> 'ROUND' then
      g_fact_dlog_stmt:=g_fact_dlog_stmt||g_object_name||'.'||g_dlog_columns(i)||',';
Line: 4694

  if EDW_OWB_COLLECTION_UTIL.value_in_table(g_dlog_columns,g_number_dlog_columns,'DLOG_LAST_UPDATE_DATE')=true then
    g_fact_dlog_stmt:=g_fact_dlog_stmt||',SYSDATE ';
Line: 4703

    g_fact_delete_dlog_stmt:='insert into '||g_fact_dlog||'(';
Line: 4705

    g_fact_delete_dlog_stmt:='insert /*+PARALLEL ('||g_fact_dlog||','||g_parallel||')*/ into '||g_fact_dlog||'(';
Line: 4708

    if upper(g_dlog_columns(i)) <> 'ROW_ID' and upper(g_dlog_columns(i)) <> 'DLOG_LAST_UPDATE_DATE'
    and upper(g_dlog_columns(i)) <> 'PK_KEY' and upper(g_dlog_columns(i)) <> 'ROUND' then
      g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||g_dlog_columns(i)||',';
Line: 4713

  g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||'row_id,pk_key,round ';
Line: 4714

  if EDW_OWB_COLLECTION_UTIL.value_in_table(g_dlog_columns,g_number_dlog_columns,'DLOG_LAST_UPDATE_DATE')=true then
    g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||',DLOG_LAST_UPDATE_DATE ';
Line: 4717

  g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||') select  /*+ORDERED USE_NL('||g_object_name||')*/ ';
Line: 4719

    g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||' /*+PARALLEL('||g_object_name||','||g_parallel||')*/ ';
Line: 4722

    if upper(g_dlog_columns(i)) <> 'ROW_ID' and upper(g_dlog_columns(i)) <> 'DLOG_LAST_UPDATE_DATE'
    and upper(g_dlog_columns(i)) <> 'PK_KEY' and upper(g_dlog_columns(i)) <> 'ROUND' then
      g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||g_object_name||'.'||g_dlog_columns(i)||',';
Line: 4727

  g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||g_object_name||'.rowid,'||g_object_name||'.'||g_factPKNameKey||
  ','||g_dlog_rowid_table||'.round';
Line: 4729

  if EDW_OWB_COLLECTION_UTIL.value_in_table(g_dlog_columns,g_number_dlog_columns,'DLOG_LAST_UPDATE_DATE')=true then
    g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||',SYSDATE ';
Line: 4732

  g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||' from '||g_dlog_rowid_table||','||g_object_name;
Line: 4733

  g_fact_delete_dlog_stmt:=g_fact_delete_dlog_stmt||' where '||
                           g_dlog_rowid_table||'.row_id='||g_object_name||'.rowid';
Line: 4736

    write_to_log_file_n('g_fact_delete_dlog_stmt is '||g_fact_delete_dlog_stmt);
Line: 4748

l_update_dlog_rowid_table varchar2(400);
Line: 4764

    if p_mode='UPDATE' then
      l_stmt:=l_stmt||' as select row_id1 row_id from '||g_hold_table;
Line: 4767

      l_stmt:=l_stmt||' as select row_id1 row_id from '||g_surr_table||' where operation_code=2';
Line: 4785

    l_stmt:=l_stmt||'  as select distinct row_id from '||g_update_dlog_lookup_table;
Line: 4803

    l_stmt:=l_stmt||' as select A.row_id,decode(B.rowid,null,0,'||g_max_round||') round from '||
    l_dlog_rowid_table||' A,'||l_distinct_table||' B where A.row_id=B.row_id(+)';
Line: 4832

    if p_mode='UPDATE' then
      l_stmt:=l_stmt||' as select row_id1 row_id,0 round from '||g_hold_table;
Line: 4835

      l_stmt:=l_stmt||' as select row_id1 row_id,0 round from '||g_surr_table||' where operation_code=2';
Line: 4856

function insert_dlog_table(p_mode varchar2) return boolean is
l_stmt varchar2(32000);
Line: 4860

    write_to_log_file_n('In insert_dlog_table , p_mode='||p_mode);
Line: 4862

  if p_mode='UPDATE' then
    l_stmt:=g_fact_dlog_stmt;
Line: 4864

  elsif p_mode='DELETE' then
    l_stmt:=g_fact_delete_dlog_stmt;
Line: 4874

    write_to_log_file_n('There is no delete log for this fact.');
Line: 4899

if this is a source for derived facts, then we need to move the FACT data into the dlog table before update
*/
function excecute_data_into_dlog(p_mode varchar2) return boolean is
l_stmt varchar2(32000);
Line: 4915

  if insert_dlog_table(p_mode)=false then
    return false;
Line: 4934

select fact_item.column_name from
edw_attribute_sets_md_v sis,
edw_attribute_set_columns_md_v isu,
edw_pvt_columns_md_v fact_item
where sis.entity_id=p_fact_id
and sis.attribute_group_name=p_is_name
and isu.attribute_group_id=sis.attribute_group_id
and fact_item.column_id=isu.column_id
and fact_item.parent_object_id=p_fact_id;
Line: 4961

procedure select_fact_audit is
--selects the rowids to audit
Begin
 write_to_debug_n('In select_fact_audit '||get_time);
Line: 5004

select fact_item.column_name from
edw_attribute_sets_md_v sis,
edw_attribute_set_columns_md_v isu,
edw_pvt_columns_md_v fact_item
where sis.entity_id=p_fact_id
and sis.attribute_group_name=p_is_name
and isu.attribute_group_id=sis.attribute_group_id
and fact_item.column_id=isu.column_id
and fact_item.parent_object_id=p_fact_id;
Line: 5031

procedure select_net_change is
l_count number:=0;
Line: 5035

   write_to_debug('In select_net_change '||get_time);
Line: 5096

   g_update_dlog_lookup_table:=g_bis_owner||'.'||l_primary_target_name||'SDL';
Line: 5124

 g_insert_ctas_table:=g_bis_owner||'.'||l_primary_target_name||'ICT';
Line: 5144

 g_total_insert:=0;
Line: 5145

 g_total_update:=0;
Line: 5146

 g_total_delete:=0;
Line: 5148

 g_skip_ilog_update:=false;
Line: 5149

 g_type_ok_generation:='CTAS'; --or UPDATE
Line: 5150

 g_smart_update_name:='CHECK_COLUMNS_FOR_UPDATE';
Line: 5196

   g_is_delete_trigger_imp:=EDW_OWB_COLLECTION_UTIL.is_delete_trigger_imp(g_primary_target_name,g_table_owner);
Line: 5197

   if g_is_delete_trigger_imp  then
     write_to_log_file_n('Delete trigger implemented');
Line: 5200

     write_to_log_file_n('Delete trigger NOT implemented');
Line: 5207

   g_skip_update:=false;
Line: 5210

     if edw_option.get_warehouse_option(g_object_name,null,'SKIPUPDATE',l_option_value)=false then
       null;
Line: 5215

         if edw_option.get_option_columns(g_object_name,null,'SKIPUPDATE',l_table,l_number_table)=false then
           null;
Line: 5221

         g_skip_update:=true;
Line: 5225

             g_skip_update:=false;
Line: 5229

         g_skip_update:=true;
Line: 5233

     if EDW_OWB_COLLECTION_UTIL.is_itemset_implemented(g_primary_target_name,'SKIP_UPDATE')='Y' then
       g_skip_update:=true;
Line: 5238

     if g_skip_update then
       write_to_log_file_n('Skip Update');
Line: 5242

   g_skip_delete:=false;
Line: 5246

     if edw_option.get_warehouse_option(g_object_name,null,'SKIPDELETE',l_option_value)=false then
       null;
Line: 5251

         if edw_option.get_option_columns(g_object_name,null,'SKIPDELETE',l_table,l_number_table)=false then
           null;
Line: 5254

         g_skip_delete:=true;
Line: 5261

             g_skip_delete:=false;
Line: 5265

         g_skip_delete:=true;
Line: 5269

     if EDW_OWB_COLLECTION_UTIL.is_itemset_implemented(g_primary_target_name,'SKIP_DELETE')='Y' then
       g_skip_delete:=true;
Line: 5274

     if g_skip_delete then
       write_to_log_file_n('Skip Delete');
Line: 5361

  if EDW_OWB_COLLECTION_UTIL.drop_table(g_insert_ctas_table)=false then
    null;
Line: 5468

  l_stmt:='select count(*), operation_code from '||g_surr_table||
      '  group by operation_code';
Line: 5503

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 5505

    l_stmt:=l_stmt||' as select ';
Line: 5517

    ' MINUS select row_id from '||g_surr_table;
Line: 5544

l_update_type varchar2(400);
Line: 5552

  if update_stg_status_column(g_error_rowid_table,'row_id',null,'DANGLING',false)=false then
    return false;
Line: 5680

    l_stmt:='select count(*) from '||p_ok_rowid_table||' where status=1';
Line: 5730

    if EDW_OWB_COLLECTION_UTIL.insert_temp_log_table(
        g_object_name,
        g_object_type,
        g_conc_program_id,
        l_ins_instance_name,
        l_ins_request_id_table,
        l_ins_rows_ready,
        l_ins_rows_processed,
        l_ins_rows_collected,
        l_ins_rows_dangling,
        l_ins_rows_duplicate,
        l_ins_rows_error,
        g_total_records,
        g_total_insert,
        g_total_update,
        g_total_delete,
        l_number_ins_req_coll) = false then
        g_status_message:=EDW_OWB_COLLECTION_UTIL.g_status_message;
Line: 5768

  if g_type_ok_generation='UPDATE' then
    l_stmt:='update '||g_ok_rowid_table||' set status=1 where status=0 ';
Line: 5780

      write_to_log_file_n('Updated '||g_number_rows_ready||' records from ''READY'' to ''PROCESSING'' '||get_time);
Line: 5805

      l_stmt:=l_stmt||'  as select row_id,decode(status,1,2,2,2,decode(sign(rownum-'||
      g_collection_size||'),1,0,1)) status from (select row_id,status from '||g_ok_rowid_table_prev||
      ' order by status) abc ';
Line: 5809

      l_stmt:=l_stmt||'  as select row_id,decode(status,1,2,0,1,2) status from '||
      g_ok_rowid_table_prev;
Line: 5865

  l_stmt:=l_stmt||' as select ';
Line: 5911

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 5915

  if p_col='LAST_UPDATE_DATE' then
    l_stmt:=l_stmt||' lstg.'||g_fstgPKName||' '||g_fstgPKName||',lstg.rowid row_id,'||
    ' lstg.'||p_col||' col_last_update_date, rownum col_rownum from '||g_dup_hold_pk_table||' aa,'||
    g_fstgTableName||' lstg where lstg.'||g_fstgPKName||'=aa.'||g_fstgPKName;
Line: 6007

  l_stmt:='select 1 from edw_coll_progress_log where object_name=:a and object_type=:b';
Line: 6034

      l_stmt:=l_stmt||' as select c.row_id ,c.status from '||p_ok_copy_rowid_table||' c,'||
                  p_ok_rowid_table||' a where c.row_id=a.row_id';
Line: 6056

    l_stmt:='delete edw_coll_progress_log where object_name=:a and object_type=:b';
Line: 6089

l_insert_count number;
Line: 6096

  l_insert_count:=0;
Line: 6113

    l_stmt:=l_stmt||' as select ';
Line: 6116

      l_stmt:=l_stmt||' MINUS select row_id , 0  status from '||g_dup_hold_table;
Line: 6139

    l_stmt:=l_stmt||'  as select A.row_id,A.status from '||g_ok_rowid_table||' A,'||g_reqid_table||' B '||
    ' where A.row_id=B.row_id';
Line: 6163

    l_stmt:=l_stmt||' as select ';
Line: 6165

    l_stmt:=l_stmt||' MINUS select row_id row_id from '||g_ok_rowid_table;
Line: 6176

      l_stmt:='insert into '||g_ok_rowid_table||'(row_id, status) ';
Line: 6177

      l_stmt:=l_stmt||' select ';
Line: 6184

      l_insert_count:=sql%rowcount;
Line: 6185

      g_ok_rowid_number:=l_base_count+l_insert_count;
Line: 6188

        write_to_log_file_n('Inserted '||l_insert_count||' rows into '||g_ok_rowid_table||get_time);
Line: 6200

      l_stmt:=l_stmt||' as select row_id row_id, status status from '||g_ok_rowid_table||
      ' UNION ALL select row_id row_id,0 status from '||l_ok_rowid_table;
Line: 6219

      l_stmt:=l_stmt||' as select row_id from '||l_ok_copy_rowid_table||
              ' MINUS select row_id from '||g_dup_hold_table;
Line: 6238

        l_stmt:=l_stmt||' as select c.row_id ,c.status  from '||l_ok_copy_rowid_table||' c,'||
        l_ok_rowid_table||' a where c.row_id=a.row_id';
Line: 6254

        if EDW_OWB_COLLECTION_UTIL.insert_into_coll_progress(g_ok_rowid_table,'OK_ROWID',null,null)=false then
          null;
Line: 6289

l_col varchar2(400);--what col to use. last update date or rownum
Line: 6315

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 6349

    if EDW_OWB_COLLECTION_UTIL.does_table_have_data(g_fstgTableName,'LAST_UPDATE_DATE IS NOT NULL')=2 then
      l_col:='LAST_UPDATE_DATE';
Line: 6351

      l_col_use:='COL_LAST_UPDATE_DATE';
Line: 6361

    if l_col='LAST_UPDATE_DATE' then
      declare
        l_res number:=null;
Line: 6365

        l_stmt:='select 1 from '||g_dup_rownum||' having count(*)>1 group by '||l_col_use||','||g_fstgPKName;
Line: 6368

          write_to_log_file('Col is last_update_date');
Line: 6378

            write_to_log_file_n('Last_update_date repeats for same PK. Going to try ROWNUM');
Line: 6394

    l_stmt:=l_stmt||' as select max('||l_col_use||') col,'||g_fstgPKName||' from '||
    g_dup_rownum||' group by '||g_fstgPKName;
Line: 6444

  l_stmt:=l_stmt||' as select ';
Line: 6446

    l_stmt:=l_stmt||' row_id from '||g_dup_rownum||' MINUS select /*+ORDERED*/ row_id from '||
    g_dup_rownum_rowid||','||g_dup_rownum||' where '||g_dup_rownum||'.'||l_col_use||'='||
    g_dup_rownum_rowid||'.col and '||g_dup_rownum||'.'||g_fstgPKName||'='||g_dup_rownum_rowid||'.'||g_fstgPKName;
Line: 6476

    l_stmt:='select count(*) from '||g_dup_hold_table;
Line: 6521

    l_stmt:=l_stmt||'  as select row_id from '||g_ok_rowid_table||' where status=1';
Line: 6543

  l_stmt:=l_stmt||' as select ';
Line: 6612

      l_stmt:=l_stmt||' as select /*+ORDERED USE_NL('||g_FactTableName||')*/ ';
Line: 6614

      l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 6621

    if g_fact_audit or g_fact_net_change or g_update_type='DELETE-INSERT' then
      l_stmt:=l_stmt||','||g_FactTableName||'.'||g_factPKNameKey||' '||g_fstgPKNameKey;
Line: 6624

    if g_update_type='DELETE-INSERT' then
      l_stmt:=l_stmt||','||g_FactTableName||'.'||g_factPKName||' '||g_fstgPKName;
Line: 6644

    l_stmt:=l_stmt||'  as select row_id,row_id1,';
Line: 6650

    if g_update_type='DELETE-INSERT' then
      l_stmt:=l_stmt||','||g_fstgPKName||',CREATION_DATE';
Line: 6693

    g_opcode_stmt:=g_opcode_stmt||' as select ';
Line: 6695

    'decode ('||l_opcode_table||'.operation_code,''DELETE'',2,0) operation_code, ';
Line: 6708

    if g_update_type='DELETE-INSERT' then
      g_opcode_stmt:=g_opcode_stmt||',0 '||g_fstgPKName;
Line: 6716

        g_opcode_stmt:=g_opcode_stmt||' as select /*+ORDERED USE_NL('||g_FactTableName||')*/ ';
Line: 6718

        g_opcode_stmt:=g_opcode_stmt||' as select /*+ORDERED*/ ';
Line: 6725

      ' decode ('||l_opcode_table||'.operation_code,''DELETE'',2,decode('||
      g_FactTableName||'.rowid,null,0,1)) operation_code, ';
Line: 6734

      if g_update_type='DELETE-INSERT' then
        g_opcode_stmt:=g_opcode_stmt||','||g_FactTableName||'.'||g_factPKName||' '||g_fstgPKName;
Line: 6741

      g_opcode_stmt:=g_opcode_stmt||' as select ';
Line: 6743

      ' decode ('||l_opcode_table||'.operation_code,''DELETE'',2,decode('||
      g_FactTableName||'.row_id1,null,0,1)) operation_code, ';
Line: 6749

      if g_update_type='DELETE-INSERT' then
        g_opcode_stmt:=g_opcode_stmt||','||g_FactTableName||'.'||g_fstgPKName||' '||g_fstgPKName;
Line: 6852

    l_stmt:=l_stmt||'  as select row_id from '||g_ok_rowid_table||' where status=1';
Line: 6874

  l_stmt:=l_stmt||' as select ';
Line: 6945

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 6972

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 6992

  l_stmt:=l_stmt||'  as select A.row_id,A.'||g_factPKName||' '||g_factPKName||'1, '||
  'decode(A.'||g_factPKNameKey||',null,B.pk_key,A.'||g_factPKNameKey||') '||g_factPKNameKey||' ,'||
  'A.row_id2 from '||l_table11||' A,'||l_table_pp||' B where A.row_id=B.row_id(+)';
Line: 7015

  l_stmt:=l_stmt||'  as select row_id,'||g_factPKName||'1,'||
  'decode('||g_factPKNameKey||',null,'||l_next_pk||','||g_factPKNameKey||') '||g_factPKNameKey||
  ',row_id2 from '||l_table1;
Line: 7057

  l_stmt:=l_stmt||' as select ';
Line: 7115

    l_stmt:=l_stmt||' as select /*+ORDERED USE_NL('||g_FactTableName||')*/ ';
Line: 7117

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 7124

  ' decode ('||l_opcode_pk_table||'.operation_code,''DELETE'',2,decode('||
  g_FactTableName||'.rowid,null,0,1)) operation_code, ';
Line: 7127

  if g_update_type='DELETE-INSERT' then
    l_stmt:=l_stmt||','||g_FactTableName||'.'||g_factPKName||' '||g_fstgPKName;
Line: 7182

function update_ok_status_2 return boolean is
l_stmt varchar2(2000);
Line: 7185

  l_stmt:='update '||g_ok_rowid_table||' set status=2 where status=1';
Line: 7192

    write_to_log_file_n('Updated '||sql%rowcount||' rows from status 1 to 2'||get_time);
Line: 7271

  l_stmt:='select operation,options, object_name,cardinality from '||g_plan_table;
Line: 7417

l_opcode_update_table varchar2(200);
Line: 7440

  l_opcode_update_table:=g_opcode_table||'U';
Line: 7442

    l_stmt:='create table '||l_opcode_update_table||' tablespace '||g_op_table_space;
Line: 7446

    l_stmt:=l_stmt||'  as select row_id, row_id1 from '||g_opcode_table||' where operation_code=1';
Line: 7447

    if EDW_OWB_COLLECTION_UTIL.drop_table(l_opcode_update_table)=false then
      null;
Line: 7732

              l_stmt:=l_stmt||' as select /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 7734

              l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 7738

            l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 7834

      l_stmt:=l_stmt||' as select /*+ORDERED ';
Line: 7953

        l_stmt:=l_stmt||' as select row_id ';
Line: 7980

        l_opcode_update_table -- to join to
      */
      declare
        l_table1 varchar2(200);
Line: 7995

              l_stmt:=l_stmt||'  as select b.row_id1,a.'||g_fstgActualFKName(i)||' from '||
              l_opcode_update_table||' b,'||g_surr_tables(g_number_surr_tables)||' a where a.row_id=b.row_id';
Line: 8009

              l_stmt:='select /*+ordered ';
Line: 8070

                  if insert_into_parent_fk_log(l_dang_instance,l_number_dang_instance,
                    g_fstgUserFKName(i),g_dimTableId(i),g_dimTableName(i),g_dim_auto_dang_table(i),
                    g_dim_lowest_ltc_id(i))=false then
                    return false;
Line: 8105

                      l_stmt:='insert into '||g_surr_tables(g_number_surr_tables)||'(row_id';
Line: 8111

                      l_stmt:=l_stmt||') select row_id';
Line: 8123

                        write_to_log_file_n('Inserted '||sql%rowcount||' rows '||get_time);
Line: 8168

  if EDW_OWB_COLLECTION_UTIL.drop_table(l_opcode_update_table)=false then
    null;
Line: 8201

  l_stmt:=l_stmt||' as select ';
Line: 8214

  if g_update_type='DELETE-INSERT' then
    l_stmt:=l_stmt||','||g_opcode_table||'.'||g_fstgPKName||' '||g_fstgPKName||','||
    g_opcode_table||'.CREATION_DATE CREATION_DATE';
Line: 8321

      l_stmt:=l_stmt||' as select ';
Line: 8381

  l_stmt:=l_stmt||' as select ';
Line: 8404

  if g_update_type='DELETE-INSERT' then
    l_stmt:=l_stmt||','||g_opcode_table||'.'||g_fstgPKName||' '||g_fstgPKName||','||
    g_opcode_table||'.CREATION_DATE CREATION_DATE';
Line: 8469

    l_stmt:=l_stmt||'  as select row_id from '||g_opcode_table;
Line: 8477

      l_stmt:=l_stmt||' as select /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 8480

        l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 8482

        l_stmt:=l_stmt||' as select ';
Line: 8600

  l_stmt:='select '||p_fk||' from '||g_fstgTableName||' where rownum=1';
Line: 8679

insert into fact audit all new rows of fact
*/
function insert_fa_fact_insert return boolean is
l_stmt varchar2(32000);
Line: 8686

    write_to_log_file_n('In insert_fa_fact_insert'||get_time);
Line: 8693

    l_stmt:='insert into '||g_fact_audit_name;
Line: 8695

    l_stmt:='insert /*+PARALLEL('||g_fact_audit_name||','||g_parallel||')*/ into '||g_fact_audit_name;
Line: 8704

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'LAST_UPDATE_DATE,';
Line: 8709

  l_stmt:=l_stmt||' select ';
Line: 8719

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'SYSDATE,';
Line: 8735

      write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_fact_audit_name||get_time);
Line: 8764

insert into fact audit all  update of fact
*/
function insert_fa_fact_update return boolean is
l_stmt varchar2(32000);
Line: 8772

   for columns that have changed, insert
  */
  if g_debug then
    write_to_log_file_n('In insert_fa_fact_update'||get_time);
Line: 8788

    l_stmt:=l_stmt||' as select /*+ORDERED USE_NL('||g_factTableName||')*/ ';
Line: 8790

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 8822

  l_stmt:=l_stmt||' as select '||g_hold_table||'.rowid row_id from '||g_hold_table||
    ' MINUS select row_id from '||l_ilog;
Line: 8845

    l_stmt:='insert into '||g_fact_audit_name;
Line: 8847

    l_stmt:='insert /*+PARALLEL('||g_fact_audit_name||','||g_parallel||')*/ into '||g_fact_audit_name;
Line: 8856

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'LAST_UPDATE_DATE,';
Line: 8861

  l_stmt:=l_stmt||' select /*+ORDERED ('||g_hold_table||')*/ ';
Line: 8868

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'SYSDATE,';
Line: 8881

      write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_fact_audit_name||get_time);
Line: 8910

insert into fact nc all new rows of fact
*/
function insert_nc_fact_insert return boolean is
l_stmt varchar2(32000);
Line: 8917

    write_to_log_file_n('In insert_nc_fact_insert'||get_time);
Line: 8924

    l_stmt:='insert into '||g_fact_net_change_name;
Line: 8926

    l_stmt:='insert /*+PARALLEL('||g_fact_net_change_name||','||g_parallel||')*/ into '||g_fact_net_change_name;
Line: 8935

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'LAST_UPDATE_DATE,';
Line: 8940

  l_stmt:=l_stmt||' select ';
Line: 8950

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'SYSDATE,';
Line: 8966

      write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_fact_net_change_name||get_time);
Line: 8995

insert into fact net_change all  update of fact
*/
function insert_nc_fact_update return boolean is
l_stmt varchar2(32000);
Line: 9003

   for columns that have changed, insert
  */
  if g_debug then
    write_to_log_file_n('In insert_nc_fact_update'||get_time);
Line: 9019

    l_stmt:=l_stmt||' as select /*+ORDERED USE_NL('||g_factTableName||')*/ ';
Line: 9021

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 9054

  l_stmt:=l_stmt||' as select '||g_hold_table||'.rowid row_id from '||g_hold_table||
    ' MINUS select row_id from '||l_ilog;
Line: 9077

    l_stmt:='insert into '||g_fact_net_change_name;
Line: 9079

    l_stmt:='insert /*+PARALLEL('||g_fact_net_change_name||','||g_parallel||')*/ into '||g_fact_net_change_name;
Line: 9088

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'LAST_UPDATE_DATE,';
Line: 9094

    l_stmt:=l_stmt||' select /*+ORDERED USE_NL('||g_factTableName||')*/ ';
Line: 9096

    l_stmt:=l_stmt||' select /*+ORDERED*/ ';
Line: 9116

  if g_last_update_date_flag then
    l_stmt:=l_stmt||'SYSDATE,';
Line: 9129

      write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_fact_net_change_name||get_time);
Line: 9198

procedure insert_into_load_progress(p_load_fk number,p_object_name varchar2,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,g_primary_target,p_load_progress,
  p_start_date,p_end_date,p_category,p_operation,p_seq_id,p_flag,g_primary_target);
Line: 9210

procedure insert_into_load_progress_d(p_load_fk number,p_object_name varchar2,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 then
    EDW_OWB_COLLECTION_UTIL.insert_into_load_progress(p_load_fk,p_object_name,g_primary_target,p_load_progress,
    p_start_date,p_end_date,p_category,p_operation,p_seq_id,p_flag,g_primary_target);
Line: 9326

  insert_into_load_progress_d(p_load_pk,p_primary_target_name,'Analyze '||p_primary_target_name,sysdate,null,
  'MAPPING','ANALYZE','ANFT','I');
Line: 9329

  insert_into_load_progress_d(p_load_pk,null,null,null,sysdate,null,null,'ANFT','U');
Line: 9331

    insert_into_load_progress_d(p_load_pk,p_primary_target_name,'Analyze '||p_fact_audit_name,sysdate,null,
    'MAPPING','ANALYZE','ANFA','I');
Line: 9334

    insert_into_load_progress_d(p_load_pk,null,null,null,sysdate,null,null,'ANFA','U');
Line: 9337

    insert_into_load_progress_d(p_load_pk,p_primary_target_name,'Analyze '||p_fact_net_change_name,sysdate,null,
    'MAPPING','ANALYZE','ANFN','I');
Line: 9340

    insert_into_load_progress_d(p_load_pk,null,null,null,sysdate,null,null,'ANFN','U');
Line: 9408

    l_stmt:=l_stmt||' as select ';
Line: 9415

    l_stmt:=l_stmt||g_factPKName||','||g_factPKNameKey||',sysdate CREATION_DATE,sysdate LAST_UPDATE_DATE from '||
    g_primary_target_name||' where 1=2';
Line: 9449

    l_stmt:=l_stmt||' as select ';
Line: 9556

  l_stmt:=l_stmt||'  as select ';
Line: 9585

    l_stmt:=l_stmt||'  as select ';
Line: 9616

      l_stmt:=l_stmt||'  as select ';
Line: 9642

      l_stmt:=l_stmt||'  as select ';
Line: 9647

      l_stmt:=l_stmt||' from '||l_da_table_dis||' MINUS select ';
Line: 9669

      l_stmt:=l_stmt||'  as select ';
Line: 9673

      l_stmt:=l_stmt||g_factPKNameKey||' from '||l_master_da_table_dis1||' UNION ALL select /*+ORDERED*/ ';
Line: 9707

    l_stmt:='insert ';
Line: 9719

    l_stmt:=l_stmt||g_factPKName||','||g_factPKNameKey||',CREATION_DATE,LAST_UPDATE_DATE) select ';
Line: 9750

      write_to_log_file_n('inserted into '||g_da_table||'  '||sql%rowcount||' rows '||get_time);
Line: 9765

    l_stmt:=l_stmt||'  as select ';
Line: 9785

    l_stmt:='insert ';
Line: 9790

    l_stmt:=l_stmt||'into '||g_pp_table||' '||l_table||' (PK,PK_KEY,LOADED_PK,CREATION_DATE) select PK,PK_KEY,'||
    'LOADED_PK,SYSDATE from '||l_pp_table_temp;
Line: 9798

      write_to_log_file_n('inserted into '||g_pp_table||'  '||sql%rowcount||' rows '||get_time);
Line: 9833

  l_stmt:='insert ';
Line: 9845

  l_stmt:=l_stmt||g_factPKName||','||g_factPKNameKey||',CREATION_DATE,LAST_UPDATE_DATE) select ';
Line: 9859

    write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_da_table||get_time);
Line: 9870

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 9893

    l_stmt:=l_stmt||' as select '||g_fstgPKName||' '||g_factPKName||' from '||p_table||' MINUS select ';
Line: 9910

    l_stmt:='insert ';
Line: 9916

    'select /*+ORDERED*/ '||p_table||'.'||g_fstgPKName||','||p_table||'.'||g_factPKNameKey||','||
    p_table||'.'||g_factPKName||'1,sysdate from '||l_table_A||','||p_table||' where '||
    l_table_A||'.'||g_factPKName||'='||p_table||'.'||g_fstgPKName;
Line: 9926

        write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_pp_table||get_time);
Line: 9932

        write_to_log_file_n('Error in insert '||sqlerrm);
Line: 9937

          write_to_log_file_n('Re-try insert ');
Line: 9980

    l_stmt:=l_stmt||' as select row_id from '||g_dup_hold_table||' MINUS select row_id from '||g_dup_pp_row_id_table;
Line: 9991

    l_stmt:='insert into '||g_dup_pp_row_id_table||'(row_id) select row_id from '||l_dup_pp_row_id_table;
Line: 10000

      write_to_log_file_n('Inserted '||sql%rowcount||' rows into '||g_dup_pp_row_id_table||get_time);
Line: 10012

    l_stmt:=l_stmt||' as select row_id from '||g_dup_hold_table;
Line: 10035

at the end of the load, we need to look at the duplicate-collect records and insert into the PP table. we could have
pushed from instance 1 and instance 2 and loaded. we need to get the mapping between instance 1 and 2 into PP table
*/
function load_dup_coll_into_pp return boolean is
l_stmt varchar2(20000);
Line: 10059

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 10086

  l_stmt:=l_stmt||' as select distinct '||g_fstgPKName;
Line: 10111

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 10143

    l_stmt:=l_stmt||' as select '||g_factPKName||' from '||g_dup_pp_table||' MINUS select ';
Line: 10161

    l_stmt:='insert ';
Line: 10166

    l_stmt:=l_stmt||'into '||g_pp_table||' '||l_table||'(PK,PK_KEY,LOADED_PK,CREATION_DATE) select /*+ORDERED*/ '||
    g_dup_pp_table||'.'||g_factPKName||','||g_dup_pp_table||'.'||g_factPKNameKey||','||g_dup_pp_table||'.LOADED_PK,'||
    'sysdate from '||l_dup_pp_table_C||','||g_dup_pp_table||' where '||l_dup_pp_table_C||'.'||g_factPKName||'='||
    g_dup_pp_table||'.'||g_factPKName;
Line: 10177

        write_to_log_file_n('Inserted into '||g_pp_table||' '||sql%rowcount||' rows'||get_time);
Line: 10272

  l_data_table_BF:=g_da_op_table||'BF';--to update DA. row_id2 from BB where not master instance
Line: 10273

  l_data_table_BG:=g_da_op_table||'BG';--IOT.row_id from F. if dup coll=no,where count=1. else distinct row_id.update DA
Line: 10289

  if EDW_OWB_COLLECTION_UTIL.does_table_have_data(g_fstgTableName,'LAST_UPDATE_DATE IS NOT NULL')=2 then
    l_col:='LAST_UPDATE_DATE';
Line: 10308

  l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 10318

  if l_col='LAST_UPDATE_DATE' then
    l_stmt:=l_stmt||g_fstgTableName||'.'||l_col||' col,';
Line: 10330

  if l_col='LAST_UPDATE_DATE' then
    l_stmt:='select 1 from '||l_data_table||' having count(*)>1 group by col';
Line: 10346

      write_to_log_file_n('LAST_UPDATE_DATE is duplicate. Trying with ROWNUM');
Line: 10363

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 10392

      l_stmt:=l_stmt||' as select row_id,row_id1 from '||l_data_table_BO||' where '||
      g_instance_column||'1<>'''||g_master_instance||'''';
Line: 10404

      l_stmt:=l_stmt||' as select ';
Line: 10425

        l_stmt:=l_stmt||' as select row_id2 from '||l_data_table_BB||' where '||
        g_instance_column||'<>'''||g_master_instance||'''';
Line: 10442

            l_stmt:=l_stmt||' as select distinct row_id2 row_id from '||l_data_table_BF;
Line: 10452

            l_stmt:=l_stmt||' as select row_id2 row_id from '||l_data_table_BF||' having count(row_id2)=1 '||
            'group by row_id2';
Line: 10463

          l_stmt:='update /*+ORDERED USE_NL('||l_table||')*/ ';
Line: 10468

          'LAST_UPDATE_DATE=sysdate where rowid in (select row_id from '||l_data_table_BG||')';
Line: 10474

            write_to_log_file_n('Updated '||sql%rowcount||' rows '||get_time);
Line: 10483

      l_stmt:=l_stmt||' as select ';
Line: 10499

      l_stmt:=l_stmt||' as select ';
Line: 10504

      l_stmt:=l_stmt||' from '||l_data_table_BC||' MINUS select ';
Line: 10520

      l_stmt:=l_stmt||' as select /*+ORDERED*/ '||l_data_table_BC||'.row_id,'||l_data_table_BC||'.row_id1 from '||
      l_data_table_BD||','||l_data_table_BC||' where ';
Line: 10536

      l_stmt:=l_stmt||' as select row_id,row_id1 from '||l_data_table_BA||' MINUS select row_id,row_id1 from '||
      l_data_table_BE;
Line: 10577

      l_stmt:=l_stmt||' as select rowid row_id from '||l_data_table||' MINUS select row_id from '||l_data_table_B;
Line: 10588

      l_stmt:=l_stmt||'  as select /*+ORDERED*/ ';
Line: 10618

  l_stmt:=l_stmt||' as select ';
Line: 10658

      l_stmt:=l_stmt||' as select row_id from '||l_data_table||' MINUS select row_id from '||l_data_table_D;
Line: 10696

      l_stmt:=l_stmt||'  as select * from '||l_data_table_D||' where '||
      g_instance_column||'='''||g_master_instance||'''';
Line: 10707

      l_stmt:=l_stmt||'  as select ';
Line: 10712

      l_stmt:=l_stmt||' from '||l_data_table_D||' MINUS select ';
Line: 10727

      l_stmt:=l_stmt||'  as select /*+ORDERED*/ '||l_data_table_D||'.* from '||l_data_table_DR||','||
      l_data_table_D||' where ';
Line: 10751

      l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 10771

      l_stmt:=l_stmt||' as select ';
Line: 10790

      l_stmt:=l_stmt||' as select /*+ORDERED*/ '||l_dup_table||'.row_id from '||l_dup_max_table||','||
      l_dup_table||' where ';
Line: 10809

      l_stmt:=l_stmt||' as select row_id from '||l_dup_table||' MINUS select row_id from '||l_dup_max_rowid_table;
Line: 10832

      l_stmt:=l_stmt||' as select max(col) col';
Line: 10854

        l_stmt:=l_stmt||' as select /*+ORDERED*/ '||l_data_table_DM||'.row_id from '||l_data_table_F||','||
        l_data_table_DM||' where '||l_data_table_F||'.col='||l_data_table_DM||'.col and ';
Line: 10874

      l_stmt:=l_stmt||' as select max(col) col';
Line: 10896

        l_stmt:=l_stmt||' as select /*+ORDERED*/ '||l_data_table_DN||'.row_id from '||l_data_table_H||','||
        l_data_table_DN||' where '||l_data_table_H||'.col='||l_data_table_DN||'.col and ';
Line: 10916

      l_stmt:=l_stmt||' as select row_id from '||l_data_table_G||' UNION ALL select row_id from '||l_data_table_I;
Line: 10936

      l_stmt:=l_stmt||' as select row_id from '||l_data_table||' MINUS select row_id from '||l_data_table_J;
Line: 10964

    l_stmt:=l_stmt||' as select /*+ORDERED*/ '||l_data_table_D||'.row_id from '||l_dup_value_table||','||
    l_data_table_D||' where ';
Line: 10970

      l_stmt:=l_stmt||' UNION ALL select row_id1 row_id from '||l_data_table_B;
Line: 11063

    l_stmt:=l_stmt||'  as select rowid row_id1, row_id from '||g_fact_dlog||' where row_id in '||
    '(select rowid from '||g_object_name||')';
Line: 11102

  l_stmt:=l_stmt||'  as select /*+ordered ';
Line: 11172

    l_stmt:='insert into '||g_fact_dlog||'(';
Line: 11174

    l_stmt:='insert /*+PARALLEL (A,'||g_parallel||')*/ into '||g_fact_dlog||' A (';
Line: 11184

  l_stmt:=l_stmt||') select ';
Line: 11199

    write_to_log_file('Inserted '||sql%rowcount||' rows '||get_time);
Line: 11270

  l_stmt:=l_stmt||'  as select ';
Line: 11291

  l_stmt:=l_stmt||' MINUS select row_id from '||p_surr_table;
Line: 11311

    l_stmt:=l_stmt||'  as select '||l_auto_dang_table1||'.row_id,'||p_fk_name;
Line: 11384

    l_stmt:='select distinct '||g_instance_column||' from '||p_dang_table;
Line: 11460

          l_stmt:=l_stmt||'  as select distinct '||p_fk_name||' from '||p_dang_table;
Line: 11462

          l_stmt:=l_stmt||'  as select distinct '||p_fk_name||' from '||p_dang_table||
          ' where '||g_instance_column||' is null';
Line: 11466

        l_stmt:=l_stmt||'  as select distinct '||p_fk_name||' from '||p_dang_table||
        ' where '||g_instance_column||'='''||p_dang_instance(z)||'''';
Line: 11483

      l_stmt:=l_stmt||'  as select '||p_fk_name;
Line: 11498

          select
          substr(x,1,(decode((instr(x,'-',1,1)),0,length(x)+1,instr(x,'-',1,1))-1)),
          substr(x,decode(instr(x,'-',1,(2-1)),0,length(x)+1,instr(x,'-',1,(2-1)))+1,
          (decode((instr(x,'-',1,2)),0,length(x)+1,(instr(x,'-',1,2)))-(instr(x,'-',1,(2-1))+1)))
          from abc
          data in abc
          1011-1012-INST
          100011-1-INST
          1-100-INST
          */
          for j in 1..l_number_pk_cols loop
            if l_pk_cols(j)<>'INST' then
              if j=1 then
                l_stmt:=l_stmt||',substr('||p_fk_name||',1,(decode((instr('||p_fk_name||',''-'',1,1)),0,'||
                'length('||p_fk_name||'),instr('||p_fk_name||',''-'',1,1))-1)) '||l_pk_cols(j);
Line: 11548

function insert_into_parent_fk_log(
p_dang_instance EDW_OWB_COLLECTION_UTIL.varcharTableType,
p_number_dang_instance number,
p_fk_name varchar2,
p_parent_table_id number,
p_parent_table_name varchar2,
p_dim_auto_dang_table varchar2,
p_dim_lowest_ltc_id number) return boolean is
l_auto_dang_table3 varchar2(200);
Line: 11570

    write_to_log_file_n('In insert_into_parent_fk_log');
Line: 11646

    l_stmt:='insert into '||l_auto_dang_table3||'(level_table,value';
Line: 11652

    l_stmt:=l_stmt||') select '||p_dim_lowest_ltc_id||','||p_fk_name;
Line: 11666

        write_to_log_file_n('Inserted '||sql%rowcount||' records '||get_time);
Line: 11679

  write_to_log_file_n('Error in insert_into_parent_fk_log '||g_status_message);
Line: 11733

  if insert_into_parent_fk_log(l_dang_instance,l_number_dang_instance,p_pk_name,p_parent_table_id,
    p_parent_table_name,p_dim_auto_dang_table,p_dim_lowest_ltc_id)=false then
    return false;
Line: 11759

    l_stmt:=l_stmt||'  as select /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 11761

    l_stmt:=l_stmt||'  as select /*+ORDERED*/ ';
Line: 11829

        write_to_log_file_n('Cannot insert into level table '||p_ltc_table||'. Its missing a unique '||
        'index on '||l_pk);
Line: 11897

  l_stmt:=l_stmt||'  as select '||p_pk||','||p_pk_key||' from '||p_ltc_table||
  ' where 1=2';
Line: 11913

  l_stmt:=l_stmt||'  as select distinct '||p_dang_pk||' '||p_pk||' from '||p_dang_table;
Line: 11932

    l_stmt:=l_stmt||'  as select '||p_pk||' from '||l_table_distinct||' MINUS select '||
    p_pk||' from '||l_table_old;
Line: 11948

    l_stmt:=l_stmt||'  as select '||p_pk||','||p_seq||'.NEXTVAL '||p_pk_key||' from '||l_table1;
Line: 11962

      l_stmt:='insert ';
Line: 11967

      'select '||p_pk||','||p_pk_key||','||p_pk||',sysdate from '||l_table_new;
Line: 11969

      l_stmt:='insert ';
Line: 11974

      l_stmt:=l_stmt||',creation_date,last_update_date) '||
      'select '||p_pk||','||p_pk_key||','||p_pk;
Line: 11988

        write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12009

      l_stmt:='insert into '||l_table_old||'('||p_pk||','||p_pk_key||') ';
Line: 12011

        l_stmt:=l_stmt||' select B.pk,B.pk_key from '||l_table_new||' A,'||p_pp_table||' B where '||
        'A.'||p_pk||'=B.pk';
Line: 12014

        l_stmt:=l_stmt||' select B.'||p_pk||',B.'||p_pk_key||' from '||l_table_new||' A,'||p_ltc_table||' B '||
        'where A.'||p_pk||'=B.'||p_pk;
Line: 12023

        write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12026

    else --insert into ltc and/or dim table
      l_stmt:='create table '||l_table_union||' tablespace '||g_op_table_space;
Line: 12031

      l_stmt:=l_stmt||'  as select '||p_pk||','||p_pk_key||' from '||l_table_old||' UNION ALL '||
      ' select '||p_pk||','||p_pk_key||' from '||l_table_new;
Line: 12047

      l_stmt:=l_stmt||'  as select B.row_id,A.'||p_pk_key||' pk_key '||
      ' from '||l_table_union||' A,'||p_dang_table||' B where A.'||p_pk||'=B.'||p_dang_pk;
Line: 12070

          l_stmt:=l_stmt||'  as select '||p_pk||','||p_pk_key||' from '||l_table_union||
          ' MINUS select '||p_pk||','||p_pk_key||' from '||l_table_old;
Line: 12082

          l_stmt:='insert ';
Line: 12087

          l_stmt:=l_stmt||',creation_date,last_update_date) select '||p_pk||','||p_pk_key||','||p_pk;
Line: 12099

              write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12109

                write_to_log_file_n('Re-try a insert into level table after recreating the data');
Line: 12119

            l_stmt:='insert into '||l_table_old||'('||p_pk||','||p_pk_key||') ';
Line: 12120

            l_stmt:=l_stmt||' select A.'||p_pk||',A.'||p_pk_key||' from '||l_table_new||' A,'||p_ltc_table||' B '||
            'where A.'||p_pk||'=B.'||p_pk;
Line: 12128

              write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12155

          l_stmt:=l_stmt||'  as select '||p_pk||','||p_pk_key||' from '||l_table_union||
          ' MINUS select '||p_pk||','||p_pk_key||' from '||l_table_old;
Line: 12167

          l_stmt:='insert ';
Line: 12177

          l_stmt:=l_stmt||',creation_date,last_update_date) select '||p_pk||','||p_pk_key;
Line: 12194

              write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12204

                write_to_log_file_n('Re-try a insert into dim table after recreating the data');
Line: 12214

            l_stmt:='insert into '||l_table_old||'('||p_pk||','||p_pk_key||') ';
Line: 12215

            l_stmt:=l_stmt||' select A.'||p_pk||',A.'||p_pk_key||' from '||l_table_new||' A,'||p_dim_table||' B '||
            'where A.'||p_pk||'=B.'||p_dim_pk;
Line: 12223

              write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12257

function refind_insert_rows return boolean is
l_table1 varchar2(200);
Line: 12265

    write_to_log_file_n('In refind_insert_rows '||get_time);
Line: 12274

  l_stmt:=l_stmt||'  as select rowid row_id1,';
Line: 12300

    l_stmt:=l_stmt||' as select /*+ORDERED USE_NL(B)*/ ';
Line: 12302

    l_stmt:=l_stmt||' as select /*+ORDERED*/ ';
Line: 12334

    l_stmt:=l_stmt||'  as select /*+ordered use_nl(B)*/ ';
Line: 12336

    l_stmt:=l_stmt||'  as select /*+ordered*/ ';
Line: 12357

  l_stmt:='update /*+ORDERED USE_NL(A)*/ '||g_surr_table||' A set (row_id1,operation_code)='||
  '(select row_id1,1 from '||l_table3||' where '||l_table3||'.row_id=A.rowid) where A.rowid in '||
  '(select row_id from '||l_table3||')';
Line: 12367

    write_to_log_file_n('Updated '||l_count||' rows'||get_time);
Line: 12380

    write_to_log_file_n('Could not update any rows for insert/update. Some other error');
Line: 12387

  write_to_log_file_n('Error in refind_insert_rows '||g_status_message);
Line: 12392

function execute_insert_stmt(p_count number) return boolean is
l_insert_type varchar2(200);
Line: 12402

    write_to_log_file_n('In execute_insert_stmt '||get_time);
Line: 12404

  l_insert_type:='MASS';
Line: 12405

  l_table1:=g_insert_ctas_table||'R';
Line: 12406

  insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Inserting into '||g_primary_target_name,sysdate,
  null,'MAPPING','INSERT',g_jobid_stmt||'INSERT'||p_count,'I');
Line: 12408

  <>
  if g_fact_audit or g_fact_net_change then
    if EDW_OWB_COLLECTION_UTIL.drop_table(g_fact_audit_net_table)= false then
      null;
Line: 12415

  when there is audit or net change g_insert_stmt creates g_fact_audit_net_table
  */
  if g_debug then
    write_to_debug_n('Going to INSERT rows '||get_time);
Line: 12420

  if l_insert_type='ROW-BY-ROW' and g_fact_audit=false and g_fact_net_change=false then
    if g_debug then
      write_to_log_file_n('ROW-BY-ROW inserts '||get_time);
Line: 12426

    if EDW_OWB_COLLECTION_UTIL.drop_table(g_insert_ctas_table)=false then
      null;
Line: 12430

      write_to_log_file_n(g_insert_stmt_ctas||get_time);
Line: 12432

    execute immediate g_insert_stmt_ctas;
Line: 12440

    l_stmt:=l_stmt||'  as select rowid row_id from '||g_insert_ctas_table;
Line: 12451

    l_stmt:='select row_id from '||l_table1;
Line: 12460

        execute immediate g_insert_stmt_row using l_rowid;
Line: 12464

        write_to_log_file_n('Error in insert '||sqlerrm||get_time);
Line: 12471

          write_to_log_file_n('Error in g_insert_stmt '||g_status_message);
Line: 12478

      if refind_insert_rows=false then
        return false;
Line: 12485

    if EDW_OWB_COLLECTION_UTIL.drop_table(g_insert_ctas_table)=false then
      null;
Line: 12488

    g_total_insert:=g_number_rows_processed;
Line: 12491

      write_to_log_file_n('MASS inserts '||get_time);
Line: 12511

      execute immediate g_insert_stmt;
Line: 12513

      g_total_insert:=g_number_rows_processed;
Line: 12515

        write_to_log_file_n('Inserted '||sql%rowcount||' rows'||get_time);
Line: 12519

      write_to_log_file_n('Insert failed '||sqlerrm||get_time);
Line: 12524

            write_to_log_file_n('Unique constraint violated. Attempting again after finding rows for insert');
Line: 12526

          if refind_insert_rows=false then
            return false;
Line: 12529

          goto start_insert;
Line: 12531

          l_insert_type:='ROW-BY-ROW';
Line: 12532

          goto start_insert;
Line: 12538

          goto start_insert;
Line: 12542

          write_to_log_file_n('Error in g_insert_stmt '||g_status_message);
Line: 12548

        write_to_log_file_n('Error in g_insert_stmt '||g_status_message);
Line: 12561

  insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'INSERT'||p_count,'U');
Line: 12564

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Process Audit or Netchange Records',sysdate,
    null,'MAPPING','INSERT',g_jobid_stmt||'INSERTAN'||p_count,'I');
Line: 12569

    if l_insert_type='ROW-BY-ROW' then
      g_number_rows_processed:=0;
Line: 12576

      l_stmt:=l_stmt||'  as select rowid row_id from '||g_fact_audit_net_table;
Line: 12587

      l_stmt:='select row_id from '||l_table1;
Line: 12596

          execute immediate g_audit_net_insert_stmt_row using l_rowid;
Line: 12606

            write_to_log_file_n('Error in g_audit_net_insert_stmt_row '||g_status_message);
Line: 12614

      g_total_insert:=g_number_rows_processed;
Line: 12616

        if refind_insert_rows=false then
          return false;
Line: 12623

        execute immediate g_insert_stmt;
Line: 12630

        write_to_debug_n('MASS INSERT. Going to execute g_audit_net_insert_stmt'||get_time);
Line: 12649

        execute immediate g_audit_net_insert_stmt;
Line: 12651

        g_total_insert:=g_number_rows_processed;
Line: 12654

          write_to_log_file_n('Inserted '||g_number_rows_processed||' rows '||get_time);
Line: 12660

            write_to_log_file_n('Unique constraint violated. Attempting again after finding rows for insert');
Line: 12662

          if refind_insert_rows=false then
            return false;
Line: 12665

          goto start_insert;
Line: 12671

          goto start_insert;
Line: 12675

          write_to_log_file_n('Error in g_audit_net_insert_stmt '||g_status_message);
Line: 12683

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'INSERTAN'||p_count,'U');
Line: 12686

    write_to_log_file_n('Inserted '||g_number_rows_processed||' Rows '||get_time);
Line: 12689

    insert_into_load_progress_d(g_load_pk,g_primary_target_name,g_jobid_stmt||'Process Audit or Netchange Records',sysdate,
    null,'MAPPING','INSERT',g_jobid_stmt||'INSERTANN'||p_count,'I');
Line: 12691

    if execute_fa_nc_insert('INSERT') = false then
      insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'INSERTANN'||p_count,'U');
Line: 12695

    insert_into_load_progress_d(g_load_pk,null,null,null,sysdate,null,null,g_jobid_stmt||'INSERTANN'||p_count,'U');
Line: 12700

  write_to_log_file_n('Error in execute_insert_stmt '||g_status_message);
Line: 12719

  if g_ok_switch_update=100 then
    g_type_ok_generation:='UPDATE';
Line: 12721

    write_to_debug_n('g_type_ok_generation made UPDATE');
Line: 12727

        if l_percentage
Line: 12729

          write_to_debug_n('g_type_ok_generation made UPDATE');
Line: 12795

  g_stmt:=g_stmt||' as select row_id from '||g_ok_rowid_table||' where status=1';
Line: 12832

    g_stmt:=g_stmt||' as select /*+ORDERED USE_NL('||g_fstgTableName||')*/ ';
Line: 12834

    g_stmt:=g_stmt||' as select /*+ORDERED*/ ';
Line: 12874

  if g_last_update_date_flag then
    g_stmt:=g_stmt||',last_update_date';
Line: 12934

l_smart_update varchar2(10);
Line: 12947

l_smart_update_table varchar2(80);
Line: 12954

  l_smart_update_table:=p_table_name||'_SU';
Line: 12955

  g_stmt:='select '||
  'object_name'||
  ',mapping_id'||
  ',map_type'||
  ',primary_src'||
  ',primary_target'||
  ',primary_target_name'||
  ',object_type'||
  ',conc_id'||
  ',conc_program_name'||
  ',fact_audit'||
  ',net_change'||
  ',fact_audit_name'||
  ',net_change_name'||
  ',fact_audit_is_name'||
  ',net_change_is_name'||
  ',debug'||
  ',duplicate_collect'||
  ',execute_flag'||
  ',request_id'||
  ',collection_size'||
  ',parallel'||
  ',table_owner'||
  ',bis_owner'||
  ',temp_log'||
  ',forall_size'||
  ',update_type'||
  ',p_mode'||
  ',explain_plan_check'||
  ',fact_dlog'||
  ',key_set'||
  ',instance_type'||
  ',load_pk'||
  ',fresh_restart'||
  ',op_table_space'||
  ',da_table'||
  ',pp_table'||
  ',master_instance'||
  ',rollback'||
  ',smart_update'||
  ',fk_use_nl'||
  ',fact_smart_update'||
  ',auto_dang_table_extn'||
  ',log_dang_keys'||
  ',create_parent_table_records'||
  ',check_fk_change'||
  ',stg_join_nl_percentage'||
  ',ok_switch_update'||
  ',stg_make_copy_percentage'||
  ',ok_table'||
  ',hash_area_size'||
  ',sort_area_size'||
  ',trace_mode'||
  ',read_cfig_options'||
  ',job_status_table'||
  ',max_round'||
  ',update_dlog_lookup_table'||
  ',dlog_has_data'||
  ',total_records'||
  ',stg_copy_table_flag,'||
  'sleep_time,'||
  'parallel_drill_down'||
  ' from '||p_table_name;
Line: 13048

  ,g_update_type
  ,g_mode
  ,l_explain_plan_check
  ,g_fact_dlog
  ,g_key_set
  ,g_instance_type
  ,g_load_pk
  ,l_fresh_restart
  ,g_op_table_space
  ,g_da_table
  ,g_pp_table
  ,g_master_instance
  ,g_rollback
  ,l_smart_update
  ,g_fk_use_nl
  ,g_fact_smart_update
  ,g_auto_dang_table_extn
  ,l_log_dang_keys
  ,l_create_parent_table_records
  ,l_check_fk_change
  ,g_stg_join_nl_percentage
  ,g_ok_switch_update
  ,g_stg_make_copy_percentage
  ,g_main_ok_table_name
  ,g_hash_area_size
  ,g_sort_area_size
  ,l_trace
  ,l_read_cfig_options
  ,g_job_status_table
  ,g_max_round
  ,g_update_dlog_lookup_table
  ,l_dlog_has_data
  ,g_total_records
  ,l_stg_copy_table_flag
  ,g_sleep_time
  ,l_parallel_drill_down;
Line: 13094

  g_smart_update:=false;
Line: 13127

  if l_smart_update='Y' then
    g_smart_update:=true;
Line: 13182

    write_to_log_file('g_update_type='||g_update_type);
Line: 13195

    write_to_log_file('l_smart_update='||l_smart_update);
Line: 13197

    write_to_log_file('g_fact_smart_update='||g_fact_smart_update);
Line: 13203

    write_to_log_file('g_ok_switch_update='||g_ok_switch_update);
Line: 13212

    write_to_log_file('g_update_dlog_lookup_table='||g_update_dlog_lookup_table);
Line: 13220

  g_stmt:='select col_name from '||l_skip_cols_table;
Line: 13240

  g_stmt:='select col_name,stg_col_name from '||l_da_cols_table;
Line: 13257

  g_stmt:='select col_name from '||l_skip_levels_table;
Line: 13274

  g_stmt:='select col_name from '||l_smart_update_table;
Line: 13275

  g_number_smart_update_cols:=1;
Line: 13278

    fetch cv into g_smart_update_cols(g_number_smart_update_cols);
Line: 13280

    g_number_smart_update_cols:=g_number_smart_update_cols+1;
Line: 13283

  g_number_smart_update_cols:=g_number_smart_update_cols-1;
Line: 13285

    write_to_log_file_n('Smart Update Columns');
Line: 13286

    for i in 1..g_number_smart_update_cols loop
      write_to_log_file(g_smart_update_cols(i));
Line: 13326

      write_to_log_file_n(l_ok_rowid_table||' has status 1. we need to update interface table '||
      'to READY for these rows');
Line: 13329

    if update_stg_status_column(l_ok_rowid_table,'row_id',' where status=1 ','READY',true)=false then
      return false;
Line: 13363

  g_stmt:=g_stmt||' as select '||l_ok_table||'.*,rownum row_num from '||l_ok_table;
Line: 13420

    g_skip_ilog_update:=true;
Line: 13614

  l_parameter(13):='p_update_type';
Line: 13800

function insert_fm_ff_table
return boolean is
------
l_fstg_measures edw_owb_collection_util.varcharTableType;
Line: 13813

    write_to_log_file_n('In insert_fm_ff_table '||get_time);
Line: 13835

  g_stmt:='insert all into '||g_user_measure_table||'(';
Line: 13851

  g_stmt:=substr(g_stmt,1,length(g_stmt)-1)||') select ';
Line: 13878

  l_stmt:=l_stmt||' as select row_id from '||g_ok_rowid_table||' where status=1';
Line: 13913

  write_to_log_file_n('Error in insert_fm_ff_table '||g_status_message);
Line: 14010

    if edw_owb_collection_util.update_status_table(g_dd_status_table,'status','RUNNING','where parent_ltc_id='||
      g_primary_target)=false then
      return false;
Line: 14014

    if edw_owb_collection_util.update_status_table(g_dd_status_table,'job_id',g_ltc_drill_down_job_id,
      'where parent_ltc_id='||g_primary_target)=false then
      return false;
Line: 14230

  l_stmt:='select child_ltc,child_ltc_id from '||p_dd_table||' where parent_ltc_id=:1 and '||
  'child_ltc_id is not null order by level_order';
Line: 14251

  l_stmt:='select parent_ltc,parent_ltc_id from '||p_dd_table||' where child_ltc_id=:1 order by level_order';
Line: 14271

  if merge_all_update_rowids(p_parent_id,p_ul_table,p_ur_pattern,l_parent_pci_table,l_num_parent_ltc)=false then
    raise l_exception;
Line: 14282

        if edw_owb_collection_util.update_status_table(p_dd_table,'status','DONE','where parent_ltc_id='||
          p_parent_id||' and child_ltc_id='||l_child_ltc_id(i))=false then
          null;
Line: 14296

    if edw_owb_collection_util.update_status_table(p_dd_table,'status','DONE','where parent_ltc_id='||
      p_parent_id)=false then
      null;
Line: 14310

    if edw_owb_collection_util.update_status_table(p_dd_table,'status','ERROR+++'||g_status_message,
      'where parent_ltc_id='||p_parent_id)=false then
      null;
Line: 14322

    if edw_owb_collection_util.update_status_table(p_dd_table,'status','ERROR+++'||sqlerrm,'where parent_ltc_id='||
      p_parent_id)=false then
      null;
Line: 14349

select distinct
pk_col.column_name,
fk_col.column_name
from
edw_level_relations_md_v lvl_rel,
edw_pvt_key_columns_md_v pk_key,
edw_pvt_columns_md_v pk_col,
edw_pvt_key_columns_md_v fk_key,
edw_pvt_columns_md_v fk_col
where
lvl_rel.PARENT_LVLTBL_ID=p_parent_id
and lvl_rel.CHILD_LVLTBL_ID=p_child_id
and pk_key.key_id=lvl_rel.uk_id
and pk_col.column_id=pk_key.column_id
and fk_key.key_id=lvl_rel.fk_id
and fk_col.column_id=fk_key.column_id;
Line: 14391

    'select distinct '||
    'pk_col.column_name, '||
    'fk_col.column_name '||
    'from '||
    'edw_level_relations_md_v lvl_rel, '||
    'edw_pvt_key_columns_md_v pk_key, '||
    'edw_pvt_columns_md_v pk_col, '||
    'edw_pvt_key_columns_md_v fk_key, '||
    'edw_pvt_columns_md_v fk_col '||
    'where  '||
    'lvl_rel.PARENT_LVLTBL_ID=p_parent_id '||
    'and lvl_rel.CHILD_LVLTBL_ID=p_child_id '||
    'and pk_key.key_id=lvl_rel.uk_id '||
    'and pk_col.column_id=pk_key.column_id '||
    'and fk_key.key_id=lvl_rel.fk_id '||
    'and fk_col.column_id=fk_key.column_id; ');
Line: 14430

  l_stmt:=l_stmt||' as select ';
Line: 14461

for a ltc, find out all update rowid tables and merge into UL table.
UL=update L
if UL table does not exist, create one.
we dont care for checking to see if ul table exists because in case of error
recovery, we go the old route of snplog
*/
function merge_all_update_rowids(
p_ltc_id number,
p_ul_table varchar2,
p_ur_pattern varchar2,
p_pci_tables EDW_OWB_COLLECTION_UTIL.varcharTableType,
p_num_pci_tables number
)return boolean is
--
l_table EDW_OWB_COLLECTION_UTIL.varcharTableType;
Line: 14484

    write_to_log_file_n('In merge_all_update_rowids '||get_time);
Line: 14515

        l_stmt:=l_stmt||' select row_id from '||l_table(i)||' union all';
Line: 14521

      l_stmt:=l_stmt||' select row_id from '||l_pci_table(i)||' union';
Line: 14548

  write_to_log_file_n('Error in merge_all_update_rowids '||g_status_message);
Line: 14561

select LOG_TABLE from all_snapshot_logs where master=p_ltc and LOG_OWNER=p_table_owner;
Line: 14563

select dim_id,LEVEL_PREFIX from edw_levels_md_v where LEVEL_TABLE_NAME=p_ltc;
Line: 14580

    write_to_log_file_n('select dim_id,LEVEL_PREFIX from edw_levels_md_v where LEVEL_TABLE_NAME='||p_ltc);
Line: 14593

    write_to_log_file_n('select LOG_TABLE from all_snapshot_logs where master='||p_ltc||
    ' and LOG_OWNER='||p_table_owner);
Line: 14625

    l_stmt:=l_stmt||' as select ';
Line: 14646

      l_stmt:=l_stmt||' as select ';
Line: 14662

      l_stmt:=l_stmt||' union select row_id row_id';