DBA Data[Home] [Help]

APPS.XLA_AAD_MERGE_PVT SQL Statements

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

Line: 89

    SELECT *
      FROM xla_appli_amb_contexts
     WHERE application_id   = g_application_id
       AND amb_context_code = g_amb_context_code
    FOR UPDATE OF application_id NOWAIT;
Line: 187

  CURSOR c_updated IS
    SELECT 1
      FROM xla_appli_amb_contexts
     WHERE amb_context_code = g_amb_context_code
       AND application_id   = g_application_id
       AND updated_flag     = 'N';
Line: 197

    SELECT distinct t.name
      FROM xla_product_rules_b           w
         , xla_product_rules_b           s
         , xla_staging_components_h      h
         , xla_product_rules_tl          t
     WHERE w.version_num              > h.version_num
       AND w.amb_context_code         = g_amb_context_code
       AND w.application_id           = g_application_id
       AND w.product_rule_type_code   = s.product_rule_type_code
       AND w.product_rule_code        = s.product_rule_code
       --
       AND t.application_id           = w.application_id
       AND t.amb_context_code         = w.amb_context_code
       AND t.product_rule_type_code   = w.product_rule_type_code
       AND t.product_rule_code        = w.product_rule_code
       AND t.language                 = USERENV('LANG')
       --
       AND h.staging_amb_context_code = g_staging_context_code
       AND h.application_id           = g_application_id
       AND h.component_owner_code     = s.product_rule_type_code
       AND h.component_code           = s.product_rule_code
       AND h.component_type_code      = 'AAD'
       AND h.version_num              = s.version_num
       --
       AND s.amb_context_code        = g_staging_context_code
       AND s.application_id          = g_application_id;
Line: 250

    OPEN c_updated;
Line: 251

    FETCH c_updated INTO l_exists;
Line: 252

    IF (c_updated%NOTFOUND) THEN
      l_retcode := 'WARNING';
Line: 256

               ,p_msg_name        => 'XLA_AAD_MER_AMB_UPDATED');
Line: 258

    CLOSE c_updated;
Line: 302

    SELECT w.product_rule_code, w.version_num
      FROM xla_product_rules_b w
     WHERE w.application_id         = g_application_id
       AND w.amb_context_code       = g_amb_context_code
       AND w.product_rule_type_code = C_OWNER_SYSTEM
       AND NOT EXISTS ( SELECT 1
                          FROM xla_product_rules_b s
                         WHERE s.application_id         = g_application_id
                           AND s.amb_context_code       = g_staging_context_code
                           AND s.product_rule_type_code = C_OWNER_SYSTEM
                           AND s.product_rule_code      = w.product_rule_code);
Line: 335

    INSERT INTO xla_aad_loader_logs
    (aad_loader_log_id
    ,amb_context_code
    ,application_id
    ,request_code
    ,log_type_code
    ,aad_application_id
    ,product_rule_code
    ,product_rule_type_code
    ,version_to
    ,object_version_number
    ,creation_date
    ,created_by
    ,last_update_date
    ,last_updated_by
    ,last_update_login
    ,program_update_date
    ,program_application_id
    ,program_id
    ,request_id)
    VALUES
          (xla_aad_loader_logs_s.nextval
          ,g_amb_context_code
          ,g_application_id
          ,'IMPORT'
          ,'DELETED_AAD'
          ,g_application_id
          ,l_codes(i)
          ,C_OWNER_SYSTEM
          ,l_version_nums(i)
          ,1
          ,sysdate
          ,xla_environment_pkg.g_usr_id
          ,sysdate
          ,xla_environment_pkg.g_usr_id
          ,xla_environment_pkg.g_login_id
          ,sysdate
          ,xla_environment_pkg.g_prog_appl_id
          ,xla_environment_pkg.g_prog_id
          ,xla_environment_pkg.g_req_Id);
Line: 377

  DELETE FROM xla_aad_line_defn_assgns w
   WHERE application_id         = g_application_id
     AND amb_context_code       = g_amb_context_code
     AND product_rule_type_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_aad_line_defn_assgns s
           WHERE s.application_id             = g_application_id
             AND s.amb_context_code           = g_staging_context_code
             AND s.product_rule_type_code     = C_OWNER_SYSTEM
             AND s.product_rule_code          = w.product_rule_code
             AND s.event_class_code           = w.event_class_code
             AND s.event_type_code            = w.event_type_code
             AND s.line_definition_owner_code = w.line_definition_owner_code
             AND s.line_definition_code       = w.line_definition_code);
