Загрузка данных


procedure postUpdateWH(p_batch_id varchar2 := null) is
  l_batch_id varchar2(100);
begin
  -- Определяем батч
  if p_batch_id is null then
    l_batch_id := xxwh.etlRuntime.currentBatch;
  else
    l_batch_id := p_batch_id;
  end if;

  dbms_output.put_line('postUpdateWH: Start with batch_id='||l_batch_id);

  -- Блок 1: Основная таблица
  begin
    log(p_batch_id => l_batch_id);
    dbms_output.put_line('postUpdateWH: log() finished without error');
    commit;
  exception
    when others then
      dbms_output.put_line('postUpdateWH: ERROR in log(): '||SQLERRM);
      dbms_output.put_line('postUpdateWH: BACKTRACE: '||DBMS_UTILITY.format_error_backtrace);
      rollback;
      begin
        error(p_message => '{"Error":"'||DBMS_UTILITY.format_error_backtrace||', batch='||l_batch_id||'"}',
              p_batch_id => l_batch_id,
              p_table_name => c_table_name
        );
      exception
        when others then
          dbms_output.put_line('postUpdateWH: ERROR in error(): '||SQLERRM);
      end;
  end;

  -- Блок 2: ICE таблица
  begin
    logIce(p_batch_id => l_batch_id);
    dbms_output.put_line('postUpdateWH: logIce() finished without error');
    commit;
  exception
    when others then
      dbms_output.put_line('postUpdateWH: ERROR in logIce(): '||SQLERRM);
      dbms_output.put_line('postUpdateWH: BACKTRACE: '||DBMS_UTILITY.format_error_backtrace);
      rollback;
      begin
        error(p_message => '{"Error":"'||DBMS_UTILITY.format_error_backtrace||', batch='||l_batch_id||'"}',
              p_batch_id => l_batch_id,
              p_table_name => c_table_name_ice
        );
      exception
        when others then
          dbms_output.put_line('postUpdateWH: ERROR in error(): '||SQLERRM);
      end;
  end;

  dbms_output.put_line('postUpdateWH: Finished');
end;