Line: 396

    trace(p_msg    => '# xla_aad_line_defn_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 402

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_aad_line_defn_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_aads');
Line: 411

  DELETE FROM xla_aad_header_ac_assgns w
   WHERE application_id         = g_application_id
     AND amb_context_code       = g_amb_context_code
     AND product_rule_type_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_aad_header_ac_assgns s
           WHERE s.application_id                 = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.product_rule_type_code         = C_OWNER_SYSTEM
             AND s.product_rule_code              = w.product_rule_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
             AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 429

    trace(p_msg    => '# xla_aad_header_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 436

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_aad_header_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_aads');
Line: 444

  DELETE FROM xla_aad_hdr_acct_attrs w
   WHERE application_id         = g_application_id
     AND amb_context_code       = g_amb_context_code
     AND product_rule_type_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_aad_hdr_acct_attrs s
           WHERE s.application_id            = g_application_id
             AND s.amb_context_code          = g_staging_context_code
             AND s.product_rule_type_code    = C_OWNER_SYSTEM
             AND s.product_rule_code         = w.product_rule_code
             AND s.event_class_code          = w.event_class_code
             AND s.event_type_code           = w.event_type_code
             AND s.accounting_attribute_code = w.accounting_attribute_code);
Line: 461

    trace(p_msg    => '# xla_aad_hdr_acct_attrs deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 468

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_aad_hdr_acct_attrs deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_aads');
Line: 476

  DELETE FROM xla_prod_acct_headers w
   WHERE application_id         = g_application_id
     AND amb_context_code       = g_amb_context_code
     AND product_rule_type_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_prod_acct_headers s
           WHERE s.application_id         = g_application_id
             AND s.amb_context_code       = g_staging_context_code
             AND s.product_rule_type_code = C_OWNER_SYSTEM
             AND s.product_rule_code      = w.product_rule_code
             AND s.event_class_code       = w.event_class_code
             AND s.event_type_code        = w.event_type_code);
Line: 491

    trace(p_msg    => '# xla_prod_acct_headers deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 497

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_prod_acct_headers deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_aads');
Line: 507

    DELETE FROM xla_product_rules_tl w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND product_rule_type_code = C_OWNER_SYSTEM
       AND product_rule_code      = l_codes(i);
Line: 514

    trace(p_msg    => '# xla_product_rules_tl deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 520

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_product_rules_tl deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_aads');
Line: 529

    DELETE FROM xla_product_rules_b w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND product_rule_type_code = C_OWNER_SYSTEM
       AND product_rule_code      = l_codes(i);
Line: 536

    trace(p_msg    => '# xla_product_rules_b deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 542

   xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_product_rules_b deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_aads');
Line: 584

    SELECT w.event_class_code
         , w.event_type_code
         , w.line_definition_code
      FROM xla_line_definitions_b w
     WHERE w.application_id             = g_application_id
       AND w.amb_context_code           = g_amb_context_code
       AND w.line_definition_owner_code = C_OWNER_SYSTEM
       AND NOT EXISTS ( SELECT 1
                          FROM xla_line_definitions_b s
                         WHERE s.application_id             = g_application_id
                           AND s.amb_context_code           = g_staging_context_code
                           AND s.event_class_code           = w.event_class_code
                           AND s.event_type_code            = w.event_type_code
                           AND s.line_definition_owner_code = C_OWNER_SYSTEM
                           AND s.line_definition_code       = w.line_definition_code);
Line: 630

    DELETE FROM xla_aad_line_defn_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND event_class_code           = l_event_class_codes(i)
       AND event_type_code            = l_event_type_codes(i)
       AND line_definition_owner_code = C_OWNER_SYSTEM
       AND line_definition_code       = l_codes(i);
Line: 639

    trace(p_msg    => '# xla_aad_line_defn_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 645

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_aad_line_defn_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 653

  DELETE FROM xla_line_defn_ac_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_line_defn_ac_assgns s
           WHERE s.application_id                 = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.line_definition_owner_code     = C_OWNER_SYSTEM
             AND s.line_definition_code           = w.line_definition_code
             AND s.accounting_line_type_code      = w.accounting_line_type_code
             AND s.accounting_line_code           = w.accounting_line_code
             AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
             AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 672

    trace(p_msg    => '# xla_line_defn_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 678

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 686

  DELETE FROM xla_line_defn_adr_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_line_defn_adr_assgns s
           WHERE s.application_id             = g_application_id
             AND s.amb_context_code           = g_staging_context_code
             AND s.event_class_code           = w.event_class_code
             AND s.event_type_code            = w.event_type_code
             AND s.line_definition_owner_code = C_OWNER_SYSTEM
             AND s.line_definition_code       = w.line_definition_code
             AND s.accounting_line_type_code  = w.accounting_line_type_code
             AND s.accounting_line_code       = w.accounting_line_code
             AND s.flexfield_segment_code     = w.flexfield_segment_code);
Line: 704

    trace(p_msg    => '# xla_line_defn_adr_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 710

         xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_adr_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 718

  DELETE FROM xla_line_defn_jlt_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_line_defn_jlt_assgns s
           WHERE s.application_id             = g_application_id
             AND s.amb_context_code           = g_staging_context_code
             AND s.event_class_code           = w.event_class_code
             AND s.event_type_code            = w.event_type_code
             AND s.line_definition_owner_code = C_OWNER_SYSTEM
             AND s.line_definition_code       = w.line_definition_code
             AND s.accounting_line_type_code  = w.accounting_line_type_code
             AND s.accounting_line_code       = w.accounting_line_code);
Line: 735

    trace(p_msg    => '# xla_line_defn_jlt_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 741

         xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_jlt_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 748

  DELETE FROM xla_mpa_jlt_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_mpa_jlt_assgns s
           WHERE s.application_id                 = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.line_definition_owner_code     = C_OWNER_SYSTEM
             AND s.line_definition_code           = w.line_definition_code
             AND s.accounting_line_type_code      = w.accounting_line_type_code
             AND s.accounting_line_code           = w.accounting_line_code
             AND s.mpa_accounting_line_type_code  = w.mpa_accounting_line_type_code
             AND s.mpa_accounting_line_code       = w.mpa_accounting_line_code);
Line: 767

    trace(p_msg    => '# xla_mpa_jlt_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 773

          xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 780

  DELETE FROM xla_mpa_header_ac_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_mpa_header_ac_assgns s
           WHERE s.application_id                 = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.line_definition_owner_code     = C_OWNER_SYSTEM
             AND s.line_definition_code           = w.line_definition_code
             AND s.accounting_line_type_code      = w.accounting_line_type_code
             AND s.accounting_line_code           = w.accounting_line_code
             AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
             AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 799

    trace(p_msg    => '# xla_mpa_header_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 805

            xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_header_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 813

  DELETE FROM xla_mpa_jlt_adr_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_mpa_jlt_adr_assgns s
           WHERE s.application_id                 = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.line_definition_owner_code     = C_OWNER_SYSTEM
             AND s.line_definition_code           = w.line_definition_code
             AND s.accounting_line_type_code      = w.accounting_line_type_code
             AND s.accounting_line_code           = w.accounting_line_code
             AND s.mpa_accounting_line_type_code  = w.mpa_accounting_line_type_code
             AND s.mpa_accounting_line_code       = w.mpa_accounting_line_code
             AND s.flexfield_segment_code         = w.flexfield_segment_code);
Line: 833

    trace(p_msg    => '# xla_mpa_jlt_adr_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 839

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_adr_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 847

  DELETE FROM xla_mpa_jlt_ac_assgns w
   WHERE application_id             = g_application_id
     AND amb_context_code           = g_amb_context_code
     AND line_definition_owner_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_mpa_jlt_ac_assgns s
           WHERE s.application_id                 = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.line_definition_owner_code     = C_OWNER_SYSTEM
             AND s.line_definition_code           = w.line_definition_code
             AND s.accounting_line_type_code      = w.accounting_line_type_code
             AND s.accounting_line_code           = w.accounting_line_code
             AND s.mpa_accounting_line_type_code  = w.mpa_accounting_line_type_code
             AND s.mpa_accounting_line_code       = w.mpa_accounting_line_code
             AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
             AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 868

    trace(p_msg    => '# xla_mpa_jlt_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 874

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 882

    DELETE FROM xla_line_definitions_tl w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND event_class_code           = l_event_class_codes(i)
       AND event_type_code            = l_event_type_codes(i)
       AND line_definition_owner_code = C_OWNER_SYSTEM
       AND line_definition_code       = l_codes(i);
Line: 891

    trace(p_msg    => '# xla_line_definitions_tl deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 897

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_definitions_tl deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 906

    DELETE FROM xla_line_definitions_b w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND event_class_code           = l_event_class_codes(i)
       AND event_type_code            = l_event_type_codes(i)
       AND line_definition_owner_code = C_OWNER_SYSTEM
       AND line_definition_code       = l_codes(i);
Line: 915

    trace(p_msg    => '# xla_line_definitions_b deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 921

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_definitions_b deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlds');
Line: 958

    SELECT work.event_class_code
         , work.accounting_line_code
      FROM xla_acct_line_types_b work
     WHERE work.application_id            = g_application_id
       AND work.amb_context_code          = g_amb_context_code
       AND work.accounting_line_type_code = C_OWNER_SYSTEM
       AND NOT EXISTS ( SELECT 1
                          FROM xla_acct_line_types_b stage
                         WHERE stage.application_id            = g_application_id
                           AND stage.amb_context_code          = g_staging_context_code
                           AND stage.event_class_code          = work.event_class_code
                           AND stage.accounting_line_type_code = C_OWNER_SYSTEM
                           AND stage.accounting_line_code      = work.accounting_line_code);
Line: 995

    DELETE FROM xla_mpa_jlt_adr_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1003

    trace(p_msg    => '# xla_mpa_jlt_adr_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1009

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_adr_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1018

    DELETE FROM xla_mpa_jlt_ac_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1026

    trace(p_msg    => '# xla_mpa_jlt_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1032

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1040

    DELETE FROM xla_mpa_header_ac_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1048

    trace(p_msg    => '# xla_mpa_header_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1054

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_header_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1063

    DELETE FROM xla_mpa_jlt_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1071

    trace(p_msg    => '# xla_mpa_jlt_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1077

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1085

    DELETE FROM xla_line_defn_adr_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1093

    trace(p_msg    => '# xla_line_defn_adr_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1099

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_adr_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1107

    DELETE FROM xla_line_defn_ac_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1115

    trace(p_msg    => '# xla_line_defn_ac_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1121

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_ac_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1130

    DELETE FROM xla_line_defn_jlt_assgns w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1138

    trace(p_msg    => '# xla_line_defn_jlt_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1144

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_jlt_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1153

    DELETE FROM xla_jlt_acct_attrs w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1162

    trace(p_msg    => '# xla_jlt_acct_attrs deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1168

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_jlt_acct_attrs deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1177

    DELETE FROM xla_acct_line_types_b w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1185

    trace(p_msg    => '# xla_acct_line_types_b deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1191

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_b deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1200

    DELETE FROM xla_acct_line_types_tl w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND event_class_code          = l_event_class_codes(i)
       AND accounting_line_type_code = C_OWNER_SYSTEM
       AND accounting_line_code      = l_codes(i);
Line: 1208

    trace(p_msg    => '# xla_acct_line_types_tl deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1214

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_tl deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_jlts');
Line: 1259

    SELECT work.description_code
      FROM xla_descriptions_b work
     WHERE work.application_id         = g_application_id
       AND work.amb_context_code       = g_amb_context_code
       AND work.description_type_code  = C_OWNER_SYSTEM
       AND NOT EXISTS ( SELECT 1
                          FROM xla_descriptions_b stage
                         WHERE stage.application_id        = g_application_id
                           AND stage.amb_context_code      = g_staging_context_code
                           AND stage.description_type_code = C_OWNER_SYSTEM
                           AND stage.description_code      = work.description_code);
Line: 1297

    UPDATE xla_line_defn_jlt_assgns
       SET description_type_code = NULL
         , description_code      = NULL
     WHERE application_id        = g_application_id
       AND amb_context_code      = g_amb_context_code
       AND description_type_code = C_OWNER_SYSTEM
       AND description_code      = l_codes(i);
Line: 1312

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_jlt_assgns clear description = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1321

    UPDATE xla_prod_acct_headers
       SET description_type_code = NULL
         , description_code      = NULL
     WHERE application_id        = g_application_id
       AND amb_context_code      = g_amb_context_code
       AND description_type_code = C_OWNER_SYSTEM
       AND description_code      = l_codes(i);
Line: 1337

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_prod_acct_headers clear description = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1346

    DELETE FROM xla_descript_details_tl w
     WHERE description_detail_id IN
           (SELECT description_detail_id
              FROM xla_descript_details_b d
                 , xla_desc_priorities p
             WHERE d.description_prio_id   = p.description_prio_id
               AND p.application_id        = g_application_id
               AND p.amb_context_code      = g_amb_context_code
               AND p.description_type_code = C_OWNER_SYSTEM
               AND p.description_code      = l_codes(i));
Line: 1358

    trace(p_msg    => '# xla_descript_details_tl deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1364

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descript_details_tl deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1373

    DELETE FROM xla_descript_details_b w
     WHERE description_prio_id IN
           (SELECT description_prio_id
              FROM xla_desc_priorities p
             WHERE p.application_id        = g_application_id
               AND p.amb_context_code      = g_amb_context_code
               AND p.description_type_code = C_OWNER_SYSTEM
               AND p.description_code      = l_codes(i));
Line: 1383

    trace(p_msg    => '# xla_descript_details_b deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1389

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descript_details_b deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1398

    DELETE FROM xla_desc_priorities w
     WHERE application_id        = g_application_id
       AND amb_context_code      = g_amb_context_code
       AND description_type_code = C_OWNER_SYSTEM
       AND description_code      = l_codes(i);
Line: 1405

    trace(p_msg    => '# xla_desc_priorities deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1411

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_desc_priorities deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1420

    DELETE FROM xla_descriptions_tl w
     WHERE application_id        = g_application_id
       AND amb_context_code      = g_amb_context_code
       AND description_type_code = C_OWNER_SYSTEM
       AND description_code      = l_codes(i);
Line: 1427

    trace(p_msg    => '# xla_descriptions_tl deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1433

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descriptions_tl deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1442

    DELETE FROM xla_descriptions_b w
     WHERE application_id        = g_application_id
       AND amb_context_code      = g_amb_context_code
       AND description_type_code = C_OWNER_SYSTEM
       AND description_code      = l_codes(i);
Line: 1449

    trace(p_msg    => '# xla_descriptions_b deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1455

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_descriptions_b deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_descriptions');
Line: 1494

    SELECT work.segment_rule_code
      FROM xla_seg_rules_b work
     WHERE work.application_id         = g_application_id
       AND work.amb_context_code       = g_amb_context_code
       AND work.segment_rule_type_code = C_OWNER_SYSTEM
       AND NOT EXISTS
           (SELECT 1
              FROM xla_seg_rules_b stage
             WHERE stage.application_id         = g_application_id
               AND stage.amb_context_code       = g_staging_context_code
               AND stage.segment_rule_type_code = C_OWNER_SYSTEM
               AND stage.segment_rule_code      = work.segment_rule_code);
Line: 1533

    trace(p_msg    => '# ADRs to be deleted = '||l_codes.COUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_PROCEDURE);
Line: 1539

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# ADRs to be deleted = '||l_codes.COUNT,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1550

  INSERT INTO xla_aad_loader_logs
  (aad_loader_log_id
  ,amb_context_code
  ,application_id
  ,request_code
  ,log_type_code
  ,aad_application_id
  ,component_type_code
  ,component_owner_code
  ,component_code
  ,object_version_number
  ,creation_date
  ,created_by
  ,last_update_date
  ,last_updated_by
  ,last_update_login
  ,program_update_date
  ,program_application_id
  ,program_id
  ,request_id)
  SELECT xla_aad_loader_logs_s.nextval
        ,g_amb_context_code
        ,g_application_id
        ,'IMPORT'
        ,'DELETED_SETUP'
        ,application_id
        ,'AMB_ADR'
        ,C_OWNER_SYSTEM
        ,l_codes(i)
        ,1
        ,sysdate
        ,xla_environment_pkg.g_usr_id
        ,sysdate
        ,xla_environment_pkg.g_usr_id
        ,xla_environment_pkg.g_login_id
        ,sysdate
        ,xla_environment_pkg.g_prog_appl_id
        ,xla_environment_pkg.g_prog_id
        ,xla_environment_pkg.g_req_Id
   FROM (SELECT application_id
           FROM xla_seg_rule_details s
          WHERE application_id              <> g_application_id
            AND amb_context_code             = g_amb_context_code
            AND value_segment_rule_appl_id   = g_application_id
            AND value_segment_rule_type_code = C_OWNER_SYSTEM
            AND value_segment_rule_code      = l_codes(i)
          UNION
         SELECT application_id
           FROM xla_line_defn_adr_assgns
          WHERE application_id              <> g_application_id
            AND amb_context_code             = g_amb_context_code
            AND segment_rule_appl_id         = g_application_id
            AND segment_rule_type_code       = C_OWNER_SYSTEM
            AND segment_rule_code            = l_codes(i)
          UNION
         SELECT application_id
           FROM xla_mpa_jlt_adr_assgns
          WHERE application_id              <> g_application_id
            AND amb_context_code             = g_amb_context_code
            AND segment_rule_appl_id         = g_application_id
            AND segment_rule_type_code       = C_OWNER_SYSTEM
            AND segment_rule_code            = l_codes(i));
Line: 1614

    trace(p_msg    => '# xla_aad_loader_logs inserted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1620

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_aad_loader_logs inserted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1630

    DELETE FROM xla_seg_rule_details d
     WHERE amb_context_code             = g_amb_context_code
       AND value_segment_rule_appl_id   = g_application_id
       AND value_segment_rule_type_code = C_OWNER_SYSTEM
       AND value_segment_rule_code      = l_codes(i);
Line: 1637

    trace(p_msg    => '# xla_seg_rules_details (value) deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1643

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_seg_rules_details (value) deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1652

    DELETE FROM xla_mpa_jlt_adr_assgns w
     WHERE amb_context_code       = g_amb_context_code
       AND segment_rule_appl_id   = g_application_id
       AND segment_rule_type_code = C_OWNER_SYSTEM
       AND segment_rule_code      = l_codes(i);
Line: 1659

    trace(p_msg    => '# xla_mpa_jlt_adr_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1665

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_mpa_jlt_adr_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1674

    DELETE FROM xla_line_defn_adr_assgns w
     WHERE amb_context_code       = g_amb_context_code
       AND segment_rule_appl_id   = g_application_id
       AND segment_rule_type_code = C_OWNER_SYSTEM
       AND segment_rule_code      = l_codes(i);
Line: 1681

    trace(p_msg    => '# xla_line_defn_adr_assgns deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1687

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_line_defn_adr_assgns deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1697

    DELETE FROM xla_seg_rule_details w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND segment_rule_type_code = C_OWNER_SYSTEM
       AND segment_rule_code      = l_codes(i);
Line: 1704

    trace(p_msg    => '# xla_seg_rule_details deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1710

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_seg_rule_details deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1719

    DELETE FROM xla_seg_rules_tl w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND segment_rule_type_code = C_OWNER_SYSTEM
       AND segment_rule_code      = l_codes(i);
Line: 1726

    trace(p_msg    => '# xla_seg_rules_tl deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1732

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_seg_rules_tl deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1741

    DELETE FROM xla_seg_rules_b w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND segment_rule_type_code = C_OWNER_SYSTEM
       AND segment_rule_code      = l_codes(i);
Line: 1748

    trace(p_msg    => '#xla_seg_rules_b deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1754

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'#xla_seg_rules_b deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_adrs');
Line: 1792

    SELECT w.analytical_criterion_code
      FROM xla_analytical_hdrs_b w
     WHERE w.amb_context_code               = g_amb_context_code
       AND w.application_id                 = g_application_id
       AND w.analytical_criterion_type_code = C_OWNER_SYSTEM
       AND NOT EXISTS ( SELECT 1
                          FROM xla_analytical_hdrs_b s
                         WHERE s.amb_context_code               = g_staging_context_code
                           AND s.application_id                 = g_application_id
                           AND s.analytical_criterion_type_code = C_OWNER_SYSTEM
                           AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 1830

    DELETE FROM xla_aad_header_ac_assgns w
     WHERE application_id                 = g_application_id
       AND amb_context_code               = g_amb_context_code
       AND analytical_criterion_type_code = C_OWNER_SYSTEM
       AND analytical_criterion_code      = l_codes(i);
Line: 1837

    trace(p_msg    => '# xla_aad_header_ac_assgns deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1843

    DELETE FROM xla_line_defn_ac_assgns w
     WHERE amb_context_code               = g_amb_context_code
       AND analytical_criterion_type_code = C_OWNER_SYSTEM
       AND analytical_criterion_code      = l_codes(i);
Line: 1849

    trace(p_msg    => '# xla_line_defn_ac_assgns deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1855

    DELETE FROM xla_mpa_header_ac_assgns w
     WHERE amb_context_code               = g_amb_context_code
       AND analytical_criterion_type_code = C_OWNER_SYSTEM
       AND analytical_criterion_code      = l_codes(i);
Line: 1861

    trace(p_msg    => '# xla_mpa_header_ac_assgns deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1867

    DELETE FROM xla_mpa_jlt_ac_assgns w
     WHERE amb_context_code               = g_amb_context_code
       AND analytical_criterion_type_code = C_OWNER_SYSTEM
       AND analytical_criterion_code      = l_codes(i);
Line: 1873

    trace(p_msg    => '# xla_mpa_jlt_ac_assgns deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1879

  DELETE FROM xla_analytical_sources w
   WHERE amb_context_code               = g_amb_context_code
     AND analytical_criterion_type_code = C_OWNER_SYSTEM
     AND application_id = g_application_id -- added bug6696939
     AND NOT EXISTS
         (SELECT 1
            FROM xla_analytical_sources s
           WHERE s.amb_context_code               = g_staging_context_code
             AND s.application_id                 = g_application_id
             AND s.entity_code                    = w.entity_code
             AND s.event_class_code               = w.event_class_code
             AND s.source_application_id          = w.source_application_id
             AND s.source_type_code               = w.source_type_code
             AND s.source_code                    = w.source_code
             AND s.analytical_criterion_type_code = C_OWNER_SYSTEM
             AND s.analytical_criterion_code      = w.analytical_criterion_code
             AND s.analytical_detail_code         = w.analytical_detail_code);
Line: 1898

    trace(p_msg    => '# xla_analytical_sources deleted = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1905

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_analytical_sources deleted = '||l_num_rows,
             p_component_code   =>  'clean_oracle_acs');
Line: 1913

  /*DELETE FROM xla_analytical_dtls_tl w
   WHERE amb_context_code               = g_amb_context_code
     AND analytical_criterion_type_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_analytical_dtls_b s
           WHERE s.amb_context_code               = g_staging_context_code
             AND s.analytical_criterion_type_code = C_OWNER_SYSTEM
             AND s.analytical_criterion_code      = w.analytical_criterion_code
             AND s.analytical_detail_code         = w.analytical_detail_code);
Line: 1925

    trace(p_msg    => '# xla_analytical_dtls_tl deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1930

  DELETE FROM xla_analytical_dtls_b w
   WHERE amb_context_code               = g_amb_context_code
     AND analytical_criterion_type_code = C_OWNER_SYSTEM
     AND NOT EXISTS
         (SELECT 1
            FROM xla_analytical_dtls_b s
           WHERE s.amb_context_code               = g_staging_context_code
             AND s.analytical_criterion_type_code = C_OWNER_SYSTEM
             AND s.analytical_criterion_code      = w.analytical_criterion_code
             AND s.analytical_detail_code         = w.analytical_detail_code);
Line: 1942

    trace(p_msg    => '# xla_analytical_dtls_b deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1948

    DELETE FROM xla_analytical_hdrs_tl w
     WHERE amb_context_code               = g_amb_context_code
       AND analytical_criterion_type_code = C_OWNER_SYSTEM
       AND analytical_criterion_code      = l_codes(i);
Line: 1954

    trace(p_msg    => '# xla_analytical_hdrs_tl deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 1960

    DELETE FROM xla_analytical_hdrs_b w
     WHERE amb_context_code               = g_amb_context_code
       AND analytical_criterion_type_code = C_OWNER_SYSTEM
       AND analytical_criterion_code      = l_codes(i);
Line: 1966

    trace(p_msg    => '# xla_analytical_hdrs_b deleted = '||SQL%ROWCOUNT,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2014

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'AAD clean up complete',
             p_component_code   =>  'clean_oracle_aads');
Line: 2024

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'JLD clean up complete',
             p_component_code   =>  'clean_oracle_jlds');
Line: 2034

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'JLT clean up complete',
             p_component_code   =>  'clean_oracle_jlts');
Line: 2044

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'JED clean up complete',
             p_component_code   =>  'clean_oracle_descriptions');
Line: 2054

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'ADR clean up complete',
             p_component_code   =>  'clean_oracle_adrs');
Line: 2064

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Analytical Criteria clean up complete',
             p_component_code   =>  'clean_oracle_acs');
Line: 2116

    INSERT INTO xla_aad_loader_logs
         (aad_loader_log_id
         ,amb_context_code
         ,application_id
         ,request_code
         ,log_type_code
         ,aad_application_id
         ,product_rule_code
         ,product_rule_type_code
         ,version_from
         ,version_to
         ,object_version_number
         ,creation_date
         ,created_by
         ,last_update_date
         ,last_updated_by
         ,last_update_login
         ,program_update_date
         ,program_application_id
         ,program_id
         ,request_id)
         SELECT xla_aad_loader_logs_s.nextval
               ,g_amb_context_code
               ,g_application_id
               ,'IMPORT'
               ,'MERGED_AAD'
               ,g_application_id
               ,w.product_rule_code
               ,w.product_rule_type_code
               ,w.version_num
               ,s.version_num
               ,1
               ,sysdate
               ,xla_environment_pkg.g_usr_id
               ,sysdate
               ,xla_environment_pkg.g_usr_id
               ,xla_environment_pkg.g_login_id
               ,sysdate
               ,xla_environment_pkg.g_prog_appl_id
               ,xla_environment_pkg.g_prog_id
               ,xla_environment_pkg.g_req_Id
          FROM xla_product_rules_b s
             , xla_product_rules_b w
         WHERE s.application_id         = g_application_id
           AND s.amb_context_code       = g_staging_context_code
           AND w.application_id         = g_application_id
           AND w.amb_context_code       = g_amb_context_code
           AND w.product_rule_type_code = s.product_rule_type_code
           AND w.product_rule_code      = s.product_rule_code;
Line: 2171

   INSERT INTO xla_aads_gt
        ( product_rule_code,
          event_class_code,
          event_type_code,
          line_definition_code,
          table_name
        )
   select product_rule_code  ,
          event_class_code   ,
          event_type_code    ,
          line_definition_code ,
          'XLA_AAD_LINE_DEFN_ASSGNS'
   from (select   product_rule_code ,
                  event_class_code        ,
                  event_type_code         ,
                  line_definition_code    ,
                  'XLA_AAD_LINE_DEFN_ASSGNS' ,
                  amb_context_code,
                  last_update_date ,
                  nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
         from
            (select product_rule_code ,
                    event_class_code        ,
                    event_type_code         ,
                    line_definition_code    ,
                   'XLA_AAD_LINE_DEFN_ASSGNS' ,
                    amb_context_code,
                    last_update_date ,
                    lag(last_update_date) over (PARTITION by application_id,
                                                            product_rule_code,
							    product_rule_type_code,
                                                            event_class_code,
                                                            event_type_code,
                                                            line_definition_code,
							    line_definition_owner_code
                                               order by     amb_context_code
                                               ) lag_date
             from XLA_AAD_LINE_DEFN_ASSGNS
             order by amb_context_code
            ) x
         where x.amb_context_code =g_staging_context_code
        )
  where flag = 'False';
Line: 2216

             trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_aad_line_defn_assgns is :'||l_num_rows,
                   p_module => l_log_module,
                   p_level  => C_LEVEL_PROCEDURE);
Line: 2222

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_aad_line_defn_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2230

    INSERT INTO xla_aads_gt
        ( product_rule_code,
          event_class_code,
          accounting_attribute_code,
          source_code,
          table_name
     )
    select product_rule_code  ,
           event_class_code   ,
           accounting_attribute_code,
           source_code,
          'XLA_AAD_HDR_ACCT_ATTRS'
    from
    (select product_rule_code
          ,event_class_code
          ,accounting_attribute_code
          ,source_code
	      ,'XLA_AAD_HDR_ACCT_ATTRS'
          ,amb_context_code
          ,last_update_date
          ,nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
     from
           (select product_rule_code
                  ,event_class_code
                  ,accounting_attribute_code
                  ,source_code
	              ,'XLA_AAD_HDR_ACCT_ATTRS'
                  ,amb_context_code
                  ,last_update_date
                  ,lag(last_update_date) over (PARTITION by application_id
                                                           ,product_rule_code
							   ,product_rule_type_code
                                                           ,event_class_code
                                                           ,accounting_attribute_code
                                                           ,event_type_code
                                               order by    amb_context_code
                                               ) lag_date
            from XLA_AAD_HDR_ACCT_ATTRS
            order by amb_context_code
            ) x
     where x.amb_context_code =g_staging_context_code
    )
    where flag = 'False';
Line: 2276

             trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_aad_hdr_acct_attrs is :'||l_num_rows,
                   p_module => l_log_module,
                   p_level  => C_LEVEL_PROCEDURE);
Line: 2282

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_aad_hdr_acct_attrs is :'||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2290

    INSERT INTO xla_aads_gt
        (  product_rule_code,
           event_class_code,
           event_type_code,
           analytical_criterion_code,
           table_name
        )
    select product_rule_code,
           event_class_code,
           event_type_code,
           analytical_criterion_code,
	       'XLA_AAD_HEADER_AC_ASSGNS'
    from (select product_rule_code,
                 event_class_code,
                 event_type_code,
                 analytical_criterion_code,
	             'XLA_AAD_HEADER_AC_ASSGNS',
                 amb_context_code,
                 last_update_date ,
                 nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
          from
             (select product_rule_code,
                     event_class_code,
                     event_type_code,
                     analytical_criterion_code,
	                 'XLA_AAD_HEADER_AC_ASSGNS',
                     amb_context_code,
                     last_update_date ,
                     lag(last_update_date) over (PARTITION by application_id,
                                                              product_rule_code,
							      product_rule_type_code,
                                                              event_class_code,
                                                              event_type_code,
                                                              analytical_criterion_code,
							      analytical_criterion_type_code
                                                 order by     amb_context_code
                                                ) lag_date
              from XLA_AAD_HEADER_AC_ASSGNS
              order by amb_context_code
              ) x
          where x.amb_context_code =g_staging_context_code
         )
    where flag = 'False';
Line: 2336

             trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_aad_header_ac_assgns is :'||l_num_rows,
                   p_module => l_log_module,
                   p_level  => C_LEVEL_PROCEDURE);
Line: 2342

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_aad_header_ac_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2351

      UPDATE xla_product_rules_b pr
      SET compile_status_code= nvl((select compile_status_code
                               from  xla_product_rules_b pr1
                               where pr1.product_rule_code      = pr.product_rule_code
                               and   pr1.product_rule_type_code = pr.product_rule_type_code
                               and   pr1.amb_context_code       = g_amb_context_code
		    	               and   pr1.application_id         = g_application_id
                               ),'N')  --Bug: 10276169 - If select returns null then update default value 'N'.
      WHERE amb_context_code = g_staging_context_code
      AND   application_id   = g_application_id;
Line: 2364

           trace(p_msg    => 'Number of Rows updated in PRODUCT_RULES to original status is :'||l_num_rows,
                 p_module => l_log_module,
                 p_level  => C_LEVEL_PROCEDURE);
Line: 2370

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows updated in PRODUCT_RULES to original status is :'||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2380

    DELETE FROM xla_product_rules_b w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_product_rules_b s
                    WHERE s.application_id         = g_application_id
                      AND s.amb_context_code       = g_staging_context_code
                      AND s.product_rule_type_code = w.product_rule_type_code
                      AND s.product_rule_code      = w.product_rule_code);
Line: 2391

      trace(p_msg    => '# xla_product_rules_b deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 2397

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_product_rules_b deleted : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2405

    DELETE FROM xla_product_rules_tl w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_product_rules_tl s
                    WHERE s.application_id         = g_application_id
                      AND s.amb_context_code       = g_staging_context_code
                      AND s.product_rule_type_code = w.product_rule_type_code
                      AND s.product_rule_code      = w.product_rule_code
                      AND s.language               = w.language);
Line: 2417

      trace(p_msg    => '# xla_product_rules_tl deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 2423

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_product_rules_tl deleted : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2431

    DELETE FROM xla_prod_acct_headers w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_prod_acct_headers s
                    WHERE s.application_id         = g_application_id
                      AND s.amb_context_code       = g_staging_context_code
                      AND s.product_rule_type_code = w.product_rule_type_code
                      AND s.product_rule_code      = w.product_rule_code
                      AND s.event_class_code       = w.event_class_code
                      AND s.event_type_code        = w.event_type_code);
Line: 2444

      trace(p_msg    => '# xla_prod_acct_headers deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 2450

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_prod_acct_headers deleted : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2458

    DELETE FROM xla_aad_line_defn_assgns w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_aad_line_defn_assgns s
                    WHERE s.application_id             = g_application_id
                      AND s.amb_context_code           = g_staging_context_code
                      AND s.product_rule_type_code     = w.product_rule_type_code
                      AND s.product_rule_code          = w.product_rule_code
                      AND s.event_class_code           = w.event_class_code
                      AND s.event_type_code            = w.event_type_code
                      AND s.line_definition_owner_code = w.line_definition_owner_code
                      AND s.line_definition_code       = w.line_definition_code);
Line: 2473

      trace(p_msg    => '# xla_aad_line_defn_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 2479

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_aad_line_defn_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2487

    DELETE FROM xla_aad_hdr_acct_attrs w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_aad_hdr_acct_attrs s
                    WHERE s.application_id            = g_application_id
                      AND s.amb_context_code          = g_staging_context_code
                      AND s.product_rule_type_code    = w.product_rule_type_code
                      AND s.product_rule_code         = w.product_rule_code
                      AND s.event_class_code          = w.event_class_code
                      AND s.event_type_code           = w.event_type_code
                      AND s.accounting_attribute_code = w.accounting_attribute_code);
Line: 2500

    DELETE FROM xla_aad_header_ac_assgns w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_aad_header_ac_assgns s
                    WHERE s.application_id                 = g_application_id
                      AND s.amb_context_code               = g_staging_context_code
                      AND s.event_class_code               = w.event_class_code
                      AND s.event_type_code                = w.event_type_code
                      AND s.product_rule_type_code         = w.product_rule_type_code
                      AND s.product_rule_code              = w.product_rule_code
                      AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
                      AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 2515

      trace(p_msg    => '# xla_aad_header_ac_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 2521

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_aad_header_ac_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2531

  UPDATE xla_product_rules_b
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 2537

    trace(p_msg    => '# xla_product_rules_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2543

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_product_rules_b updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2551

  UPDATE xla_product_rules_tl w
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND NOT EXISTS (SELECT 1
                       FROM xla_product_rules_tl s
                      WHERE s.application_id         = g_application_id
                        AND s.amb_context_code       = g_amb_context_code
                        AND s.product_rule_type_code = w.product_rule_type_code
                        AND s.name                   = w.name
                        AND s.language               = w.language);
Line: 2564

    trace(p_msg    => '# xla_product_rules_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2570

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_product_rules_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2578

  UPDATE xla_product_rules_tl w
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||product_rule_code||') '||name,1,80)
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND EXISTS (SELECT 1
                   FROM xla_product_rules_tl s
                  WHERE s.application_id         = g_application_id
                    AND s.amb_context_code       = g_amb_context_code
                    AND s.product_rule_type_code = w.product_rule_type_code
                    AND s.name                   = w.name
                    AND s.language               = w.language);
Line: 2592

    trace(p_msg    => '# xla_product_rules_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2598

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_product_rules_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2605

  UPDATE xla_prod_acct_headers
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 2611

    trace(p_msg    => '# xla_prod_acct_headers updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2617

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_prod_acct_headers updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2625

  UPDATE xla_aad_line_defn_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 2631

    trace(p_msg    => '# xla_aad_line_defn_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2637

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_aad_line_defn_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2645

  UPDATE xla_aad_hdr_acct_attrs
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 2651

    trace(p_msg    => '# xla_aad_hdr_acct_attrs updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2657

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_aad_hdr_acct_attrs updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2665

  UPDATE xla_aad_header_ac_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 2671

    trace(p_msg    => '# xla_aad_header_ac_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 2677

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_aad_header_ac_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_aads');
Line: 2729

    INSERT INTO xla_aads_gt
     (  event_class_code,
        event_type_code,
        line_definition_code,
        table_name
     )
    select event_class_code,
           event_type_code,
           line_definition_code,
	       'XLA_LINE_DEFINITIONS_B'
    from
        (select event_class_code,
                event_type_code,
                line_definition_code,
	            'XLA_LINE_DEFINITIONS_B',
                amb_context_code,
                last_update_date ,
                nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
         from
            (select event_class_code,
                    event_type_code,
                    line_definition_code,
	                'XLA_LINE_DEFINITIONS_B',
                    amb_context_code,
                    last_update_date ,
                    lag(last_update_date) over (PARTITION by application_id,
                                                             event_class_code,
                                                             event_type_code,
                                                             line_definition_code,
							     line_definition_owner_code
                                                order by     amb_context_code
                                                ) lag_date
             from xla_line_definitions_b
             order by amb_context_code
            ) x
         where x.amb_context_code =g_staging_context_code
        )
    where flag = 'False';
Line: 2770

                trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_line_definitions_b is :'||l_num_rows,
                      p_module => l_log_module,
                      p_level  => C_LEVEL_PROCEDURE);
Line: 2776

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_line_definitions_b is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 2784

    INSERT INTO xla_aads_gt
    (   event_class_code,
        event_type_code,
	    line_definition_code,
	    accounting_line_code,
	    table_name
    )
    select  event_class_code,
            event_type_code,
            line_definition_code,
            accounting_line_code,
	        'XLA_LINE_DEFN_JLT_ASSGNS'
    from
     (select event_class_code,
             event_type_code,
             line_definition_code,
             accounting_line_code,
	         'XLA_LINE_DEFN_JLT_ASSGNS',
             amb_context_code,
             last_update_date ,
             nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
      from
        (select event_class_code,
                event_type_code,
                line_definition_code,
                accounting_line_code,
	            'XLA_LINE_DEFN_JLT_ASSGNS',
                amb_context_code,
                last_update_date ,
                lag(last_update_date) over (PARTITION by application_id,
                                                         event_class_code,
                                                         event_type_code,
                                                         line_definition_code,
							 line_definition_owner_code,
                                                         accounting_line_code,
							 accounting_line_type_code
                                            order by     amb_context_code
                                            ) lag_date
         from XLA_LINE_DEFN_JLT_ASSGNS
         order by amb_context_code
        ) x
      where x.amb_context_code =g_staging_context_code
      )
    where flag = 'False';
Line: 2831

                trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_line_defn_jlt_assgns is :'||l_num_rows,
                      p_module => l_log_module,
                      p_level  => C_LEVEL_PROCEDURE);
Line: 2837

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_line_defn_jlt_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 2845

    INSERT INTO xla_aads_gt
       (  event_class_code,
          event_type_code,
          line_definition_code,
          accounting_line_code,
          segment_rule_code,
          table_name
        )
    select event_class_code,
           event_type_code,
           line_definition_code,
           accounting_line_code,
           segment_rule_code,
           'XLA_LINE_DEFN_ADR_ASSGNS'
    from
      (select event_class_code,
              event_type_code,
              line_definition_code,
              accounting_line_code,
              segment_rule_code,
              'XLA_LINE_DEFN_ADR_ASSGNS',
              amb_context_code,
              last_update_date ,
              nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
       from
          (select event_class_code,
                  event_type_code,
                  line_definition_code,
                  accounting_line_code,
                  segment_rule_code,
                  'XLA_LINE_DEFN_ADR_ASSGNS',
                  amb_context_code,
                  last_update_date,
                  lag(last_update_date) over (PARTITION by application_id,
                                                           event_class_code,
                                                           event_type_code,
                                                           line_definition_code,
							   line_definition_owner_code,
                                                           accounting_line_code,
							   accounting_line_type_code,
                                                           segment_rule_code,
							   segment_rule_type_code
                                              order by     amb_context_code
                                              ) lag_date
           from XLA_LINE_DEFN_ADR_ASSGNS
           order by amb_context_code
           ) x
       where x.amb_context_code = g_staging_context_code
       )
    where flag = 'False';
Line: 2897

                trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_line_defn_adr_assgns is :'||l_num_rows,
                      p_module => l_log_module,
                      p_level  => C_LEVEL_PROCEDURE);
Line: 2903

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_line_defn_adr_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 2911

      INSERT INTO xla_aads_gt
        ( event_class_code,
          event_type_code,
          line_definition_code,
          accounting_line_code,
          analytical_criterion_code,
          table_name
        )
      select  event_class_code,
              event_type_code,
              line_definition_code,
              accounting_line_code,
              analytical_criterion_code,
              'XLA_LINE_DEFN_AC_ASSGNS'
      from
         (select event_class_code,
                 event_type_code,
                 line_definition_code,
                 accounting_line_code,
                 analytical_criterion_code,
                 'XLA_LINE_DEFN_AC_ASSGNS',
                 amb_context_code,
                 last_update_date ,
                 nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
          from
            (select event_class_code,
                    event_type_code,
                    line_definition_code,
                    accounting_line_code,
                    analytical_criterion_code,
                   'XLA_LINE_DEFN_AC_ASSGNS',
                    amb_context_code,
                    last_update_date ,
                    lag(last_update_date) over (PARTITION by application_id,
                                                             event_class_code,
                                                             event_type_code,
                                                             line_definition_code,
							     line_definition_owner_code,
                                                             accounting_line_code,
							     accounting_line_type_code,
                                                             analytical_criterion_code,
							     analytical_criterion_type_code
                                                order by     amb_context_code
                                                ) lag_date
             from XLA_LINE_DEFN_AC_ASSGNS
             order by amb_context_code
             ) x
          where x.amb_context_code = g_staging_context_code
          )
      where flag = 'False';
Line: 2964

               trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_line_defn_ac_assgns is :'||l_num_rows,
                     p_module => l_log_module,
                     p_level  => C_LEVEL_PROCEDURE);
Line: 2970

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_line_defn_ac_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 2978

    INSERT INTO xla_aads_gt
       (   event_class_code
          ,event_type_code
	  ,line_definition_code
	  ,accounting_line_code
	  ,mpa_accounting_line_code
	  ,table_name
	)
   select  mpa_jlt_assgns.event_class_code
          ,mpa_jlt_assgns.event_type_code
          ,mpa_jlt_assgns.line_definition_code
          ,mpa_jlt_assgns.accounting_line_code
          ,mpa_jlt_assgns.mpa_accounting_line_code
	  ,'XLA_MPA_JLT_ASSGNS'
    from   XLA_MPA_JLT_ASSGNS     mpa_jlt_assgns
    where  mpa_jlt_assgns.application_id   = g_application_id
    and    mpa_jlt_assgns.amb_context_code = g_staging_context_code
	AND EXISTS (
            SELECT 1
              FROM xla_acct_line_types_b xal
             WHERE xal.application_id            = g_application_id
               AND xal.amb_context_code          = g_staging_context_code
               AND xal.event_class_code          = mpa_jlt_assgns.event_class_code
               AND xal.accounting_line_type_code = mpa_jlt_assgns.accounting_line_type_code
               AND xal.accounting_line_code      = mpa_jlt_assgns.accounting_line_code
               AND xal.mpa_option_code           = 'ACCRUAL')
    AND    (EXISTS (SELECT 1
                   FROM   XLA_MPA_JLT_ASSGNS     mpa_jlt_assgns1
                   WHERE  mpa_jlt_assgns.event_class_code           = mpa_jlt_assgns1.event_class_code
                   and    mpa_jlt_assgns.event_type_code            = mpa_jlt_assgns1.event_type_code
                   and    mpa_jlt_assgns.line_definition_code       = mpa_jlt_assgns1.line_definition_code
                   and    mpa_jlt_assgns.line_definition_owner_code = mpa_jlt_assgns1.line_definition_owner_code
                   and    mpa_jlt_assgns.accounting_line_code       = mpa_jlt_assgns1.accounting_line_code
                   and    mpa_jlt_assgns.accounting_line_type_code  = mpa_jlt_assgns1.accounting_line_type_code
                   and    mpa_jlt_assgns.mpa_accounting_line_code   = mpa_jlt_assgns1.mpa_accounting_line_code
                   and    mpa_jlt_assgns.mpa_accounting_line_type_code = mpa_jlt_assgns1.mpa_accounting_line_type_code
                   and    mpa_jlt_assgns.application_id             = mpa_jlt_assgns1.application_id
                   and    mpa_jlt_assgns1.amb_context_code          = g_amb_context_code
                   and    to_char(mpa_jlt_assgns.last_update_date,'DD-MON-YYYY') <> to_char(mpa_jlt_assgns1.last_update_date,'DD-MON-YYYY')
                   )
	    OR
	    NOT EXISTS (SELECT 1
                   FROM   XLA_MPA_JLT_ASSGNS     mpa_jlt_assgns1
                   WHERE  mpa_jlt_assgns.event_class_code           = mpa_jlt_assgns1.event_class_code
                   and    mpa_jlt_assgns.event_type_code            = mpa_jlt_assgns1.event_type_code
                   and    mpa_jlt_assgns.line_definition_code       = mpa_jlt_assgns1.line_definition_code
                   and    mpa_jlt_assgns.line_definition_owner_code = mpa_jlt_assgns1.line_definition_owner_code
                   and    mpa_jlt_assgns.accounting_line_code       = mpa_jlt_assgns1.accounting_line_code
                   and    mpa_jlt_assgns.accounting_line_type_code  = mpa_jlt_assgns1.accounting_line_type_code
                   and    mpa_jlt_assgns.mpa_accounting_line_code   = mpa_jlt_assgns1.mpa_accounting_line_code
                   and    mpa_jlt_assgns.mpa_accounting_line_type_code = mpa_jlt_assgns1.mpa_accounting_line_type_code
                   and    mpa_jlt_assgns.application_id             = mpa_jlt_assgns1.application_id
                   and    mpa_jlt_assgns1.amb_context_code          = g_amb_context_code
                   )
	    );
Line: 3035

                trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_mpa_jlt_assgns is :'||l_num_rows,
                      p_module => l_log_module,
                      p_level  => C_LEVEL_PROCEDURE);
Line: 3041

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_mpa_jlt_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3049

      INSERT INTO xla_aads_gt
       (   event_class_code
          ,event_type_code
	  ,line_definition_code
	  ,accounting_line_code
	  ,analytical_criterion_code
	  ,table_name
	)
   select  mpa_hdr_ac_assgns.event_class_code
          ,mpa_hdr_ac_assgns.event_type_code
          ,mpa_hdr_ac_assgns.line_definition_code
          ,mpa_hdr_ac_assgns.accounting_line_code
          ,mpa_hdr_ac_assgns.analytical_criterion_code
	  ,'XLA_MPA_HEADER_AC_ASSGNS'
    from   XLA_MPA_HEADER_AC_ASSGNS mpa_hdr_ac_assgns
    where  mpa_hdr_ac_assgns.application_id    = g_application_id
    and    mpa_hdr_ac_assgns.amb_context_code  = g_staging_context_code
    and    (EXISTS(SELECT 1
                  FROM   XLA_MPA_HEADER_AC_ASSGNS mpa_hdr_ac_assgns1
                  WHERE  mpa_hdr_ac_assgns.event_class_code               = mpa_hdr_ac_assgns1.event_class_code
                  and    mpa_hdr_ac_assgns.event_type_code                = mpa_hdr_ac_assgns1.event_type_code
                  and    mpa_hdr_ac_assgns.line_definition_code           = mpa_hdr_ac_assgns1.line_definition_code
                  and    mpa_hdr_ac_assgns.line_definition_owner_code     = mpa_hdr_ac_assgns1.line_definition_owner_code
                  and    mpa_hdr_ac_assgns.accounting_line_code           = mpa_hdr_ac_assgns1.accounting_line_code
                  and    mpa_hdr_ac_assgns.accounting_line_type_code      = mpa_hdr_ac_assgns1.accounting_line_type_code
                  and    mpa_hdr_ac_assgns.analytical_criterion_code      = mpa_hdr_ac_assgns1.analytical_criterion_code
                  and    mpa_hdr_ac_assgns.analytical_criterion_type_code = mpa_hdr_ac_assgns1.analytical_criterion_type_code
                  and    mpa_hdr_ac_assgns.application_id                 = mpa_hdr_ac_assgns1.application_id
                  and    mpa_hdr_ac_assgns1.amb_context_code              = g_amb_context_code
                  and    to_char(mpa_hdr_ac_assgns.last_update_date,'DD-MON-YYYY') <> to_char(mpa_hdr_ac_assgns1.last_update_date,'DD-MON-YYYY')
	          UNION
                  SELECT 1
                  FROM xla_acct_line_types_b s
                  WHERE s.application_id          = g_application_id
                  and s.amb_context_code          = g_staging_context_code
                  and s.event_class_code          = mpa_hdr_ac_assgns.event_class_code
                  and s.accounting_line_type_code = mpa_hdr_ac_assgns.accounting_line_type_code
                  and s.accounting_line_code      = mpa_hdr_ac_assgns.accounting_line_code
                  and s.mpa_option_code           = 'NONE'
                  )
	    OR
	    NOT EXISTS(SELECT 1
                  FROM   XLA_MPA_HEADER_AC_ASSGNS mpa_hdr_ac_assgns1
                  WHERE  mpa_hdr_ac_assgns.event_class_code               = mpa_hdr_ac_assgns1.event_class_code
                  and    mpa_hdr_ac_assgns.event_type_code                = mpa_hdr_ac_assgns1.event_type_code
                  and    mpa_hdr_ac_assgns.line_definition_code           = mpa_hdr_ac_assgns1.line_definition_code
                  and    mpa_hdr_ac_assgns.line_definition_owner_code     = mpa_hdr_ac_assgns1.line_definition_owner_code
                  and    mpa_hdr_ac_assgns.accounting_line_code           = mpa_hdr_ac_assgns1.accounting_line_code
                  and    mpa_hdr_ac_assgns.accounting_line_type_code      = mpa_hdr_ac_assgns1.accounting_line_type_code
                  and    mpa_hdr_ac_assgns.analytical_criterion_code      = mpa_hdr_ac_assgns1.analytical_criterion_code
                  and    mpa_hdr_ac_assgns.analytical_criterion_type_code = mpa_hdr_ac_assgns1.analytical_criterion_type_code
                  and    mpa_hdr_ac_assgns.application_id                 = mpa_hdr_ac_assgns1.application_id
                  and    mpa_hdr_ac_assgns1.amb_context_code              = g_amb_context_code
	          UNION
                  SELECT 1
                  FROM xla_acct_line_types_b s
                  WHERE s.application_id          = g_application_id
                  and s.amb_context_code          = g_staging_context_code
                  and s.event_class_code          = mpa_hdr_ac_assgns.event_class_code
                  and s.accounting_line_type_code = mpa_hdr_ac_assgns.accounting_line_type_code
                  and s.accounting_line_code      = mpa_hdr_ac_assgns.accounting_line_code
                  and s.mpa_option_code           = 'NONE'
                 )
	    );
Line: 3115

                trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_mpa_header_ac_assgns is :'||l_num_rows,
                      p_module => l_log_module,
                      p_level  => C_LEVEL_PROCEDURE);
Line: 3121

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_mpa_header_ac_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3129

     INSERT INTO xla_aads_gt
         (
 	   event_class_code
	  ,event_type_code
	  ,line_definition_code
	  ,accounting_line_code
	  ,mpa_accounting_line_code
	  ,segment_rule_code
	  ,table_name
	 )
   select  mpa_jlt_adr_assgns.event_class_code
          ,mpa_jlt_adr_assgns.event_type_code
          ,mpa_jlt_adr_assgns.line_definition_code
          ,mpa_jlt_adr_assgns.accounting_line_code
          ,mpa_jlt_adr_assgns.mpa_accounting_line_code
	  ,mpa_jlt_adr_assgns.segment_rule_code
	  ,'XLA_MPA_JLT_ADR_ASSGNS'
    from   XLA_MPA_JLT_ADR_ASSGNS mpa_jlt_adr_assgns
    where  mpa_jlt_adr_assgns.application_id   = g_application_id
    and    mpa_jlt_adr_assgns.amb_context_code = g_staging_context_code
    and    EXISTS ( SELECT 1
                 FROM xla_mpa_jlt_assgns s
                 WHERE s.application_id               = g_application_id
                  AND s.amb_context_code              = g_staging_context_code
                  AND s.event_class_code              = mpa_jlt_adr_assgns.event_class_code
                  AND s.event_type_code               = mpa_jlt_adr_assgns.event_type_code
                  AND s.line_definition_owner_code    = mpa_jlt_adr_assgns.line_definition_owner_code
                  AND s.line_definition_code          = mpa_jlt_adr_assgns.line_definition_code
                  AND s.accounting_line_type_code     = mpa_jlt_adr_assgns.accounting_line_type_code
                  AND s.accounting_line_code          = mpa_jlt_adr_assgns.accounting_line_code
                  AND s.mpa_accounting_line_type_code = mpa_jlt_adr_assgns.mpa_accounting_line_type_code
                  AND s.mpa_accounting_line_code      = mpa_jlt_adr_assgns.mpa_accounting_line_code
                UNION
                 SELECT 1
                 FROM xla_acct_line_types_b s
                 WHERE s.application_id           = g_application_id
                  AND s.amb_context_code          = g_staging_context_code
                  AND s.event_class_code          = mpa_jlt_adr_assgns.event_class_code
                  AND s.accounting_line_type_code = mpa_jlt_adr_assgns.accounting_line_type_code
                  AND s.accounting_line_code      = mpa_jlt_adr_assgns.accounting_line_code
                  AND s.mpa_option_code           = 'NONE')
    and    (EXISTS(SELECT 1
                  FROM   XLA_MPA_JLT_ADR_ASSGNS mpa_jlt_adr_assgns1
                  WHERE  mpa_jlt_adr_assgns.event_class_code              = mpa_jlt_adr_assgns1.event_class_code
                  and    mpa_jlt_adr_assgns.event_type_code               = mpa_jlt_adr_assgns1.event_type_code
                  and    mpa_jlt_adr_assgns.line_definition_code          = mpa_jlt_adr_assgns1.line_definition_code
                  and    mpa_jlt_adr_assgns.line_definition_owner_code    = mpa_jlt_adr_assgns1.line_definition_owner_code
                  and    mpa_jlt_adr_assgns.accounting_line_code          = mpa_jlt_adr_assgns1.accounting_line_code
                  and    mpa_jlt_adr_assgns.accounting_line_type_code     = mpa_jlt_adr_assgns1.accounting_line_type_code
                  and    mpa_jlt_adr_assgns.mpa_accounting_line_code      = mpa_jlt_adr_assgns1.mpa_accounting_line_code
                  and    mpa_jlt_adr_assgns.mpa_accounting_line_type_code = mpa_jlt_adr_assgns1.mpa_accounting_line_type_code
                  and    mpa_jlt_adr_assgns.segment_rule_code             = mpa_jlt_adr_assgns1.segment_rule_code
                  and    mpa_jlt_adr_assgns.segment_rule_type_code        = mpa_jlt_adr_assgns1.segment_rule_type_code
                  and    mpa_jlt_adr_assgns.application_id                = mpa_jlt_adr_assgns1.application_id
                  and    mpa_jlt_adr_assgns1.amb_context_code             = g_amb_context_code
                  and    to_char(mpa_jlt_adr_assgns.last_update_date,'DD-MON-YYYY') <> to_char(mpa_jlt_adr_assgns1.last_update_date,'DD-MON-YYYY')
                  )
	    OR
	    NOT EXISTS(SELECT 1
                  FROM   XLA_MPA_JLT_ADR_ASSGNS mpa_jlt_adr_assgns1
                  WHERE  mpa_jlt_adr_assgns.event_class_code              = mpa_jlt_adr_assgns1.event_class_code
                  and    mpa_jlt_adr_assgns.event_type_code               = mpa_jlt_adr_assgns1.event_type_code
                  and    mpa_jlt_adr_assgns.line_definition_code          = mpa_jlt_adr_assgns1.line_definition_code
                  and    mpa_jlt_adr_assgns.line_definition_owner_code    = mpa_jlt_adr_assgns1.line_definition_owner_code
                  and    mpa_jlt_adr_assgns.accounting_line_code          = mpa_jlt_adr_assgns1.accounting_line_code
                  and    mpa_jlt_adr_assgns.accounting_line_type_code     = mpa_jlt_adr_assgns1.accounting_line_type_code
                  and    mpa_jlt_adr_assgns.mpa_accounting_line_code      = mpa_jlt_adr_assgns1.mpa_accounting_line_code
                  and    mpa_jlt_adr_assgns.mpa_accounting_line_type_code = mpa_jlt_adr_assgns1.mpa_accounting_line_type_code
                  and    mpa_jlt_adr_assgns.segment_rule_code             = mpa_jlt_adr_assgns1.segment_rule_code
                  and    mpa_jlt_adr_assgns.segment_rule_type_code        = mpa_jlt_adr_assgns1.segment_rule_type_code
                  and    mpa_jlt_adr_assgns.application_id                = mpa_jlt_adr_assgns1.application_id
                  and    mpa_jlt_adr_assgns1.amb_context_code             = g_amb_context_code
                  )
	    );
Line: 3205

                trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_mpa_jlt_adr_assgns is :'||l_num_rows,
                      p_module => l_log_module,
                      p_level  => C_LEVEL_PROCEDURE);
Line: 3211

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_mpa_jlt_adr_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3219

   INSERT INTO xla_aads_gt
        (  event_class_code
	  ,event_type_code
	  ,line_definition_code
	  ,accounting_line_code
	  ,mpa_accounting_line_code
	  ,analytical_criterion_code
	  ,table_name
	)
   select  mpa_jlt_ac_assgns.event_class_code
          ,mpa_jlt_ac_assgns.event_type_code
          ,mpa_jlt_ac_assgns.line_definition_code
          ,mpa_jlt_ac_assgns.accounting_line_code
          ,mpa_jlt_ac_assgns.mpa_accounting_line_code
          ,mpa_jlt_ac_assgns.analytical_criterion_code
	  ,'XLA_MPA_JLT_AC_ASSGNS'
    from   XLA_MPA_JLT_AC_ASSGNS  mpa_jlt_ac_assgns
    where  mpa_jlt_ac_assgns.application_id   = g_application_id
    and    mpa_jlt_ac_assgns.amb_context_code = g_staging_context_code
    and    (EXISTS(SELECT 1
                  FROM   XLA_MPA_JLT_AC_ASSGNS  mpa_jlt_ac_assgns1
                  WHERE  mpa_jlt_ac_assgns.event_class_code               = mpa_jlt_ac_assgns1.event_class_code
                  and    mpa_jlt_ac_assgns.event_type_code                = mpa_jlt_ac_assgns1.event_type_code
                  and    mpa_jlt_ac_assgns.line_definition_code           = mpa_jlt_ac_assgns1.line_definition_code
                  and    mpa_jlt_ac_assgns.line_definition_owner_code     = mpa_jlt_ac_assgns1.line_definition_owner_code
                  and    mpa_jlt_ac_assgns.accounting_line_code           = mpa_jlt_ac_assgns1.accounting_line_code
                  and    mpa_jlt_ac_assgns.accounting_line_type_code      = mpa_jlt_ac_assgns1.accounting_line_type_code
                  and    mpa_jlt_ac_assgns.mpa_accounting_line_code       = mpa_jlt_ac_assgns1.mpa_accounting_line_code
                  and    mpa_jlt_ac_assgns.mpa_accounting_line_type_code  = mpa_jlt_ac_assgns1.mpa_accounting_line_type_code
                  and    mpa_jlt_ac_assgns.analytical_criterion_code      = mpa_jlt_ac_assgns1.analytical_criterion_code
                  and    mpa_jlt_ac_assgns.analytical_criterion_type_code = mpa_jlt_ac_assgns1.analytical_criterion_type_code
                  and    mpa_jlt_ac_assgns.application_id                 = mpa_jlt_ac_assgns1.application_id
                  and    mpa_jlt_ac_assgns1.amb_context_code              = g_amb_context_code
                  and    to_char(mpa_jlt_ac_assgns.last_update_date,'DD-MON-YYYY') <> to_char(mpa_jlt_ac_assgns1.last_update_date,'DD-MON-YYYY')
		  UNION
                  SELECT 1
                  FROM xla_acct_line_types_b s
                  WHERE s.application_id           = g_application_id
                  and s.amb_context_code           = g_staging_context_code
                  and s.event_class_code           = mpa_jlt_ac_assgns.event_class_code
                  and s.accounting_line_type_code  = mpa_jlt_ac_assgns.accounting_line_type_code
                  and s.accounting_line_code       = mpa_jlt_ac_assgns.accounting_line_code
                  and s.mpa_option_code            = 'NONE'
                  )
	    OR
	    NOT EXISTS(SELECT 1
                  FROM   XLA_MPA_JLT_AC_ASSGNS  mpa_jlt_ac_assgns1
                  WHERE  mpa_jlt_ac_assgns.event_class_code               = mpa_jlt_ac_assgns1.event_class_code
                  and    mpa_jlt_ac_assgns.event_type_code                = mpa_jlt_ac_assgns1.event_type_code
                  and    mpa_jlt_ac_assgns.line_definition_code           = mpa_jlt_ac_assgns1.line_definition_code
                  and    mpa_jlt_ac_assgns.line_definition_owner_code     = mpa_jlt_ac_assgns1.line_definition_owner_code
                  and    mpa_jlt_ac_assgns.accounting_line_code           = mpa_jlt_ac_assgns1.accounting_line_code
                  and    mpa_jlt_ac_assgns.accounting_line_type_code      = mpa_jlt_ac_assgns1.accounting_line_type_code
                  and    mpa_jlt_ac_assgns.mpa_accounting_line_code       = mpa_jlt_ac_assgns1.mpa_accounting_line_code
                  and    mpa_jlt_ac_assgns.mpa_accounting_line_type_code  = mpa_jlt_ac_assgns1.mpa_accounting_line_type_code
                  and    mpa_jlt_ac_assgns.analytical_criterion_code      = mpa_jlt_ac_assgns1.analytical_criterion_code
                  and    mpa_jlt_ac_assgns.analytical_criterion_type_code = mpa_jlt_ac_assgns1.analytical_criterion_type_code
                  and    mpa_jlt_ac_assgns.application_id                 = mpa_jlt_ac_assgns1.application_id
                  and    mpa_jlt_ac_assgns1.amb_context_code              = g_amb_context_code
		  UNION
                  SELECT 1
                  FROM xla_acct_line_types_b s
                  WHERE s.application_id           = g_application_id
                  and s.amb_context_code           = g_staging_context_code
                  and s.event_class_code           = mpa_jlt_ac_assgns.event_class_code
                  and s.accounting_line_type_code  = mpa_jlt_ac_assgns.accounting_line_type_code
                  and s.accounting_line_code       = mpa_jlt_ac_assgns.accounting_line_code
                  and s.mpa_option_code            = 'NONE'
                  )
	    );
Line: 3291

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_mpa_jlt_ac_assgns is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 3297

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'Number of Rows inserted into aads_gt from xla_mpa_jlt_ac_assgns is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3312

    DELETE FROM xla_line_definitions_b w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_line_definitions_b s
                    WHERE s.application_id             = g_application_id
                      AND s.amb_context_code           = g_staging_context_code
                      AND s.event_class_code           = w.event_class_code
                      AND s.event_type_code            = w.event_type_code
                      AND s.line_definition_owner_code = w.line_definition_owner_code
                      AND s.line_definition_code       = w.line_definition_code);
Line: 3325

      trace(p_msg    => '# xla_line_definitions_b deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3331

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_line_definitions_b deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3339

    DELETE FROM xla_line_definitions_tl w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_line_definitions_tl s
                    WHERE s.application_id             = g_application_id
                      AND s.amb_context_code           = g_staging_context_code
                      AND s.event_class_code           = w.event_class_code
                      AND s.event_type_code            = w.event_type_code
                      AND s.line_definition_owner_code = w.line_definition_owner_code
                      AND s.line_definition_code       = w.line_definition_code
                      AND s.language                   = w.language);
Line: 3353

      trace(p_msg    => '# xla_line_definitions_tl deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3359

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_line_definitions_tl deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3367

    DELETE FROM xla_line_defn_jlt_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_line_defn_jlt_assgns s
                    WHERE s.application_id             = g_application_id
                      AND s.amb_context_code           = g_staging_context_code
                      AND s.event_class_code           = w.event_class_code
                      AND s.event_type_code            = w.event_type_code
                      AND s.line_definition_owner_code = w.line_definition_owner_code
                      AND s.line_definition_code       = w.line_definition_code
                      AND s.accounting_line_type_code  = w.accounting_line_type_code
                      AND s.accounting_line_code       = w.accounting_line_code);
Line: 3383

      trace(p_msg    => '# xla_line_defn_jlt_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3389

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_line_defn_jlt_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3399

    DELETE FROM xla_line_defn_adr_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_line_defn_jlt_assgns s
                    WHERE s.application_id             = g_application_id
                      AND s.amb_context_code           = g_staging_context_code
                      AND s.event_class_code           = w.event_class_code
                      AND s.event_type_code            = w.event_type_code
                      AND s.line_definition_owner_code = w.line_definition_owner_code
                      AND s.line_definition_code       = w.line_definition_code
                      AND s.accounting_line_type_code  = w.accounting_line_type_code
                      AND s.accounting_line_code       = w.accounting_line_code);
Line: 3416

      trace(p_msg    => '# xla_line_defn_adr_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3422

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_line_defn_adr_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3430

    DELETE FROM xla_line_defn_ac_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_line_defn_ac_assgns s
                    WHERE s.application_id                 = g_application_id
                      AND s.amb_context_code               = g_staging_context_code
                      AND s.event_class_code               = w.event_class_code
                      AND s.event_type_code                = w.event_type_code
                      AND s.line_definition_owner_code     = w.line_definition_owner_code
                      AND s.line_definition_code           = w.line_definition_code
                      AND s.accounting_line_type_code      = w.accounting_line_type_code
                      AND s.accounting_line_code           = w.accounting_line_code
                      AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
                      AND s.analytical_criterion_code      = w.analytical_criterion_code);
Line: 3447

      trace(p_msg    => '# xla_line_defn_ac_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3453

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>'# xla_line_defn_ac_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3462

    DELETE FROM xla_mpa_jlt_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (
            SELECT 1
              FROM xla_acct_line_types_b xal
             WHERE xal.application_id            = g_application_id -- w.application_id -- changed for bug8635648
               AND xal.amb_context_code          = g_staging_context_code -- w.amb_context_code  -- changed for bug8635648
               AND xal.event_class_code          = w.event_class_code
               AND xal.accounting_line_type_code = w.accounting_line_type_code
               AND xal.accounting_line_code      = w.accounting_line_code
               AND xal.mpa_option_code           = 'ACCRUAL');
Line: 3476

      trace(p_msg    => '# xla_mpa_jlt_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3482

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3490

    DELETE FROM xla_mpa_header_ac_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (
            SELECT 1
              FROM xla_mpa_header_ac_assgns s
             WHERE s.application_id                 = g_application_id
               AND s.amb_context_code               = g_staging_context_code
               AND s.event_class_code               = w.event_class_code
               AND s.event_type_code                = w.event_type_code
               AND s.line_definition_owner_code     = w.line_definition_owner_code
               AND s.line_definition_code           = w.line_definition_code
               AND s.accounting_line_type_code      = w.accounting_line_type_code
               AND s.accounting_line_code           = w.accounting_line_code
               AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
               AND s.analytical_criterion_code      = w.analytical_criterion_code
             UNION
            SELECT 1
              FROM xla_acct_line_types_b s
             WHERE s.application_id            = g_application_id
               AND s.amb_context_code          = g_staging_context_code
               AND s.event_class_code          = w.event_class_code
               AND s.accounting_line_type_code = w.accounting_line_type_code
               AND s.accounting_line_code      = w.accounting_line_code
               AND s.mpa_option_code           = 'NONE');
Line: 3517

      trace(p_msg    => '# xla_mpa_header_ac_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3523

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_header_ac_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3533

    DELETE FROM xla_mpa_jlt_adr_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (
            SELECT 1
              FROM xla_mpa_jlt_assgns s
             WHERE s.application_id                = g_application_id
               AND s.amb_context_code              = g_staging_context_code
               AND s.event_class_code              = w.event_class_code
               AND s.event_type_code               = w.event_type_code
               AND s.line_definition_owner_code    = w.line_definition_owner_code
               AND s.line_definition_code          = w.line_definition_code
               AND s.accounting_line_type_code     = w.accounting_line_type_code
               AND s.accounting_line_code          = w.accounting_line_code
               AND s.mpa_accounting_line_type_code = w.mpa_accounting_line_type_code
               AND s.mpa_accounting_line_code      = w.mpa_accounting_line_code
             UNION
            SELECT 1
              FROM xla_acct_line_types_b s
             WHERE s.application_id            = g_application_id
               AND s.amb_context_code          = g_staging_context_code
               AND s.event_class_code          = w.event_class_code
               AND s.accounting_line_type_code = w.accounting_line_type_code
               AND s.accounting_line_code      = w.accounting_line_code
               AND s.mpa_option_code           = 'NONE');
Line: 3560

      trace(p_msg    => '# xla_mpa_jlt_adr_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3566

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_adr_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3574

    DELETE FROM xla_mpa_jlt_ac_assgns w
     WHERE application_id             = g_application_id
       AND amb_context_code           = g_amb_context_code
       AND EXISTS (
            SELECT 1
              FROM xla_mpa_jlt_ac_assgns s
             WHERE s.application_id               = g_application_id
             AND s.amb_context_code               = g_staging_context_code
             AND s.event_class_code               = w.event_class_code
             AND s.event_type_code                = w.event_type_code
             AND s.line_definition_owner_code     = w.line_definition_owner_code
             AND s.line_definition_code           = w.line_definition_code
             AND s.accounting_line_type_code      = w.accounting_line_type_code
             AND s.accounting_line_code           = w.accounting_line_code
             AND s.mpa_accounting_line_type_code  = w.mpa_accounting_line_type_code
             AND s.mpa_accounting_line_code       = w.mpa_accounting_line_code
             AND s.analytical_criterion_type_code = w.analytical_criterion_type_code
             AND s.analytical_criterion_code      = w.analytical_criterion_code
           UNION
          SELECT 1
            FROM xla_acct_line_types_b s
           WHERE s.application_id             = g_application_id
             AND s.amb_context_code           = g_staging_context_code
             AND s.event_class_code           = w.event_class_code
             AND s.accounting_line_type_code  = w.accounting_line_type_code
             AND s.accounting_line_code       = w.accounting_line_code
             AND s.mpa_option_code            = 'NONE');
Line: 3604

      trace(p_msg    => '# xla_mpa_jlt_ac_assgns deleted : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 3610

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_ac_assgns deleted : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3621

  UPDATE xla_line_definitions_b
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3627

    trace(p_msg    => '# xla_line_definitions_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3633

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_definitions_b updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3641

  UPDATE xla_line_definitions_tl w
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND NOT EXISTS (SELECT 1
                       FROM xla_line_definitions_tl s
                      WHERE s.application_id             = g_application_id
                        AND s.amb_context_code           = g_amb_context_code
                        AND s.event_class_code           = w.event_class_code
                        AND s.event_type_code            = w.event_type_code
                        AND s.line_definition_owner_code = w.line_definition_owner_code
                        AND s.name                       = w.name
                        AND s.language                   = w.language);
Line: 3656

    trace(p_msg    => '# xla_line_definitions_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3662

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_definitions_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3670

  UPDATE xla_line_definitions_tl w
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||line_definition_code||') '||name,1,80)
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND EXISTS (SELECT 1
                   FROM xla_line_definitions_tl s
                  WHERE s.application_id             = g_application_id
                    AND s.amb_context_code           = g_amb_context_code
                    AND s.event_class_code           = w.event_class_code
                    AND s.event_type_code            = w.event_type_code
                    AND s.line_definition_owner_code = w.line_definition_owner_code
                    AND s.name                       = w.name
                    AND s.language                   = w.language);
Line: 3686

    trace(p_msg    => '# xla_line_definitions_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3692

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_definitions_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3700

  UPDATE xla_line_defn_jlt_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3706

    trace(p_msg    => '# xla_line_defn_jlt_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3712

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_jlt_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3720

  UPDATE xla_line_defn_adr_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3726

    trace(p_msg    => '# xla_line_defn_adr_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3732

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_adr_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3740

  UPDATE xla_line_defn_ac_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3746

    trace(p_msg    => '# xla_line_defn_ac_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3752

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_line_defn_ac_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3760

  UPDATE xla_mpa_jlt_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3766

    trace(p_msg    => '# xla_mpa_jlt_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3772

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3780

  UPDATE xla_mpa_header_ac_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3786

    trace(p_msg    => '# xla_mpa_header_ac_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3792

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_header_ac_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3800

  UPDATE xla_mpa_jlt_adr_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3806

    trace(p_msg    => '# xla_mpa_jlt_adr_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3812

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_adr_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3822

  UPDATE xla_mpa_jlt_ac_assgns
     SET mpa_inherit_ac_flag = 'N'
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_amb_context_code;
Line: 3827

  UPDATE xla_mpa_jlt_ac_assgns
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 3833

    trace(p_msg    => '# xla_mpa_jlt_ac_assgns updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 3839

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mpa_jlt_ac_assgns updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_defns');
Line: 3892

    INSERT INTO xla_aads_gt
      ( entity_code,
        event_class_code,
        accounting_line_code,
        accounting_class_code,
        table_name
      )
    select  entity_code,
            event_class_code,
            accounting_line_code,
            accounting_class_code,
	        'XLA_ACCT_LINE_TYPES_B'
    from
        (select entity_code,
                event_class_code,
                accounting_line_code,
                accounting_class_code,
	           'XLA_ACCT_LINE_TYPES_B',
                amb_context_code,
                last_update_date ,
                nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
         from
            (select entity_code,
                    event_class_code,
                    accounting_line_code,
                    accounting_class_code,
	                'XLA_ACCT_LINE_TYPES_B',
                    amb_context_code,
                    last_update_date,
                    lag(last_update_date) over (PARTITION by application_id,
                                                             event_class_code,
                                                             accounting_line_code,
                                                             accounting_line_type_code
                                                order by     amb_context_code
                                                ) lag_date
             from xla_acct_line_types_b
             order by amb_context_code
            ) x
         where x.amb_context_code = g_staging_context_code
        )
    where flag = 'False';
Line: 3936

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_acct_line_types_b is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 3943

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_acct_line_types_b is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 3951

   INSERT INTO xla_aads_gt
        ( event_class_code
	 ,accounting_line_code
	 ,accounting_attribute_code
	 ,source_code
	 ,table_name
         )
   select jlt_acct_attrs.event_class_code
         ,jlt_acct_attrs.accounting_line_code
         ,jlt_acct_attrs.accounting_attribute_code
         ,jlt_acct_attrs.source_code
	 ,'xla_jlt_acct_attrs'
   from  xla_jlt_acct_attrs     jlt_acct_attrs
   where jlt_acct_attrs.application_id   = g_application_id
   and   jlt_acct_attrs.amb_context_code = g_staging_context_code
   and  (EXISTS(SELECT 1
                FROM   xla_jlt_acct_attrs     jlt_acct_attrs1
                WHERE  jlt_acct_attrs.event_class_code          = jlt_acct_attrs1.event_class_code
                 and   jlt_acct_attrs.accounting_line_code      = jlt_acct_attrs1.accounting_line_code
                 and   jlt_acct_attrs.accounting_line_type_code = jlt_acct_attrs1.accounting_line_type_code
		         and   nvl(jlt_acct_attrs.accounting_attribute_code,' ') = nvl(jlt_acct_attrs1.accounting_attribute_code,' ')
                 and   nvl(jlt_acct_attrs.source_code,' ')      = nvl(jlt_acct_attrs1.source_code,' ')
                 and   jlt_acct_attrs.application_id            = jlt_acct_attrs1.application_id
                 and   jlt_acct_attrs1.amb_context_code         = g_amb_context_code
                 and   to_char(jlt_acct_attrs.last_update_date,'DD-MON-YYYY') <> to_char(jlt_acct_attrs1.last_update_date,'DD-MON-YYYY')
                )
	 OR
	 NOT EXISTS(SELECT 1
                FROM   xla_jlt_acct_attrs     jlt_acct_attrs1
                WHERE  jlt_acct_attrs.event_class_code          = jlt_acct_attrs1.event_class_code
                 and   jlt_acct_attrs.accounting_line_code      = jlt_acct_attrs1.accounting_line_code
                 and   jlt_acct_attrs.accounting_line_type_code = jlt_acct_attrs1.accounting_line_type_code
		         and   nvl(jlt_acct_attrs.accounting_attribute_code,' ') = nvl(jlt_acct_attrs1.accounting_attribute_code,' ')
                 and   nvl(jlt_acct_attrs.source_code,' ')      = nvl(jlt_acct_attrs1.source_code,' ')
                 and   jlt_acct_attrs.application_id            = jlt_acct_attrs1.application_id
                 and   jlt_acct_attrs1.amb_context_code         = g_amb_context_code
                )
	 );
Line: 3991

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_jlt_acct_attrs is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 3997

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_jlt_acct_attrs is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4005

   INSERT INTO xla_aads_gt
        ( entity_code
	 ,event_class_code
	 ,accounting_line_code
	 ,source_code
	 ,table_name
         )
   select condn.entity_code
         ,condn.event_class_code
         ,condn.accounting_line_code
         ,condn.source_code
	 ,'xla_conditions'
   from  xla_conditions         condn
   where condn.application_id           = g_application_id
   and   condn.amb_context_code         = g_staging_context_code
   and EXISTS (SELECT 1
               FROM xla_acct_line_types_b s
               WHERE s.application_id          = g_application_id
               and s.amb_context_code          = g_staging_context_code
               and s.event_class_code          = condn.event_class_code
               and s.accounting_line_type_code = condn.accounting_line_type_code
               and s.accounting_line_code      = condn.accounting_line_code)
   and  (EXISTS(SELECT 1
                FROM   xla_conditions condn1
                WHERE  condn.entity_code               = condn1.entity_code
                 and   condn.event_class_code          = condn1.event_class_code
                 and   condn.accounting_line_code      = condn1.accounting_line_code
                 and   condn.accounting_line_type_code = condn1.accounting_line_type_code
                 and   nvl(condn.source_code,' ')      = nvl(condn1.source_code,' ')
                 and   nvl(condn.source_type_code,' ') = nvl(condn1.source_type_code,' ')
                 and   condn.user_sequence             = condn1.user_sequence
                 and   condn.application_id            = condn1.application_id
                 and   condn1.amb_context_code         = g_amb_context_code
                 and   to_char(condn.last_update_date,'DD-MON-YYYY') <> to_char(condn1.last_update_date,'DD-MON-YYYY')
                )
	 OR
	 NOT EXISTS(SELECT 1
                FROM   xla_conditions condn1
                WHERE  nvl(condn.entity_code,' ')               = nvl(condn1.entity_code,' ')
                 and   nvl(condn.event_class_code,' ')          = nvl(condn1.event_class_code,' ')
                 and   nvl(condn.accounting_line_code,' ')      = nvl(condn1.accounting_line_code,' ')
                 and   nvl(condn.accounting_line_type_code,' ') = nvl(condn1.accounting_line_type_code,' ')
                 and   nvl(condn.source_code,' ')      = nvl(condn1.source_code,' ')
                 and   nvl(condn.source_type_code,' ') = nvl(condn1.source_type_code,' ')
                 and   condn.user_sequence             = condn1.user_sequence
                 and   condn.application_id            = condn1.application_id
                 and   condn1.amb_context_code         = g_amb_context_code
                )
	 );
Line: 4056

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_conditions is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 4062

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_conditions is :'||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4077

    DELETE FROM xla_acct_line_types_b w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_acct_line_types_b s
                    WHERE s.application_id            = g_application_id
                      AND s.amb_context_code          = g_staging_context_code
                      AND s.event_class_code          = w.event_class_code
                      AND s.accounting_line_type_code = w.accounting_line_type_code
                      AND s.accounting_line_code      = w.accounting_line_code);
Line: 4089

      trace(p_msg    => '# xla_acct_line_types_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4095

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_b delete : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4103

    DELETE FROM xla_acct_line_types_tl w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_acct_line_types_tl s
                    WHERE s.application_id            = g_application_id
                      AND s.amb_context_code          = g_staging_context_code
                      AND s.event_class_code          = w.event_class_code
                      AND s.accounting_line_type_code = w.accounting_line_type_code
                      AND s.accounting_line_code      = w.accounting_line_code
                      AND s.language                  = w.language);
Line: 4116

      trace(p_msg    => '# xla_acct_line_types_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4122

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4130

    DELETE FROM xla_jlt_acct_attrs w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_jlt_acct_attrs s
                    WHERE s.application_id            = g_application_id
                      AND s.amb_context_code          = g_staging_context_code
                      AND s.event_class_code          = w.event_class_code
                      AND s.accounting_line_type_code = w.accounting_line_type_code
                      AND s.accounting_line_code      = w.accounting_line_code);
Line: 4142

      trace(p_msg    => '# xla_jlt_acct_attrs delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4148

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_jlt_acct_attrs delete : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4156

    DELETE FROM xla_conditions w
     WHERE application_id            = g_application_id
       AND amb_context_code          = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_acct_line_types_b s
                    WHERE s.application_id            = g_application_id
                      AND s.amb_context_code          = g_staging_context_code
                      AND s.event_class_code          = w.event_class_code
                      AND s.accounting_line_type_code = w.accounting_line_type_code
                      AND s.accounting_line_code      = w.accounting_line_code);
Line: 4168

      trace(p_msg    => '# xla_jlt_acct_attrs delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4174

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_jlt_acct_attrs delete : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4184

  UPDATE xla_acct_line_types_b
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 4190

    trace(p_msg    => '# xla_acct_line_types_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4196

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_b updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4204

  UPDATE xla_acct_line_types_tl w
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND NOT EXISTS (SELECT 1
                       FROM xla_acct_line_types_tl s
                      WHERE s.application_id            = g_application_id
                        AND s.amb_context_code          = g_amb_context_code
                        AND s.event_class_code          = w.event_class_code
                        AND s.accounting_line_type_code = w.accounting_line_type_code
                        AND s.name                      = w.name
                        AND s.language                  = w.language);
Line: 4219

    trace(p_msg    => '# xla_acct_line_types_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4225

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4233

  UPDATE xla_acct_line_types_tl w
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||w.accounting_line_code||') '||name,1,80)
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND EXISTS (SELECT 1
                   FROM xla_acct_line_types_tl s
                  WHERE s.application_id            = g_application_id
                    AND s.amb_context_code          = g_amb_context_code
                    AND s.event_class_code          = w.event_class_code
                    AND s.accounting_line_type_code = w.accounting_line_type_code
                    AND s.name                      = w.name
                    AND s.language                  = w.language);
Line: 4248

    trace(p_msg    => '# xla_acct_line_types_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4254

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acct_line_types_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4262

  UPDATE xla_jlt_acct_attrs
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 4268

    trace(p_msg    => '# xla_jlt_acct_attrs updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4274

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_jlt_acct_attrs updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4282

  UPDATE xla_conditions
     SET amb_context_code     = g_amb_context_code
   WHERE amb_context_code     = g_staging_context_code
     AND application_id       = g_application_id
     AND accounting_line_code IS NOT NULL;
Line: 4289

    trace(p_msg    => '# xla_conditions updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4295

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_conditions updated : '||l_num_rows,
             p_component_code   =>  'merge_journal_line_types');
Line: 4348

    INSERT INTO xla_aads_gt
        (description_code,
	     table_name
        )
    select description_code,
           'XLA_DESCRIPTIONS_B'
    from
       (select description_code,
              'XLA_DESCRIPTIONS_B',
               amb_context_code,
               last_update_date ,
               nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
        from
          (select description_code,
                  'XLA_DESCRIPTIONS_B',
                  amb_context_code,
                  last_update_date ,
                  lag(last_update_date) over (PARTITION by application_id,
                                                           description_code,
                                                           description_type_code
                                              order by     amb_context_code
                                              ) lag_date
           from xla_descriptions_b
           order by amb_context_code
           ) x
        where x.amb_context_code = g_staging_context_code
        )
    where flag = 'False';
Line: 4379

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_descriptions_b is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 4385

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_descriptions_b is :'||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4393

    INSERT INTO xla_aads_gt
      ( description_code,
	    table_name
      )
    select description_code,
          'XLA_DESC_PRIORITIES'
    from
       (select description_code,
              'XLA_DESC_PRIORITIES',
               amb_context_code,
               last_update_date ,
               nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
        from
           (select description_code,
                   'XLA_DESC_PRIORITIES',
                   amb_context_code,
                   last_update_date ,
                   lag(last_update_date) over (PARTITION by application_id,
                                                            description_code,
                                                            description_type_code
                                               order by     amb_context_code
                                               ) lag_date
            from xla_desc_priorities
            order by amb_context_code
            ) x
        where x.amb_context_code = g_staging_context_code
        )
    where flag = 'False';
Line: 4423

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_desc_priorities is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 4429

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_desc_priorities is :'||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4437

    INSERT INTO xla_aads_gt
   (  source_code,
      table_name
    )
   SELECT desc_details.source_code,
          'xla_descript_details_b'
   FROM   xla_descript_details_b desc_details
   WHERE  desc_details.amb_context_code = g_staging_context_code
   AND    desc_details.description_prio_id IN
           (SELECT w.description_prio_id
            FROM   xla_desc_priorities w
                  ,xla_desc_priorities s
            WHERE s.application_id      = g_application_id
            AND s.amb_context_code      = g_staging_context_code
            AND w.application_id        = g_application_id
            AND w.amb_context_code      = g_amb_context_code
            AND w.description_type_code = s.description_type_code
            AND w.description_code      = s.description_code)
   AND (EXISTS (SELECT 1
               FROM   xla_descript_details_b desc_details1
               WHERE  desc_details1.amb_context_code   = g_amb_context_code
               AND    desc_details.description_prio_id = desc_details1.description_prio_id
               AND    to_char(desc_details.last_update_date,'DD-MON-YYYY') <> to_char(desc_details1.last_update_date,'DD-MON-YYYY')
               )
	OR
	NOT EXISTS (SELECT 1
                  FROM   xla_descript_details_b desc_details1
                  WHERE  desc_details1.amb_context_code   = g_amb_context_code
                  AND    desc_details.description_prio_id = desc_details1.description_prio_id
                  )
	);
Line: 4470

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_descript_details_b is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 4476

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_descript_details_b is :'||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4491

    DELETE FROM xla_descriptions_b w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_descriptions_b s
                    WHERE s.application_id        = g_application_id
                      AND s.amb_context_code      = g_staging_context_code
                      AND s.description_type_code = w.description_type_code
                      AND s.description_code      = w.description_code);
Line: 4503

      trace(p_msg    => '# xla_descriptions_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4509

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descriptions_b delete : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4517

    DELETE FROM xla_descriptions_tl w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_descriptions_tl s
                    WHERE s.application_id        = g_application_id
                      AND s.amb_context_code      = g_staging_context_code
                      AND s.description_type_code = w.description_type_code
                      AND s.description_code      = w.description_code
                      AND s.language              = w.language);
Line: 4530

      trace(p_msg    => '# xla_descriptions_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4536

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descriptions_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4544

    DELETE FROM xla_desc_priorities w
     WHERE application_id         = g_application_id
       AND amb_context_code       = g_amb_context_code
       AND EXISTS (SELECT 1
                     FROM xla_desc_priorities s
                    WHERE s.application_id        = g_application_id
                      AND s.amb_context_code      = g_staging_context_code
                      AND s.description_type_code = w.description_type_code
                      AND s.description_code      = w.description_code);
Line: 4555

      trace(p_msg    => '# xla_desc_priorities delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4561

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_desc_priorities delete : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4569

    DELETE FROM xla_conditions
     WHERE description_prio_id IN
           (SELECT w.description_prio_id
              FROM xla_desc_priorities w
                 , xla_desc_priorities s
             WHERE s.application_id        = g_application_id
               AND s.amb_context_code      = g_staging_context_code
               AND w.application_id        = g_application_id
               AND w.amb_context_code      = g_amb_context_code
               AND w.description_type_code = s.description_type_code
               AND w.description_code      = s.description_code);
Line: 4583

      trace(p_msg    => '# xla_conditions delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4589

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_conditions delete : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4597

    DELETE FROM xla_descript_details_b
     WHERE description_prio_id IN
           (SELECT w.description_prio_id
              FROM xla_desc_priorities w
                 , xla_desc_priorities s
             WHERE s.application_id        = g_application_id
               AND s.amb_context_code      = g_staging_context_code
               AND w.application_id        = g_application_id
               AND w.amb_context_code      = g_amb_context_code
               AND w.description_type_code = s.description_type_code
               AND w.description_code      = s.description_code);
Line: 4610

      trace(p_msg    => '# xla_descript_details_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4616

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descript_details_b delete : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4624

    DELETE FROM xla_descript_details_tl w
     WHERE description_detail_id IN
           (SELECT description_detail_id
              FROM xla_descript_details_b d
                 , xla_desc_priorities    w
                 , xla_desc_priorities    s
             WHERE d.description_prio_id   = w.description_prio_id
               AND s.application_id        = g_application_id
               AND s.amb_context_code      = g_staging_context_code
               AND s.application_id        = g_application_id
               AND s.amb_context_code      = g_amb_context_code
               AND w.description_type_code = s.description_type_code
               AND w.description_code      = s.description_code);
Line: 4639

      trace(p_msg    => '# xla_descript_details_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 4645

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_descript_details_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4655

  UPDATE xla_descriptions_b
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 4661

    trace(p_msg    => '# xla_descriptions_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4667

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_descriptions_b updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4675

  UPDATE xla_descriptions_tl w
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND NOT EXISTS (SELECT 1
                       FROM xla_descriptions_tl s
                      WHERE s.application_id        = g_application_id
                        AND s.amb_context_code      = g_amb_context_code
                        AND s.description_type_code = w.description_type_code
                        AND s.name                  = w.name
                        AND s.language              = w.language);
Line: 4688

    trace(p_msg    => '# xla_descriptions_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4694

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_descriptions_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4702

  UPDATE xla_descriptions_tl w
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||w.description_code||') '||name,1,80)
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code
     AND EXISTS (SELECT 1
                   FROM xla_descriptions_tl s
                  WHERE s.application_id        = g_application_id
                    AND s.amb_context_code      = g_amb_context_code
                    AND s.description_type_code = w.description_type_code
                    AND s.name                  = w.name
                    AND s.language              = w.language);
Line: 4717

    trace(p_msg    => '# xla_descriptions_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4723

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_descriptions_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4730

  UPDATE xla_desc_priorities
     SET amb_context_code  = g_amb_context_code
   WHERE application_id    = g_application_id
     AND amb_context_code  = g_staging_context_code;
Line: 4736

    trace(p_msg    => '# xla_desc_priorities updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4742

      xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_desc_priorities updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4750

  UPDATE xla_conditions
     SET amb_context_code    = g_amb_context_code
   WHERE amb_context_code    = g_staging_context_code
     AND application_id      = g_application_id
     AND description_prio_id IS NOT NULL;
Line: 4757

    trace(p_msg    => '# xla_conditions updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4763

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_conditions updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4771

  UPDATE xla_descript_details_b
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code;
Line: 4776

    trace(p_msg    => '# xla_descript_details_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4782

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_descript_details_b updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4790

  UPDATE xla_descript_details_tl
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code;
Line: 4795

    trace(p_msg    => '# xla_descript_details_tl updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 4801

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_descript_details_tl updated : '||l_num_rows,
             p_component_code   =>  'merge_descriptions');
Line: 4839

    SELECT s.analytical_criterion_type_code, s.analytical_criterion_code
      FROM xla_analytical_hdrs_b s
         , xla_analytical_hdrs_b w
     WHERE s.amb_context_code               = g_staging_context_code
       AND w.amb_context_code(+)            = g_amb_context_code
       AND s.analytical_criterion_type_code = w.analytical_criterion_type_code(+)
       AND s.analytical_criterion_code      = w.analytical_criterion_code(+)
       AND s.version_num                    >= w.version_num(+);
Line: 4851

    SELECT s.analytical_criterion_type_code, s.analytical_criterion_code,s.ANALYTICAL_DETAIL_CODE
      FROM xla_analytical_dtls_b s
         , xla_analytical_dtls_b w
     WHERE s.amb_context_code               = g_staging_context_code
       AND w.amb_context_code(+)            = g_amb_context_code
       AND s.analytical_criterion_type_code = w.analytical_criterion_type_code(+)
       AND s.analytical_criterion_code      = w.analytical_criterion_code(+)
       AND s.ANALYTICAL_DETAIL_CODE         = w.ANALYTICAL_DETAIL_CODE(+) ;
Line: 4861

    SELECT s.analytical_criterion_type_code, s.analytical_criterion_code,s.ANALYTICAL_DETAIL_CODE,
    s.event_class_code,s.entity_code,s.source_code,s.source_type_code
      FROM xla_analytical_sources s
         , xla_analytical_sources w
     WHERE s.amb_context_code               = g_staging_context_code
       AND w.amb_context_code(+)            = g_amb_context_code
       AND s.analytical_criterion_type_code = w.analytical_criterion_type_code(+)
       AND s.analytical_criterion_code      = w.analytical_criterion_code(+)
       AND s.ANALYTICAL_DETAIL_CODE         = w.ANALYTICAL_DETAIL_CODE(+)
       AND s.event_class_code               = w.event_class_code(+)
       AND s.entity_code                    = w.entity_code(+)
       AND s.source_code                    = w.source_code(+)
       AND s.source_type_code               = w.source_type_code(+);
Line: 4910

    INSERT INTO xla_aads_gt
      ( analytical_criterion_code,
        table_name
      )
    select analytical_criterion_code,
          'XLA_ANALYTICAL_HDRS_B'
    from
     (select analytical_criterion_code,
            'XLA_ANALYTICAL_HDRS_B',
             amb_context_code,
             last_update_date ,
             nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
      from
         (select analytical_criterion_code,
                 'XLA_ANALYTICAL_HDRS_B',
                 amb_context_code,
                 last_update_date ,
                 lag(last_update_date) over (PARTITION by application_id,
                                                          analytical_criterion_code,
                                                          analytical_criterion_type_code
                                             order by     amb_context_code
                                            ) lag_date
          from xla_analytical_hdrs_b
          order by amb_context_code
          ) x
      where x.amb_context_code = g_staging_context_code
      )
    where flag = 'False';
Line: 4941

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_analytical_hdrs_b is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 4948

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  'Number of Rows inserted into aads_gt from xla_analytical_hdrs_b is :'||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 4956

    INSERT INTO xla_aads_gt
      ( analytical_criterion_code,
        analytical_detail_code,
        table_name
      )
    select analytical_criterion_code,
           analytical_detail_code,
           'XLA_ANALYTICAL_DTLS_B'
    from
        (select analytical_criterion_code,
                analytical_detail_code,
	            'XLA_ANALYTICAL_DTLS_B',
                amb_context_code,
                last_update_date ,
                nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
        from
              (select analytical_criterion_code,
                      analytical_detail_code,
	                  'XLA_ANALYTICAL_DTLS_B',
                      amb_context_code,
                      last_update_date ,
                      lag(last_update_date) over (PARTITION by analytical_criterion_code,
                                                               analytical_criterion_type_code,
                                                               analytical_detail_code
                                                  order by     amb_context_code
                                                  ) lag_date
               from xla_analytical_dtls_b
               order by amb_context_code
               ) x
        where x.amb_context_code = g_staging_context_code
        )
    where flag = 'False';
Line: 4991

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_analytical_dtls_b is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 4997

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  'Number of Rows inserted into aads_gt from xla_analytical_dtls_b is :'||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5005

    INSERT INTO xla_aads_gt
       ( analytical_criterion_code,
         analytical_detail_code,
         entity_code,
         event_class_code,
         source_code,
         table_name
        )
    select   analytical_criterion_code,
             analytical_detail_code,
             entity_code,
             event_class_code,
             source_code,
             'XLA_ANALYTICAL_SOURCES'
    from
         (select analytical_criterion_code,
                 analytical_detail_code,
                 entity_code,
                 event_class_code,
                 source_code,
                 'XLA_ANALYTICAL_SOURCES',
                 amb_context_code,
                 last_update_date ,
                 nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
          from
              (select analytical_criterion_code,
                      analytical_detail_code,
                      entity_code,
                      event_class_code,
                      source_code,
	                  'XLA_ANALYTICAL_SOURCES',
                      amb_context_code,
                      last_update_date ,
                      lag(last_update_date) over (PARTITION by application_id,
                                                               analytical_criterion_code,
                                                               analytical_criterion_type_code,
                                                               analytical_detail_code,
                                                               entity_code,
                                                               event_class_code,
                                                               source_code,
							       source_type_code
                                                  order by     amb_context_code
                                                  ) lag_date
               from xla_analytical_sources
               order by amb_context_code
               ) x
          where x.amb_context_code = g_staging_context_code
          )
    where flag = 'False';
Line: 5059

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_analytical_sources is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 5066

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  'Number of Rows inserted into aads_gt from xla_analytical_sources is :'||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5081

  Need to keep sources separate, as the delete should remove only those sources that r in the ldt NOT sources that
  belong to a header/dtl loaded.
  */

    OPEN c_ac;
Line: 5102

      DELETE FROM xla_analytical_hdrs_b w
       WHERE amb_context_code                = g_amb_context_code
         AND analytical_criterion_type_code = l_ac_type_codes(i)
         AND analytical_criterion_code      = l_ac_codes(i)
	 AND EXISTS
	 ( SELECT 1
	   FROM xla_analytical_hdrs_b s
           WHERE s.amb_context_code                = g_staging_context_code
           AND   s.analytical_criterion_type_code  = w.analytical_criterion_type_code
           AND   s.analytical_criterion_code       = w.analytical_criterion_code );
Line: 5114

      trace(p_msg    => '# xla_analytical_hdrs_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5120

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_analytical_hdrs_b delete : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5129

       DELETE FROM xla_analytical_hdrs_tl w
       WHERE amb_context_code                = g_amb_context_code
         AND analytical_criterion_type_code = l_ac_type_codes(i)
         AND analytical_criterion_code      = l_ac_codes(i)
	 AND EXISTS
	 ( SELECT 1
	   FROM xla_analytical_hdrs_tl s
           WHERE s.amb_context_code                = g_staging_context_code
           AND   s.analytical_criterion_type_code  = w.analytical_criterion_type_code
           AND   s.analytical_criterion_code       = w.analytical_criterion_code
	   AND   s.language              = w.language);
Line: 5142

      trace(p_msg    => '# xla_analytical_hdrs_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5148

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_analytical_hdrs_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5158

    DELETE FROM xla_analytical_dtls_b w
     WHERE amb_context_code                 = g_amb_context_code
         AND analytical_criterion_type_code = l_ac_dtl_type_codes(i)
         AND analytical_criterion_code      = l_ac_dtl_codes(i)
	 AND analytical_detail_code         = l_ac_detail_code(i)
	 AND EXISTS
	 ( SELECT 1
	   FROM xla_analytical_dtls_b s
           WHERE s.amb_context_code                = g_staging_context_code
           AND   s.analytical_criterion_type_code  = w.analytical_criterion_type_code
           AND   s.analytical_criterion_code       = w.analytical_criterion_code
	   AND   s.analytical_detail_code          = w.analytical_detail_code);
Line: 5172

      trace(p_msg    => '# xla_analytical_dtls_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5179

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'UPLOAD',
             p_encoded_message  => '# row populated in XLA_STAGING_COMPONENTS_H = '||l_num_rows,
             p_component_code   =>  'populate_history');
Line: 5188

    DELETE FROM xla_analytical_dtls_tl w
     WHERE amb_context_code                = g_amb_context_code
         AND analytical_criterion_type_code = l_ac_dtl_type_codes(i)
         AND analytical_criterion_code      = l_ac_dtl_codes(i)
         AND analytical_detail_code         = l_ac_detail_code(i)
	 AND EXISTS
	 ( SELECT 1
	   FROM xla_analytical_dtls_tl s
           WHERE s.amb_context_code                = g_staging_context_code
           AND   s.analytical_criterion_type_code  = w.analytical_criterion_type_code
           AND   s.analytical_criterion_code       = w.analytical_criterion_code
	   AND   s.analytical_detail_code          = w.analytical_detail_code
	   AND   s.language              = w.language);
Line: 5203

      trace(p_msg    => '# xla_analytical_dtls_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5209

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  =>  '# xla_analytical_dtls_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5218

    DELETE FROM xla_analytical_sources w
     WHERE amb_context_code                = g_amb_context_code
         AND analytical_criterion_type_code = l_ac_src_type_codes(i)  --Bug 10060589
         AND analytical_criterion_code      = l_ac_src_codes(i)  --Bug 10060589
	 AND analytical_detail_code         = l_ac_src_detail_code(i) --Bug 10060589 -- Added for bug 8268819
	 AND event_class_code =l_ac_src_event_class(i)
         AND ENTITY_CODE =l_ac_src_entity_code(i)
	 AND SOURCE_CODE =l_ac_src_source_code(i)
	 AND SOURCE_TYPE_CODE =l_ac_src_source_type_code(i)
	 AND EXISTS
	 ( SELECT 1
	   FROM xla_analytical_sources s
           WHERE s.amb_context_code                = g_staging_context_code
           AND   s.analytical_criterion_type_code  = w.analytical_criterion_type_code
           AND   s.analytical_criterion_code       = w.analytical_criterion_code
	   AND   s.analytical_detail_code          = w.analytical_detail_code  -- Added for bug 8268819
	   AND   s.entity_code                     = w.entity_code
	   AND   s.event_class_code                = w.event_class_code
	   AND   s.source_code                     = w.source_code
	   AND   s.source_type_code                = w.source_type_code);
Line: 5240

      trace(p_msg    => '# xla_analytical_sources delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5246

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_sources delete : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5257

  UPDATE xla_analytical_hdrs_b
     SET amb_context_code               = g_amb_context_code
   WHERE amb_context_code               = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_type_codes(i)
     AND analytical_criterion_code      = l_ac_codes(i);
Line: 5265

    trace(p_msg    => '# xla_analytical_hdrs_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5271

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_hdrs_b updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5280

  UPDATE xla_analytical_hdrs_tl s
     SET amb_context_code               = g_amb_context_code
   WHERE amb_context_code               = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_type_codes(i)
     AND analytical_criterion_code      = l_ac_codes(i)
     AND NOT EXISTS (SELECT 1
                       FROM xla_analytical_hdrs_tl w
                      WHERE w.amb_context_code               = g_amb_context_code
                        AND w.analytical_criterion_type_code = s.analytical_criterion_type_code
                        AND w.name                           = s.name
                        AND w.language                       = s.language);
Line: 5293

    trace(p_msg    => '# xla_analytical_hdrs_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5299

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_hdrs_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5308

  UPDATE xla_analytical_hdrs_tl s
     SET amb_context_code               = g_amb_context_code
       , name                           = substr('('||s.analytical_criterion_code||') '||name,1,80)
   WHERE amb_context_code               = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_type_codes(i)
     AND analytical_criterion_code      = l_ac_codes(i)
     AND EXISTS (SELECT 1
                   FROM xla_analytical_hdrs_tl w
                  WHERE w.amb_context_code               = g_amb_context_code
                    AND w.analytical_criterion_type_code = s.analytical_criterion_type_code
                    AND w.name                           = s.name
                    AND w.language                       = s.language);
Line: 5322

    trace(p_msg    => '# xla_analytical_hdrs_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5328

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_hdrs_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5337

  UPDATE xla_analytical_dtls_b
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_dtl_type_codes(i)
     AND analytical_criterion_code      = l_ac_dtl_codes(i)
     AND analytical_detail_code         = l_ac_detail_code(i);
Line: 5345

    trace(p_msg    => '# xla_analytical_dtls_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5351

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_dtls_b updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5360

  UPDATE xla_analytical_dtls_tl s
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_dtl_type_codes(i)
     AND analytical_criterion_code      = l_ac_dtl_codes(i)
     AND analytical_detail_code         = l_ac_detail_code(i)
     AND NOT EXISTS (SELECT 1
                       FROM xla_analytical_dtls_tl w
                      WHERE w.amb_context_code               = g_amb_context_code
                        AND   w.analytical_criterion_type_code  = s.analytical_criterion_type_code
			AND   s.analytical_criterion_code       = s.analytical_criterion_code
			AND   s.analytical_detail_code          = s.analytical_detail_code
                        AND w.name                           = s.name
                        AND w.language                       = s.language);
Line: 5376

    trace(p_msg    => '# xla_analytical_dtls_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5383

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_dtls_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5392

  UPDATE xla_analytical_dtls_tl w
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||w.analytical_detail_code||') '||name,1,80)
   WHERE amb_context_code  = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_dtl_type_codes(i)
     AND analytical_criterion_code      = l_ac_dtl_codes(i)
     AND analytical_detail_code         = l_ac_detail_code(i)
     AND EXISTS (SELECT 1
                   FROM xla_analytical_dtls_tl s
                  WHERE s.amb_context_code               = g_amb_context_code
                    AND   w.analytical_criterion_type_code  = s.analytical_criterion_type_code
		    AND   s.analytical_criterion_code       = s.analytical_criterion_code
		    AND   s.analytical_detail_code          = s.analytical_detail_code
                    AND s.name                           = w.name
                    AND s.language                       = w.language);
Line: 5409

    trace(p_msg    => '# xla_analytical_dtls_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5415

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_dtls_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5424

  UPDATE xla_analytical_sources
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND analytical_criterion_type_code = l_ac_src_type_codes(i)--Bug 10060589
     AND analytical_criterion_code      = l_ac_src_codes(i) --Bug 10060589
     AND analytical_detail_code         = l_ac_src_detail_code(i) --Bug 10060589 -- Added for bug 8268819
     AND event_class_code =l_ac_src_event_class(i)
     AND ENTITY_CODE =l_ac_src_entity_code(i)
     AND SOURCE_CODE =l_ac_src_source_code(i)
     AND SOURCE_TYPE_CODE =l_ac_src_source_type_code(i);
Line: 5437

    trace(p_msg    => '# xla_analytical_sources updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5443

     xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_sources updated : '||l_num_rows,
             p_component_code   =>  'merge_analytical_criteria');
Line: 5497

    SELECT s.segment_rule_type_code, s.segment_rule_code
      FROM xla_seg_rules_b w
         , xla_seg_rules_b s
     WHERE s.application_id         = g_application_id
       AND s.amb_context_code       = g_staging_context_code
       AND s.segment_rule_type_code = w.segment_rule_type_code
       AND s.segment_rule_code      = w.segment_rule_code
       AND w.application_id         = g_application_id
       AND w.amb_context_code       = g_amb_context_code;
Line: 5526

    INSERT INTO xla_aads_gt
      ( segment_rule_code,
        table_name
      )
    select segment_rule_code,
       'XLA_SEG_RULE_DETAILS'
    from
      (select segment_rule_code,
              'XLA_SEG_RULE_DETAILS',
              amb_context_code,
              last_update_date ,
              nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
       from
          (select segment_rule_code,
                  'XLA_SEG_RULE_DETAILS',
                  amb_context_code,
                  last_update_date ,
                  lag(last_update_date) over (PARTITION by application_id,
                                                           segment_rule_code,
                                                           segment_rule_type_code,
                                                           user_sequence
                                              order by     amb_context_code
                                              ) lag_date
           from xla_seg_rule_details
           order by amb_context_code
           ) x
       where x.amb_context_code = g_staging_context_code
       )
    where flag = 'False';
Line: 5559

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_seg_rule_details is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 5566

       xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_seg_rule_details is :'||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5574

    INSERT INTO xla_aads_gt
      ( segment_rule_code,
        table_name
      )
    select  segment_rule_code,
            'XLA_SEG_RULES_B'
    from
      (select  segment_rule_code,
              'XLA_SEG_RULES_B',
               amb_context_code,
               last_update_date ,
               nvl2(lag_date, decode(last_update_date,lag_date, 'True','False'),'False') flag
       from
           (select segment_rule_code,
                   'XLA_SEG_RULES_B',
                   amb_context_code,
                   last_update_date ,
                   lag(last_update_date) over (PARTITION by application_id,
                                                            segment_rule_code,
                                                            segment_rule_type_code
                                               order by     amb_context_code
                                               ) lag_date
            from xla_seg_rules_b
            order by amb_context_code
            ) x
       where x.amb_context_code = g_staging_context_code
       )
    where flag = 'False';
Line: 5604

              trace(p_msg    => 'Number of Rows inserted into aads_gt from xla_seg_rules_b is :'||l_num_rows,
                    p_module => l_log_module,
                    p_level  => C_LEVEL_PROCEDURE);
Line: 5610

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => 'Number of Rows inserted into aads_gt from xla_seg_rules_b is :'||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5630

      DELETE FROM xla_conditions c
       WHERE amb_context_code        = g_amb_context_code
         AND application_id          = g_application_id
         AND EXISTS (SELECT 1
                       FROM xla_seg_rule_details w
                      WHERE c.segment_rule_detail_id = w.segment_rule_detail_id
                        AND w.application_id         = g_application_id
                        AND w.amb_context_code       = g_amb_context_code
                        AND w.segment_rule_type_code = l_adr_type_codes(i)
                        AND w.segment_rule_code      = l_adr_codes(i));
Line: 5642

      trace(p_msg    => '# xla_conditions delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5648

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_conditions delete : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5657

      DELETE FROM xla_seg_rule_details w
       WHERE amb_context_code        = g_amb_context_code
         AND application_id          = g_application_id
         AND segment_rule_type_code  = l_adr_type_codes(i)
         AND segment_rule_code       = l_adr_codes(i);
Line: 5664

      trace(p_msg    => '# xla_seg_rule_details delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5670

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rule_details delete : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5679

      DELETE FROM xla_seg_rules_tl w
       WHERE amb_context_code        = g_amb_context_code
         AND application_id          = g_application_id
         AND segment_rule_type_code  = l_adr_type_codes(i)
         AND segment_rule_code       = l_adr_codes(i);
Line: 5686

      trace(p_msg    => '# xla_seg_rules_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5692

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5701

      DELETE FROM xla_seg_rules_b w
       WHERE amb_context_code        = g_amb_context_code
         AND application_id          = g_application_id
         AND segment_rule_type_code  = l_adr_type_codes(i)
         AND segment_rule_code       = l_adr_codes(i);
Line: 5708

      trace(p_msg    => '# xla_seg_rules_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5714

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_b delete : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5726

  UPDATE xla_seg_rules_b
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND application_id    = g_application_id;
Line: 5732

    trace(p_msg    => '# xla_seg_rules_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5738

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_b updated : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5746

  UPDATE xla_seg_rules_tl w
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND application_id    = g_application_id
     AND NOT EXISTS (SELECT 1
                       FROM xla_seg_rules_tl s
                      WHERE s.amb_context_code       = g_amb_context_code
                        AND s.segment_rule_type_code = w.segment_rule_type_code
                        AND s.name                   = w.name
                        AND s.language               = w.language);
Line: 5758

    trace(p_msg    => '# xla_seg_rules_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5764

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5772

  UPDATE xla_seg_rules_tl w
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||w.segment_rule_code||') '||name,1,80)
   WHERE amb_context_code  = g_staging_context_code
     AND application_id    = g_application_id
     AND EXISTS (SELECT 1
                   FROM xla_seg_rules_tl s
                  WHERE s.amb_context_code       = g_amb_context_code
                    AND s.segment_rule_type_code = w.segment_rule_type_code
                    AND s.name                   = w.name
                    AND s.language               = w.language);
Line: 5785

    trace(p_msg    => '# xla_seg_rules_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5791

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5799

  UPDATE xla_seg_rule_details
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND application_id    = g_application_id;
Line: 5805

    trace(p_msg    => '# xla_seg_rule_details updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5811

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rule_details updated : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5819

  UPDATE xla_conditions
     SET amb_context_code       = g_amb_context_code
   WHERE amb_context_code       = g_staging_context_code
     AND application_id         = g_application_id
     AND segment_rule_detail_id IS NOT NULL;
Line: 5826

    trace(p_msg    => '# xla_conditions updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5832

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_conditions updated : '||l_num_rows,
             p_component_code   =>  'merge_adrs');
Line: 5872

    SELECT s.mapping_set_code
      FROM xla_mapping_sets_b s
         , xla_mapping_sets_b w
     WHERE s.amb_context_code    = g_staging_context_code
       AND w.amb_context_code(+) = g_amb_context_code
       AND s.mapping_set_code    = w.mapping_set_code(+)
       AND s.version_num        >= w.version_num(+);
Line: 5907

    DELETE FROM xla_mapping_sets_b w
     WHERE amb_context_code       = g_amb_context_code
       AND mapping_set_code       = l_ms(i);
Line: 5912

      trace(p_msg    => '# xla_mapping_sets_b delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5918

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_conditions updated : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 5927

    DELETE FROM xla_mapping_sets_tl w
     WHERE amb_context_code       = g_amb_context_code
       AND mapping_set_code       = l_ms(i)
       AND EXISTS (SELECT 1
                     FROM xla_mapping_sets_tl s
                    WHERE s.amb_context_code      = g_staging_context_code
                      AND s.mapping_set_code      = w.mapping_set_code
                      AND s.language              = w.language);
Line: 5937

      trace(p_msg    => '# xla_mapping_sets_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5943

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_sets_tl delete : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 5952

    DELETE FROM xla_mapping_set_values w
     WHERE amb_context_code       = g_amb_context_code
       AND mapping_set_code       = l_ms(i);
Line: 5957

      trace(p_msg    => '# xla_mapping_set_values delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 5963

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_set_values delete : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 5974

  UPDATE xla_mapping_sets_b
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND mapping_set_code  = l_ms(i);
Line: 5980

    trace(p_msg    => '# xla_mapping_sets_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 5986

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_sets_b updated : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 5995

  UPDATE xla_mapping_sets_tl s
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND mapping_set_code  = l_ms(i)
     AND NOT EXISTS (SELECT 1
                       FROM xla_mapping_sets_tl w
                      WHERE w.amb_context_code       = g_amb_context_code
                        AND w.name                   = s.name
                        AND w.language               = s.language);
Line: 6006

    trace(p_msg    => '# xla_mapping_sets_tl 1 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6012

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_sets_tl 1 updated : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 6021

  UPDATE xla_mapping_sets_tl s
     SET amb_context_code  = g_amb_context_code
       , name              = substr('('||s.mapping_set_code||') '||name,1,80)
   WHERE amb_context_code  = g_staging_context_code
     AND mapping_set_code  = l_ms(i)
     AND EXISTS (SELECT 1
                   FROM xla_mapping_sets_tl w
                  WHERE w.amb_context_code       = g_amb_context_code
                    AND w.name                   = s.name
                    AND w.language               = s.language);
Line: 6033

    trace(p_msg    => '# xla_mapping_sets_tl 2 updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6039

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_sets_tl 2 updated : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 6048

  UPDATE xla_mapping_set_values
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND mapping_set_code  = l_ms(i);
Line: 6054

    trace(p_msg    => '# xla_mapping_set_values updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6060

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_set_values updated : '||l_num_rows,
             p_component_code   =>  'merge_mapping_sets');
Line: 6103

    SELECT s.accounting_method_type_code, s.accounting_method_code, s.product_rule_type_code, s.product_rule_code
      FROM xla_acctg_method_rules w
         , xla_acctg_method_rules s
     WHERE s.application_id         = g_application_id
       AND s.amb_context_code       = g_staging_context_code
       AND s.accounting_method_type_code = w.accounting_method_type_code
       AND s.accounting_method_code      = w.accounting_method_code
       AND s.product_rule_code           = w.product_rule_code
       AND s.product_rule_type_code      = w.product_rule_type_code
       AND w.application_id         = g_application_id
       AND w.amb_context_code       = g_amb_context_code;
Line: 6134

a) Deleteing the the SLAM with Default context, if there exists the same SLAM and Product Rule Code in staging area
b) And the Moving the SLAM from Stanging Context Code to Default(Working Area).
*/
  OPEN c_slam;
Line: 6145

      DELETE FROM xla_acctg_method_rules w
       WHERE amb_context_code        	  = g_amb_context_code
         AND application_id               = g_application_id
         AND accounting_method_type_code  = l_acct_method_type_code(i)
         AND accounting_method_code       = l_acct_method_code(i)
         AND product_rule_type_code       = l_product_rule_type_code(i)
         AND product_rule_code            = l_product_rule_code(i);
Line: 6154

      trace(p_msg    => '# xla_acctg_methods_tl delete : '||l_num_rows,
            p_module => l_log_module,
            p_level  => C_LEVEL_STATEMENT);
Line: 6160

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acctg_method_rules delete : '||l_num_rows,
             p_component_code   =>  'merge_acctg_methods');
Line: 6172

  UPDATE xla_acctg_method_rules
     SET amb_context_code  = g_amb_context_code
   WHERE amb_context_code  = g_staging_context_code
     AND application_id    = g_application_id;
Line: 6178

    trace(p_msg    => '# xla_acctg_methods_b updated : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6185

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_acctg_method_rules update : '||l_num_rows,
             p_component_code   =>  'merge_acctg_methods');
Line: 6194

  INSERT INTO xla_acctg_methods_b
     (accounting_method_type_code
     ,accounting_method_code
     ,transaction_coa_id
     ,accounting_coa_id
     ,enabled_flag
     ,creation_date
     ,created_by
     ,last_update_date
     ,last_updated_by
     ,last_update_login)
     SELECT s.accounting_method_type_code
           ,s.accounting_method_code
           ,s.transaction_coa_id
           ,s.accounting_coa_id
           ,s.enabled_flag
           ,sysdate
           ,xla_environment_pkg.g_usr_id
           ,sysdate
           ,xla_environment_pkg.g_usr_id
           ,xla_environment_pkg.g_login_id
       FROM xla_stage_acctg_methods s
            LEFT OUTER JOIN xla_acctg_methods_b w
            ON  w.accounting_method_type_code = s.accounting_method_type_code
            AND w.accounting_method_code      = s.accounting_method_code
      WHERE s.staging_amb_context_code        = g_staging_context_code
        AND w.accounting_method_type_code     IS NULL;
Line: 6223

     trace(p_msg    => '# row inserted in xla_acctg_methods_b = '||l_num_rows,
           p_module => l_log_module,
           p_level  => C_LEVEL_STATEMENT);
Line: 6229

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# row inserted in xla_acctg_methods_b = '||l_num_rows,
             p_component_code   =>  'merge_acctg_methods');
Line: 6236

  INSERT INTO xla_acctg_methods_tl
     (accounting_method_type_code
     ,accounting_method_code
     ,language
     ,name
     ,description
     ,source_lang
     ,creation_date
     ,created_by
     ,last_update_date
     ,last_updated_by
     ,last_update_login)
     SELECT s.accounting_method_type_code
           ,s.accounting_method_code
           ,fl.language_code
           ,s.name
           ,s.description
           ,USERENV('LANG')
           ,sysdate
           ,xla_environment_pkg.g_usr_id
           ,sysdate
           ,xla_environment_pkg.g_usr_id
           ,xla_environment_pkg.g_login_id
      FROM xla_stage_acctg_methods s
           JOIN fnd_languages fl
           ON  fl.installed_flag                IN ('I', 'B')
           LEFT OUTER JOIN xla_acctg_methods_tl w
           ON  w.accounting_method_type_code = s.accounting_method_type_code
           AND w.accounting_method_code      = s.accounting_method_code
           AND w.language                    = fl.language_code
     WHERE s.staging_amb_context_code        = g_staging_context_code
       AND w.accounting_method_type_code     IS NULL;
Line: 6270

     trace(p_msg    => '# row inserted in xla_acctg_methods_tl = '||l_num_rows,
           p_module => l_log_module,
           p_level  => C_LEVEL_STATEMENT);
Line: 6276

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# row inserted in xla_acctg_methods_tl = '||l_num_rows,
             p_component_code   =>  'merge_acctg_methods');
Line: 6284

  UPDATE xla_acctg_method_rules xamr
     SET amb_context_code = g_amb_context_code
   WHERE amb_context_code = g_staging_context_code
     AND NOT EXISTS (SELECT 1
                       FROM xla_acctg_method_rules xamr2
                      WHERE xamr2.amb_context_code            = g_amb_context_code
                        AND xamr2.accounting_method_type_code = xamr.accounting_method_type_code
                        AND xamr2.accounting_method_code      = xamr.accounting_method_code
                        AND xamr2.application_id              = g_application_id);
Line: 6295

  INSERT INTO xla_aad_loader_logs
    (aad_loader_log_id
    ,amb_context_code
    ,application_id
    ,request_code
    ,log_type_code
    ,encoded_message
    ,aad_application_id
    ,product_rule_code
    ,product_rule_type_code
    ,component_owner_code
    ,component_code
    ,object_version_number
    ,creation_date
    ,created_by
    ,last_update_date
    ,last_updated_by
    ,last_update_login
    ,program_update_date
    ,program_application_id
    ,program_id
    ,request_id)
    SELECT xla_aad_loader_logs_s.nextval
          ,g_amb_context_code
          ,g_application_id
          ,'IMPORT'
          ,'UNMERGE_AAD_IN_SLAM'
	  ,'Rows inserted in xla_acctg_methods_b for staging context code : '||g_staging_context_code||
	    ', ' ||'application_id : '||g_application_id||' is : '||l_num_rows
          ,g_application_id
          ,product_rule_code
          ,product_rule_type_code
          ,accounting_method_type_code
          ,accounting_method_code
          ,1
          ,sysdate
          ,xla_environment_pkg.g_usr_id
          ,sysdate
          ,xla_environment_pkg.g_usr_id
          ,xla_environment_pkg.g_login_id
          ,sysdate
          ,xla_environment_pkg.g_prog_appl_id
          ,xla_environment_pkg.g_prog_id
          ,xla_environment_pkg.g_req_Id
     FROM (SELECT distinct product_rule_type_code
                         , product_rule_code
                         , accounting_method_type_code
                         , accounting_method_code
             FROM xla_acctg_method_rules
            WHERE amb_context_code = g_staging_context_code);
Line: 6347

    trace(p_msg    => '# row inserted in xla_acctg_method_rules = '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6353

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# row inserted in xla_acctg_method_rules = '||l_num_rows,
             p_component_code   =>  'merge_acctg_methods');
Line: 6471

  DELETE FROM xla_mapping_set_values
   WHERE amb_context_code = g_staging_context_code;
Line: 6475

    trace(p_msg    => '# xla_mapping_set_values delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6481

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_set_values delete : '||l_num_rows,
             p_component_code   =>  'purge_mapping_sets');
Line: 6488

  DELETE FROM xla_mapping_sets_tl
   WHERE amb_context_code = g_staging_context_code;
Line: 6492

    trace(p_msg    => '# xla_mapping_sets_tl delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6498

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_sets_tl delete : '||l_num_rows,
             p_component_code   =>  'purge_mapping_sets');
Line: 6505

  DELETE FROM xla_mapping_sets_b
   WHERE amb_context_code = g_staging_context_code;
Line: 6509

    trace(p_msg    => '# xla_mapping_sets_b delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6515

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_mapping_sets_b delete : '||l_num_rows,
             p_component_code   =>  'purge_mapping_sets');
Line: 6563

  DELETE FROM xla_analytical_sources
   WHERE amb_context_code = g_staging_context_code;
Line: 6567

    trace(p_msg    => '# xla_analytical_sources delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6573

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_sources delete : '||l_num_rows,
             p_component_code   =>  'purge_analytical_criteria');
Line: 6580

  DELETE FROM xla_analytical_dtls_tl
   WHERE amb_context_code = g_staging_context_code;
Line: 6584

    trace(p_msg    => '# xla_analytical_dtls_tl delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6590

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_dtls_tl delete : '||l_num_rows,
             p_component_code   =>  'purge_analytical_criteria');
Line: 6597

  DELETE FROM xla_analytical_dtls_b
   WHERE amb_context_code = g_staging_context_code;
Line: 6601

    trace(p_msg    => '# xla_analytical_dtls_b delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6607

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_dtls_b delete : '||l_num_rows,
             p_component_code   =>  'purge_analytical_criteria');
Line: 6614

  DELETE FROM xla_analytical_hdrs_tl
   WHERE amb_context_code = g_staging_context_code;
Line: 6618

    trace(p_msg    => '# xla_analytical_hdrs_tl delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6624

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_hdrs_tl delete : '||l_num_rows,
             p_component_code   =>  'purge_analytical_criteria');
Line: 6631

  DELETE FROM xla_analytical_hdrs_b
   WHERE amb_context_code = g_staging_context_code;
Line: 6635

    trace(p_msg    => '# xla_analytical_hdrs_b delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6641

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_analytical_hdrs_b delete : '||l_num_rows,
             p_component_code   =>  'purge_analytical_criteria');
Line: 6689

  DELETE FROM xla_conditions
   WHERE amb_context_code       = g_staging_context_code
     AND segment_rule_detail_id IS NOT NULl;
Line: 6694

    trace(p_msg    => '# xla_conditions delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6700

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_conditions delete : '||l_num_rows,
             p_component_code   =>  'purge_adrs');
Line: 6707

  DELETE FROM xla_seg_rule_details
   WHERE amb_context_code = g_staging_context_code;
Line: 6711

    trace(p_msg    => '# xla_seg_rules_details delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6717

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_details delete : '||l_num_rows,
             p_component_code   =>  'purge_adrs');
Line: 6725

  DELETE FROM xla_seg_rules_tl
   WHERE amb_context_code = g_staging_context_code;
Line: 6729

    trace(p_msg    => '# xla_seg_rules_tl delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6735

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_tl delete : '||l_num_rows,
             p_component_code   =>  'purge_adrs');
Line: 6743

  DELETE FROM xla_seg_rules_b
   WHERE amb_context_code = g_staging_context_code;
Line: 6747

    trace(p_msg    => '# xla_seg_rules_b delete : '||l_num_rows,
          p_module => l_log_module,
          p_level  => C_LEVEL_STATEMENT);
Line: 6753

    xla_aad_loader_util_pvt.insert_aadloaderlog(
             p_amb_context_code =>  g_amb_context_code,
             p_application_id   =>  g_application_id,
             p_request_code     => 'IMPORT' ,
             p_log_type_code    => 'MERGE',
             p_encoded_message  => '# xla_seg_rules_b delete : '||l_num_rows,
             p_component_code   =>  'purge_adrs');