DBA Data[Home] [Help]

APPS.OKS_MASS_UPD_PVT SQL Statements

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

Line: 13

  PROCEDURE DELETE_CONTRACT_DATA(
        p_contract_id        IN            NUMBER,
        x_return_status    OUT NOCOPY    VARCHAR2)
  IS
  BEGIN

      DELETE FROM oks_headers_temp
        WHERE chr_id = p_contract_id;
Line: 22

      DELETE FROM oks_lines_temp
        WHERE dnz_chr_id = p_contract_id;
Line: 25

      DELETE FROM oks_sublines_temp
        WHERE dnz_chr_id = p_contract_id;
Line: 33

  END DELETE_CONTRACT_DATA;
Line: 41

    l_mass_update_status_tbl oks_mass_upd_pvt.mass_update_status_tbl;
Line: 44

      select ste_code from okc_statuses_b where code = p_sts_code;
Line: 59

        select S.STE_CODE STE_CODE1
          from okc_statuses_v S, fnd_lookups ST
         where S.STE_CODE in (NVL(p_old_ste_code, 'ENTERED'),
                decode(p_old_ste_code,
                                     NULL,
                                     'CANCELLED',
                                     'ENTERED',
                                     'CANCELLED',
                                     'ACTIVE',
                                     'HOLD',
                                     'SIGNED',
                                     'HOLD'

                                     ))
           and sysdate between s.start_date and nvl(s.end_date, sysdate)
           and st.lookup_type = 'OKC_STATUS_TYPE'
           and st.lookup_code = s.ste_code
           and sysdate between st.start_date_active and
               nvl(st.end_date_active, sysdate)
           and ST.enabled_flag = 'Y'
           and S.code not like 'QA%HOLD'
           AND p_old_ste_code <> 'CANCELLED';
Line: 161

    SELECT * BULK COLLECT
      INTO l_mass_update_status_tbl
      FROM (SELECT ID line_id,
                   To_Number(NULL) subline_id,
                   dnz_chr_id,
                   lse_id,
                   line_number,
                   reason_code,
                   status,
                   new_status,
                   comments
              FROM oks_lines_temp
             WHERE status_change_flag = 'Y'
               AND dnz_chr_id = To_Number(p_contract_id)
            UNION ALL
            SELECT cle_id line_id,
                   id subline_id,
                   dnz_chr_id,
                   lse_id,
                   line_number,
                   reason_code,
                   status,
                   new_status,
                   comments
              FROM oks_sublines_temp
             WHERE status_change_flag = 'Y'
               AND dnz_chr_id = to_number(p_contract_id));
Line: 189

    IF l_mass_update_status_tbl.Count > 0 THEN
      for i in l_mass_update_status_tbl.first .. l_mass_update_status_tbl.last loop

        open get_stecode(l_mass_update_status_tbl(i).old_sts_code);
Line: 197

        open get_stecode(l_mass_update_status_tbl(i).new_sts_code);
Line: 205

          IF l_mass_update_status_tbl(i).sub_line_id is null then
            UPDATE oks_lines_temp
               SET status_error_flag = 'Y',
                   status_err_message     = l_new_ste_code ||
                                       ' is not a valid status for the existing status type ' ||
                                       l_old_ste_code
             WHERE id = l_mass_update_status_tbl(i).line_id;
Line: 213

            UPDATE oks_sublines_temp
               SET status_error_flag = 'Y',
                   status_err_message     = l_new_ste_code ||
                                       ' is not a valid status for the existing status type ' ||
                                       l_old_ste_code
             WHERE id = l_mass_update_status_tbl(i).sub_line_id;
Line: 221

          IF l_mass_update_status_tbl(i).sub_line_id is null then
            UPDATE oks_lines_temp
               SET status_error_flag = 'N', error_message = NULL
             WHERE id = l_mass_update_status_tbl(i).line_id;
Line: 226

            UPDATE oks_sublines_temp
               SET status_error_flag = 'N', error_message = NULL
             WHERE id = l_mass_update_status_tbl(i).sub_line_id;
Line: 244

    l_mass_update_eff_tbl oks_mass_upd_pvt.mass_update_effectivity_tbl;
Line: 252

    SELECT * BULK COLLECT
      INTO l_mass_update_eff_tbl
      FROM (SELECT ID line_id,
                   To_Number(NULL) sub_line_id,
                   dnz_chr_id chr_id,
                   lse_id,
                   line_number,
                   start_date,
                   end_date
              FROM oks_lines_temp
             WHERE (start_dt_eff_change_flag = 'Y' OR
                   end_dt_eff_change_flag = 'Y')
               AND dnz_chr_id = to_number(p_contract_id)
            UNION ALL
            SELECT cle_id line_id,
                   id sub_line_id,
                   dnz_chr_id chr_id,
                   lse_id,
                   line_number,
                   start_date,
                   end_date
              FROM oks_sublines_temp
             WHERE (start_dt_eff_change_flag = 'Y' OR
                   end_dt_eff_change_flag = 'Y')
               AND dnz_chr_id = to_number(p_contract_id));
Line: 278

    IF l_mass_update_eff_tbl.Count > 0 THEN
      FOR i IN l_mass_update_eff_tbl.first .. l_mass_update_eff_tbl.last LOOP

        IF l_mass_update_eff_tbl(i).sub_line_id IS NULL THEN

          SELECT start_date, end_date
            INTO l_k_start_date, l_k_end_date
            FROM okc_k_headers_all_b
           where id = l_mass_update_eff_tbl(i).chr_id;
Line: 288

          IF (l_mass_update_eff_tbl(i)
             .start_date < l_k_start_date OR l_mass_update_eff_tbl(i)
             .start_date > l_k_end_date) THEN
            UPDATE oks_lines_temp
               SET start_dt_error_flag = 'Y',
                   st_dt_err_message   = Nvl2(st_dt_err_message, st_dt_err_message ||'- Line Start Date is out of Contract''s Effectivity, line_number: ' || l_mass_update_eff_tbl(i).line_number,
                                          'Line Start Date is out of Contract''s Effectivity, line_number: ' || l_mass_update_eff_tbl(i).line_number)
             WHERE id = l_mass_update_eff_tbl(i).line_id;
Line: 301

          IF (l_mass_update_eff_tbl(i)
             .end_date < l_k_start_date OR l_mass_update_eff_tbl(i)
             .end_date > l_k_end_date) THEN
            UPDATE oks_lines_temp
               SET end_dt_error_flag = 'Y',
                   end_dt_err_message = Nvl2(end_dt_err_message, end_dt_err_message || ' - Line End Date is out of Contract''s Effectivity, line_number: '|| l_mass_update_eff_tbl(i).line_number,
                                        'Line End Date is out of Contract''s Effectivity, line_number: '|| l_mass_update_eff_tbl(i).line_number)
             WHERE id = l_mass_update_eff_tbl(i).line_id;
Line: 316

          SELECT l.START_DATE, l.END_DATE
            INTO l_kl_start_date, l_kl_end_date
            FROM oks_lines_temp l
           WHERE l.id = l_mass_update_eff_tbl(i).line_id;
Line: 321

          IF (l_mass_update_eff_tbl(i)
             .start_date < l_kl_start_date OR l_mass_update_eff_tbl(i)
             .start_date > l_kl_end_date) THEN

            UPDATE oks_sublines_temp
               SET start_dt_error_flag = 'Y',
                   st_dt_err_message   = Nvl2(st_dt_err_message, st_dt_err_message || ' - Subline Start Date is out of Contract line''s Effectivity, subline_number: ' || l_mass_update_eff_tbl(i).line_number,
                                        'Subline Start Date is out of Contract line''s Effectivity, subline_number: ' || l_mass_update_eff_tbl(i).line_number )
             WHERE id = l_mass_update_eff_tbl(i).sub_line_id;
Line: 334

          IF (l_mass_update_eff_tbl(i)
             .end_date < l_kl_start_date OR l_mass_update_eff_tbl(i)
             .end_date > l_kl_end_date) THEN

            UPDATE oks_sublines_temp
               SET end_dt_error_flag = 'Y',
                   end_dt_err_message = Nvl2(end_dt_err_message , end_dt_err_message || ' - Subline End Date is out of Contract line''s Effectivity, subline_number: '|| l_mass_update_eff_tbl(i).line_number,
                                                'Subline End Date is out of Contract line''s Effectivity, subline_number: '|| l_mass_update_eff_tbl(i).line_number)
             WHERE id = l_mass_update_eff_tbl(i).sub_line_id;
Line: 347

          SELECT start_date, end_date
            INTO l_k_start_date, l_k_end_date
            FROM okc_k_headers_all_b
           WHERE id = l_mass_update_eff_tbl(i).chr_id;
Line: 352

          IF (l_mass_update_eff_tbl(i)
             .start_date < l_k_start_date OR l_mass_update_eff_tbl(i)
             .start_date > l_k_end_date) THEN

            UPDATE oks_sublines_temp
               SET start_dt_error_flag = 'Y',
                   st_dt_err_message   = Nvl2(st_dt_err_message, st_dt_err_message ||' - Subline Start Date is out of Contract''s Effectivity, subline_number: '|| l_mass_update_eff_tbl(i).line_number,
                                           'Subline Start Date is out of Contract''s Effectivity, subline_number: '|| l_mass_update_eff_tbl(i).line_number)
             WHERE id = l_mass_update_eff_tbl(i).sub_line_id;
Line: 365

          IF (l_mass_update_eff_tbl(i)
             .end_date < l_k_start_date OR l_mass_update_eff_tbl(i)
             .end_date > l_k_end_date) THEN

            UPDATE oks_sublines_temp
               SET end_dt_error_flag = 'Y',
                   end_dt_err_message = Nvl2(end_dt_err_message, end_dt_err_message || ' - Subline End Date is out of Contract''s Effectivity, subline_number: '|| l_mass_update_eff_tbl(i).line_number,
                                                     'Subline End Date is out of Contract''s Effectivity, subline_number: '|| l_mass_update_eff_tbl(i).line_number)
             WHERE id = l_mass_update_eff_tbl(i).sub_line_id;
Line: 378

        END IF; --l_mass_update_eff_tbl(i).subline_id
Line: 388

  /*validate the mass update data*/
  PROCEDURE vld_massupd_data_prc(RETCODE       OUT NOCOPY NUMBER,
                                 p_contract_id IN VARCHAR2) IS

    l_contract_id VARCHAR2(50) := p_contract_id;
Line: 411

      This procedure is a concurrent program, that trigger mass update wrapper for all
      the three changes done through mass update UI
  */
  PROCEDURE launch_massupd_conc_prog(ERRBUF        OUT NOCOPY VARCHAR2,
                                     RETCODE       OUT NOCOPY NUMBER,
                                     p_contract_id IN VARCHAR2) IS

  l_massupd_return_status VARCHAR2(1);
Line: 428

  SELECT Decode(contract_number_modifier, NULL, contract_number, contract_number ||' - '||contract_number_modifier) contract_number
    FROM okc_k_headers_all_b
   WHERE id = p_contract_id;
Line: 439

    l_msg := 'Service Contracts Mass Update Report for Contract '||l_k_n_display;
Line: 462

    mass_update_status_wrapper(p_contract_id,l_return_status);
Line: 466

    fnd_file.put_line (fnd_file.log,'mass_update_status_wrapper: '||l_overall_status);
Line: 468

    mass_update_eff_wrapper(p_contract_id,l_return_status);
Line: 472

    fnd_file.put_line (fnd_file.log,'mass_update_eff_wrapper: '||l_overall_status);
Line: 474

        mass_update_price_wrapper(p_contract_id,l_return_status);
Line: 478

    fnd_file.put_line (fnd_file.log,'mass_update_price_wrapper: '||l_overall_status);
Line: 485

      DELETE_CONTRACT_DATA(p_contract_id,l_return_status);
Line: 506

  procedure mass_update_price_prc(p_mass_update_price_tbl in mass_update_price_tbl,
                                  x_return_status         out nocopy VARCHAR2,
                                  x_msg_data              OUT NOCOPY VARCHAR2,
                                  x_msg_count             OUT NOCOPY NUMBER) IS

    CURSOR header_details(p_contract_id NUMBER) IS
      SELECT authoring_org_id, inv_organization_id
        FROM okc_k_headers_all_b
       WHERE id = p_contract_id;
Line: 517

      SELECT cleb.price_negotiated, kln.tax_amount
        FROM okc_k_lines_b cleb, oks_k_lines_B kln
       WHERE cleb.id = p_subline_id
         AND cleb.id = kln.cle_id;
Line: 524

      SELECT SUM(kln.tax_amount)
        FROM okc_k_lines_b cle, oks_k_lines_b kln
       WHERE cle.dnz_chr_id = p_chr_id
         AND cle.id = kln.cle_id
         AND cle.lse_id IN (7, 8, 9, 10, 11, 13, 35, 25, 46)
         AND cle.date_cancelled IS NULL;
Line: 533

      SELECT SUM(tax_amount)
        FROM okc_k_lines_b cle, oks_k_lines_b kln
       WHERE cle.cle_id = p_cle_id
         AND cle.id = kln.cle_id
         AND cle.lse_id IN (7, 8, 9, 10, 11, 13, 35, 25, 46)
         AND cle.date_cancelled IS NULL;
Line: 541

      SELECT id, object_version_number
        FROM OKS_K_HEADERS_B
       WHERE chr_id = p_chr_id;
Line: 546

        SELECT 'Y'
        FROM OKC_K_LINES_B
       WHERE dnz_chr_id = p_hdr_id
         AND id = p_line_id
         AND (date_terminated IS NULL OR date_terminated > TRUNC(SYSDATE))
         AND date_cancelled IS NULL
         AND sts_code NOT IN ('CANCELLED', 'TERMINATED') ;
Line: 554

    l_api_name      Varchar2(100) := 'Mass_Update_Price_prc';
Line: 563

    l_mu_price_tbl         OKS_MASS_UPD_PVT.mass_update_price_tbl;
Line: 603

                     'Entered mass_update_price_prc');
Line: 606

    err_mu_price_tbl.DELETE;
Line: 609

    l_mu_price_tbl := p_mass_update_price_tbl;
Line: 626

       DBMS_TRANSACTION.SAVEPOINT('MASS_UPDATE_PRICE');
Line: 685

                       'before call to okc_contract_pub.update_contract_line ');
Line: 687

      okc_contract_pub.update_contract_line(p_api_version   => l_api_version,
                                            p_init_msg_list => l_init_msg_list,
                                            x_return_status => l_return_status,
                                            x_msg_count     => l_msg_count,
                                            x_msg_data      => l_msg_data,
                                            p_clev_rec      => l_clev_rec_in,
                                            x_clev_rec      => l_clev_rec_out);
Line: 698

                       'after call to okc_contract_pub.update_contract_line ' ||
                       'l_return_status -' || l_return_status);
Line: 702

      FND_FILE.PUT_LINE(FND_FILE.Log,'after call to okc_contract_pub.update_contract_line AND l_return_status - ' ||l_return_status);
Line: 801

                       'before call to oks_contract_line_pub.update_line ');
Line: 804

      oks_contract_line_pub.update_line(p_api_version   => l_api_version,
                                        p_init_msg_list => l_init_msg_list,
                                        x_return_status => l_return_status,
                                        x_msg_count     => l_msg_count,
                                        x_msg_data      => l_msg_data,
                                        p_klnv_rec      => l_kln_rec_in,
                                        x_klnv_rec      => l_kln_rec_out,
                                        p_validate_yn   => 'N');
Line: 815

                       ' after call to oks_contract_line_pub.update_line ' ||
                       'l_return_status ' || l_return_status);
Line: 819

      FND_FILE.PUT_LINE(FND_FILE.Log,'  after call to oks_contract_line_pub.update_line AND l_return_status IS ' ||l_return_status);
Line: 850

                       'before call to oks_contract_hdr_pub.update_header ');
Line: 853

      oks_contract_hdr_pub.update_header(p_api_version   => l_api_version,
                                         p_init_msg_list => l_init_msg_list,
                                         x_return_status => l_return_status,
                                         x_msg_count     => l_msg_count,
                                         x_msg_data      => l_msg_data,
                                         p_khrv_tbl      => l_khrv_tbl_type_in,
                                         x_khrv_tbl      => l_khrv_tbl_type_out,
                                         p_validate_yn   => 'N');
Line: 865

                       ' after call to oks_contract_hdr_pub.update_header ' ||
                       'l_return_status ' || l_return_status);
Line: 869

      FND_FILE.PUT_LINE(FND_FILE.Log,'  after call to oks_contract_hdr_pub.update_header AND l_return_status IS ' ||l_return_status);
Line: 884

       DBMS_TRANSACTION.rollback_savepoint('MASS_UPDATE_PRICE');
Line: 928

                     'Leaving  mass_update_price_prc');
Line: 940

                       'Leaving mass_update_price_prc because of EXCEPTION: ' ||
                       sqlerrm);
Line: 951

  end mass_update_price_prc;
Line: 953

  procedure mass_update_price_wrapper(p_contract_id IN VARCHAR2,
                              x_return_status out nocopy varchar2) IS

    --x_return_status VARCHAR2(1);
Line: 958

    l_mass_update_price_tbl oks_mass_upd_pvt.mass_update_price_tbl;
Line: 964

    SELECT cle_id, id, dnz_chr_id, lse_id,line_number,price_negotiated BULK COLLECT
      INTO l_mass_update_price_tbl
      FROM oks_sublines_temp
     WHERE price_change_flag = 'Y'
       AND dnz_chr_id = To_Number(p_contract_id);
Line: 986

    IF l_mass_update_price_tbl.Count > 0 THEN
      fnd_file.put_line (fnd_file.Log, 'Subtotal Change: Total number of Lines/Sublines to process: '||l_mass_update_price_tbl.Count);
Line: 988

      fnd_file.put_line (fnd_file.output, 'Subtotal Change: Total number of Lines/Sublines to process: '||l_mass_update_price_tbl.Count);
Line: 989

    mass_update_price_prc(l_mass_update_price_tbl,
                          x_return_status,
                          x_msg_data,
                          x_msg_count);
Line: 1010

  procedure mass_update_status_wrapper(p_contract_id IN VARCHAR2,
                              x_return_status out nocopy varchar2) IS
    --x_return_status VARCHAR2(1);
Line: 1014

    l_mass_update_status_tbl oks_mass_upd_pvt.mass_update_status_tbl;
Line: 1042

  FOR i IN (SELECT line_number,
                   status_err_message
              FROM oks_lines_temp
             WHERE (status_change_flag = 'Y' AND status_error_flag = 'Y')
               AND dnz_chr_id = To_Number(p_contract_id)
            UNION ALL
            SELECT line_number,
                   status_err_message
              FROM oks_sublines_temp
             WHERE (status_change_flag = 'Y' AND status_error_flag = 'Y')
               AND dnz_chr_id = to_number(p_contract_id)) LOOP

    IF l_count = 0 THEN
      FND_FILE.PUT_LINE( FND_FILE.output, 'Records rejected during validation') ;
Line: 1068

    SELECT * BULK COLLECT
      INTO l_mass_update_status_tbl
      FROM (SELECT ID line_id,
                   To_Number(NULL) subline_id,
                   dnz_chr_id,
                   lse_id,
                   line_number,
                   reason_code,
                   status,
                   new_status,
                   comments
              FROM oks_lines_temp
             WHERE (status_change_flag = 'Y' AND status_error_flag = 'N')
               AND dnz_chr_id = To_Number(p_contract_id)
            UNION ALL
            SELECT cle_id line_id,
                   id subline_id,
                   dnz_chr_id,
                   lse_id,
                   line_number,
                   reason_code,
                   status,
                   new_status,
                   comments
              FROM oks_sublines_temp
             WHERE (status_change_flag = 'Y' AND status_error_flag = 'N')
               AND dnz_chr_id = to_number(p_contract_id));
Line: 1096

    IF l_mass_update_status_tbl.Count > 0 THEN
          IF l_count <> 0 THEN
            fnd_file.put_line (fnd_file.output, 'Status Change: Total Number of Rejected Lines during validation: ' || l_count);
Line: 1102

      fnd_file.put_line (fnd_file.Log, 'Status Change: Total Number of Lines/Sublines to process: '||l_mass_update_status_tbl.count);
Line: 1103

      fnd_file.put_line (fnd_file.output, 'Status Change: Total Number of Lines/Sublines to process: '||l_mass_update_status_tbl.count);
Line: 1105

    mass_update_status_prc(l_mass_update_status_tbl,
                           x_return_status,
                           x_msg_data,
                           x_msg_count);
Line: 1129

  procedure mass_update_eff_wrapper(p_contract_id   IN VARCHAR2,
                                    x_return_status out nocopy varchar2) IS
    --x_return_status VARCHAR2(1);
Line: 1133

    l_mass_update_eff_tbl oks_mass_upd_pvt.mass_update_effectivity_tbl;
Line: 1166

    FOR I IN (SELECT line_number,
                     DECODE(start_dt_error_flag,
                            'Y',
                            'Start Date Error: ' || st_dt_err_message,
                            '') st_dt_err,
                     DECODE(end_dt_error_flag,
                            'Y',
                            'End Date Error: ' || end_dt_err_message,
                            '') end_dt_err
                FROM oks_lines_temp
               WHERE ((start_dt_eff_change_flag = 'Y' AND
                     start_dt_error_flag = 'Y') OR (end_dt_eff_change_flag = 'Y' AND
                     end_dt_error_flag = 'Y'))
                 AND dnz_chr_id = to_number(p_contract_id)
              UNION ALL
              SELECT line_number,
                     DECODE(start_dt_error_flag,
                            'Y',
                            'Start Date Error: ' || st_dt_err_message,
                            '') st_dt_err,
                     DECODE(end_dt_error_flag,
                            'Y',
                            'End Date Error: ' || end_dt_err_message,
                            '') end_dt_err
                FROM oks_sublines_temp
               WHERE ((start_dt_eff_change_flag = 'Y' AND
                     start_dt_error_flag = 'Y') OR (end_dt_eff_change_flag = 'Y' AND
                     end_dt_error_flag = 'Y'))
                 AND dnz_chr_id = to_number(p_contract_id)) LOOP

      IF l_count = 0 THEN
        FND_FILE.PUT_LINE(FND_FILE.output, 'Records rejected during validation');
Line: 1217

    SELECT * BULK COLLECT
      INTO l_mass_update_eff_tbl
      FROM (SELECT ID line_id,
                   To_Number(NULL) subline_id,
                   dnz_chr_id,
                   lse_id,
                   line_number,
                   start_date,
                   end_date
              FROM oks_lines_temp
             WHERE ((start_dt_eff_change_flag = 'Y' AND
                   start_dt_error_flag = 'N') OR
                   (end_dt_eff_change_flag = 'Y' AND end_dt_error_flag = 'N'))
               AND dnz_chr_id = to_number(p_contract_id)
            UNION ALL
            SELECT cle_id line_id,
                   id subline_id,
                   dnz_chr_id,
                   lse_id,
                   line_number,
                   start_date,
                   end_date
              FROM oks_sublines_temp lin
             WHERE ((start_dt_eff_change_flag = 'Y' AND
                   start_dt_error_flag = 'N') OR
                   (end_dt_eff_change_flag = 'Y' AND end_dt_error_flag = 'N'))
               AND dnz_chr_id = to_number(p_contract_id));
Line: 1245

    IF l_mass_update_eff_tbl.Count > 0 THEN
      IF l_count <> 0 THEN
        FND_FILE.PUT_LINE(FND_FILE.output, '                                    ');
Line: 1255

      mass_update_effectivity_prc(l_mass_update_eff_tbl, x_return_status);
Line: 1281

  procedure mass_update_status_prc(p_mass_update_status_tbl in mass_update_status_tbl,
                                   x_return_status          out nocopy VARCHAR2,
                                   x_msg_data               OUT NOCOPY VARCHAR2,
                                   x_msg_count              OUT NOCOPY NUMBER) IS
  --PRAGMA autonomous_transaction;
Line: 1295

    l_api_name         Varchar2(100) := 'Mass_Update_Status_prc';
Line: 1297

    p_lines_tbl        OKS_MASS_UPD_PVT.mass_update_status_tbl;
Line: 1304

      SELECT authoring_org_id, inv_organization_id
        FROM okc_k_headers_all_b
       WHERE id = p_contract_id;
Line: 1309

      select ste_code from okc_statuses_b where code = p_sts_code;
Line: 1329

                     'Entered Mass_Update_Status_Prc');
Line: 1332

    /*Set the apps user_id which is useful to update the who columns in OKS tables.
    FND_GLOBAL.apps_initialize(p_user_id,p_resp_id,p_pgm_appl_id);  */
Line: 1335

    p_lines_tbl := p_mass_update_status_tbl;
Line: 1351

       DBMS_TRANSACTION.SAVEPOINT('MASS_UPDATE_STATUS');
Line: 1416

      OKS_CHANGE_STATUS_PVT.UPDATE_LINE_STATUS(x_return_status      => l_return_status,
                                               x_msg_data           => l_msg_data,
                                               x_msg_count          => l_msg_count,
                                               p_init_msg_list      => 'T',
                                               p_id                 => p_lines_tbl(i)
                                                                      .chr_id,
                                               p_cle_id             => p_lines_tbl(i)
                                                                      .line_id,
                                               p_new_sts_code       => p_lines_tbl(i)
                                                                      .new_sts_code,
                                               p_canc_reason_code   => p_lines_tbl(i)
                                                                      .canc_reason_code,
                                               p_old_sts_code       => p_lines_tbl(i)
                                                                      .old_sts_code,
                                               p_old_ste_code       => l_old_ste_code,
                                               p_new_ste_code       => l_new_ste_code,
                                               p_term_cancel_source => 'MANUAL',
                                               p_date_cancelled     => sysdate,
                                               p_comments           => p_lines_tbl(i)
                                                                      .comments,
                                               p_validate_status    => 'N');
Line: 1441

                       'After Update_Line_Status' || 'l_return_status -' ||
                       l_return_status);
Line: 1445

      FND_FILE.PUT_LINE(FND_FILE.LOG,'After Update_Line_Status - l_return_status is ' ||l_return_status);
Line: 1465

       DBMS_TRANSACTION.rollback_savepoint('MASS_UPDATE_STATUS');
Line: 1473

    l_success_count := p_mass_update_status_tbl.Count - Nvl(err_mu_status_tbl.Count,0);
Line: 1515

 FND_FILE.PUT_LINE(FND_FILE.Log,'Return Status in Mass_Update_Status_Prc is '||x_return_status);
Line: 1524

                       'Leaving mass_update_status_prc because of EXCEPTION: ' ||
                       sqlerrm);
Line: 1560

      SELECT TRUNC(MIN(BCL.DATE_BILLED_FROM)) DATE_BILLED_FROM,
             TRUNC(MAX(BCL.DATE_BILLED_TO)) DATE_BILLED_TO
        FROM OKS_BILL_CONT_LINES BCL
       WHERE BCL.CLE_ID = P_TOP_LINE_ID;
Line: 1568

      SELECT TRUNC(START_DATE) START_DATE, TRUNC(END_DATE) END_DATE
        FROM okc_k_headers_all_b
       WHERE ID = P_HDR_ID;
Line: 1575

      SELECT TRUNC(MIN(BSL.DATE_BILLED_FROM)) DATE_BILLED_FROM,
             TRUNC(MAX(BSL.DATE_BILLED_TO)) DATE_BILLED_TO
        FROM OKS_BILL_SUB_LINES BSL
       WHERE BSL.CLE_ID = P_SUB_LINE_ID;
Line: 1583

      SELECT TRUNC(START_DATE) START_DATE, TRUNC(END_DATE) END_DATE
        FROM OKC_K_LINES_B
       WHERE ID = P_TOP_LINE_ID;
Line: 1699

    SELECT start_date, end_date
      INTO l_k_start_date, l_k_end_date
      FROM okc_k_headers_all_b
     where id = p_chr_id;
Line: 1705

      UPDATE oks_lines_temp
         SET start_dt_error_flag = 'Y',
             st_dt_err_message       = Nvl2(st_dt_err_message, st_dt_err_message ||'- Line Start Date is out of Contract''s Effectivity, line_number: ' || p_line_number,
                                        'Line Start Date is out of Contract''s Effectivity, line number: ' || p_line_number)
       WHERE id = p_line_id;
Line: 1716

      UPDATE oks_lines_temp
         SET end_dt_error_flag = 'Y',
             end_dt_err_message     = Nvl2(end_dt_err_message, end_dt_err_message || ' - Line End Date is out of Contract''s Effectivity, line_number: '|| p_line_number,
                                        'Line End Date is out of Contract''s Effectivity, line number: '|| p_line_number)
       WHERE id = p_line_id;
Line: 1772

    select l.chr_id, l.START_DATE, l.END_DATE
      INTO l_chr_id, l_kl_start_date, l_kl_end_date
      FROM OKC_K_LINES_B sl, okc_k_lines_b l
     WHERE sl.id = p_subline_id
       AND sl.cle_id = l.id;
Line: 1780

      UPDATE oks_sublines_temp
         SET start_dt_error_flag = 'Y',
             st_dt_err_message       = Nvl2(st_dt_err_message, st_dt_err_message || ' - Subline Start Date is out of Contract line''s Effectivity, subline number: ' || p_line_number,
                                        'Subline Start Date is out of Contract line''s Effectivity, subline number: ' || p_line_number )
       WHERE id = p_subline_id;
Line: 1790

      UPDATE oks_sublines_temp
         SET end_dt_error_flag = 'Y',
             end_dt_err_message     = Nvl2(end_dt_err_message , end_dt_err_message || ' - Subline End Date is out of Contract line''s Effectivity, subline number: ' || p_line_number,
                                                      'Subline End Date is out of Contract line''s Effectivity, subline number: ' || p_line_number)
       WHERE id = p_subline_id;
Line: 1799

    SELECT start_date, end_date
      INTO l_k_start_date, l_k_end_date
      FROM okc_k_headers_all_b
     WHERE id = l_chr_id;
Line: 1806

      UPDATE oks_sublines_temp
         SET start_dt_error_flag = 'Y',
             st_dt_err_message       = Nvl2(st_dt_err_message, st_dt_err_message ||' - Subline Start Date is out of Contract''s Effectivity, subline number: ' || p_line_number,
                                        'Subline Start Date is out of Contract''s Effectivity, subline number: ' || p_line_number)
       WHERE id = p_subline_id;
Line: 1817

      UPDATE oks_sublines_temp
         SET end_dt_error_flag = 'Y',
             end_dt_err_message     = Nvl2(end_dt_err_message, end_dt_err_message || ' - Subline End Date is out of Contract''s Effectivity, subline number: ' || p_line_number,
                                                     'Subline End Date is out of Contract''s Effectivity, subline number: ' || p_line_number)
       WHERE id = p_subline_id;
Line: 1854

  procedure mass_update_effectivity_prc(p_mass_update_effectivity_tbl in mass_update_effectivity_tbl,
                                        x_return_status               out nocopy varchar2) IS
    l_api_version   CONSTANT NUMBER := 1.0;
Line: 1857

    l_api_name      VARCHAR2(100) := 'oks_mass_upd_pvt.mass_update_effectivity_prc';
Line: 1898

      Select id From OKC_K_LINES_b Where cle_id = p_line_id;
Line: 1901

      SELECT 'Y'
        FROM OKC_K_LINES_B
       WHERE dnz_chr_id = p_hdr_id
         AND id = p_line_id
         AND (date_terminated IS NULL OR date_terminated > TRUNC(SYSDATE))
         AND date_cancelled IS NULL
         AND sts_code NOT IN ('CANCELLED', 'TERMINATED')
         AND end_date > NVL(oks_bill_util_pub.get_billed_upto(id, p_intent),
                            end_date - 1);
Line: 1913

    fnd_file.put_line (fnd_file.output,  'Effectivity Change: ' || ' Total Number of Lines/Sublines to process: ' || p_mass_update_effectivity_tbl.Count);
Line: 1915

    FOR i IN p_mass_update_effectivity_tbl.FIRST .. p_mass_update_effectivity_tbl.LAST LOOP

      IF p_mass_update_effectivity_tbl(i).sub_line_id IS NULL THEN
        BEGIN
          SELECT sts_code
            INTO l_clev_tbl_kl_in(p) .sts_code
            FROM okc_k_lines_b
           where id = p_mass_update_effectivity_tbl(i).line_id;
Line: 1925

            l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 1932

                             ' Error while fetching data from okc_k_lines_b, line number: ' || p_mass_update_effectivity_tbl(i).line_number);
Line: 1936

        OPEN check_eligiblity_line(p_mass_update_effectivity_tbl(i).chr_id,
                                   p_mass_update_effectivity_tbl(i).line_id,
                                   'T');
Line: 1944

          fnd_file.put_line (fnd_file.log, l_api_name || ' Line number : ' || p_mass_update_effectivity_tbl(i).line_number || 'is eligible');
Line: 1945

          l_clev_tbl_kl_in(p).id := p_mass_update_effectivity_tbl(i).line_id;
Line: 1948

          l_clev_tbl_kl_in(p).start_date := p_mass_update_effectivity_tbl(i).START_DATE;
Line: 1949

          l_clev_tbl_kl_in(p).end_date := p_mass_update_effectivity_tbl(i).end_date;
Line: 1950

          l_clev_tbl_kl_in(p).lse_id := p_mass_update_effectivity_tbl(i).lse_id;
Line: 1952

          check_new_line_effectivity(p_mass_update_effectivity_tbl(i).chr_id,
                                     p_mass_update_effectivity_tbl(i).line_id,
                                     p_mass_update_effectivity_tbl(i).line_number,
                                     l_clev_tbl_kl_in(p).start_date,
                                     l_clev_tbl_kl_in(p).end_date,
                                     l_clev_tbl_kl_in(p).exception_yn);
Line: 1960

                                                      p_cle_id   => p_mass_update_effectivity_tbl(i)
                                                                   .line_id,
                                                      p_lse_id   => p_mass_update_effectivity_tbl(i)
                                                                   .lse_id,
                                                      p_end_date => null) THEN

              fnd_file.put_line (fnd_file.log,
                             l_api_name ||
                             ' Entering Validate_date for Line number: ' || p_mass_update_effectivity_tbl(i).line_number);
Line: 1972

                          p_hdr_id        => p_mass_update_effectivity_tbl(i).chr_id,
                          p_top_line_id   => p_mass_update_effectivity_tbl(i).line_id,
                          p_sub_line_id   => NULL,
                          x_return_status => l_return_status,
                          x_msg_count     => l_msg_count,
                          x_msg_data      => l_msg_data,
                          x_flag          => l_flag);
Line: 1982

                             ' After Validate_date for Line number: ' || p_mass_update_effectivity_tbl(i).line_number);
Line: 1989

                  l_err_mu_eff_tbl(l_err_eff_idx).line_number :=  p_mass_update_effectivity_tbl(i).line_number ;
Line: 2008

              l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 2017

                                    p_msg_name     => 'OKS_BA_UPDATE_NOT_ALLOWED',
                                    p_token1       => 'Line No ',
                                    p_token1_value => l_line_number);
Line: 2027

                l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 2050

                         ' Line number: ' || p_mass_update_effectivity_tbl(i).line_number ||
                         ', Status would be: ' || l_clev_tbl_kl_in(p).STS_CODE ||
                         ', Start Date and End Date are: ' || l_clev_tbl_kl_in(p).start_date || ' and ' || l_clev_tbl_kl_in(p).end_date);
Line: 2058

      ELSIF p_mass_update_effectivity_tbl(i).sub_line_id IS NOT NULL THEN

        BEGIN
          SELECT sts_code
            INTO l_clev_tbl_sl_in(q).sts_code
            FROM okc_k_lines_b
           where id = p_mass_update_effectivity_tbl(i).sub_line_id;
Line: 2067

              l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 2077

        OPEN check_eligiblity_line(p_mass_update_effectivity_tbl(i).chr_id,
                                   p_mass_update_effectivity_tbl(i)
                                   .sub_line_id,
                                   'S');
Line: 2087

          l_clev_tbl_sl_in(q).id := p_mass_update_effectivity_tbl(i).sub_line_id;
Line: 2090

          l_clev_tbl_sl_in(q).cle_id := p_mass_update_effectivity_tbl(i).line_id;
Line: 2091

          l_clev_tbl_sl_in(q).start_date := p_mass_update_effectivity_tbl(i).start_date;
Line: 2092

          l_clev_tbl_sl_in(q).end_date := p_mass_update_effectivity_tbl(i).end_date;
Line: 2093

          l_clev_tbl_sl_in(q).lse_id := p_mass_update_effectivity_tbl(i).lse_id;
Line: 2094

          l_clev_tbl_sl_in(q).CHR_id := p_mass_update_effectivity_tbl(i).chr_id;
Line: 2108

          check_new_subline_effectivity(p_mass_update_effectivity_tbl(i).chr_id,
                                        p_mass_update_effectivity_tbl(i).line_id,
                                        p_mass_update_effectivity_tbl(i).sub_line_id,
                                        p_mass_update_effectivity_tbl(i).line_number,
                                        l_clev_tbl_sl_in(q).start_date,
                                        l_clev_tbl_sl_in(q).end_date,
                                        l_clev_tbl_sl_in(q).exception_yn);
Line: 2127

                                                      p_cle_id   => p_mass_update_effectivity_tbl(i).line_id,
                                                      p_lse_id   => p_mass_update_effectivity_tbl(i).lse_id,
                                                      p_end_date => null) THEN
              fnd_file.put_line (fnd_file.log,
                             l_api_name ||
                             ' Entering Validate_date for Sub Line Id: ' ||
                             p_mass_update_effectivity_tbl(i).sub_line_id);
Line: 2138

                          p_top_line_id   => p_mass_update_effectivity_tbl(i).line_id,
                          p_sub_line_id   => p_mass_update_effectivity_tbl(i).sub_line_id,
                          x_return_status => l_return_status,
                          x_msg_count     => l_msg_count,
                          x_msg_data      => l_msg_data,
                          x_flag          => l_flag);
Line: 2149

                  l_err_mu_eff_tbl(l_err_eff_idx).line_number :=  p_mass_update_effectivity_tbl(i).line_number ;
Line: 2166

              l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 2175

                                    p_msg_name     => 'OKS_BA_UPDATE_NOT_ALLOWED',
                                    p_token1       => 'Line No ',
                                    p_token1_value => l_line_number);
Line: 2185

                l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 2195

      END IF; --p_mass_update_effectivity_tbl(i).sub_line_id
Line: 2209

            DBMS_TRANSACTION.SAVEPOINT('MASS_UPDATE_EFFECTIVITY');
Line: 2210

            fnd_file.put_line (fnd_file.log,l_api_name || ' Before Calling : okc_contract_pub.update_contract_line');
Line: 2212

            okc_contract_pub.update_contract_line(p_api_version       => l_api_version,
                                                  p_init_msg_list     => l_init_msg_list,
                                                  x_return_status     => l_return_status,
                                                  x_msg_count         => l_msg_count,
                                                  x_msg_data          => l_msg_data,
                                                  p_restricted_update => 'F',
                                                  p_clev_rec          => l_clev_tbl_kl_in(j),
                                                  X_CLEV_rec          => l_clev_tbl_kl_out(j));
Line: 2220

            fnd_file.put_line (fnd_file.log,l_api_name || ' After Calling : okc_contract_pub.update_contract_line');
Line: 2241

                l_err_mu_eff_tbl(l_err_eff_idx).line_number := p_mass_update_effectivity_tbl(i).line_number;
Line: 2260

              DBMS_TRANSACTION.ROLLBACK_SAVEPOINT('MASS_UPDATE_EFFECTIVITY');
Line: 2264

                               ' Error from okc_contract_pub.update_contract_line procedure' ||
                               SQLERRM);
Line: 2317

                DBMS_TRANSACTION.ROLLBACK_SAVEPOINT('MASS_UPDATE_EFFECTIVITY');
Line: 2333

                                 ' Before Calling : OKS_COVERAGES_PVT.Update_COVERAGE_Effectivity');
Line: 2335

                OKS_COVERAGES_PVT.Update_COVERAGE_Effectivity(p_api_version     => l_api_version,
                                                              p_init_msg_list   => l_init_msg_list,
                                                              x_return_status   => l_return_status,
                                                              x_msg_count       => l_msg_count,
                                                              X_MSG_DATA        => L_MSG_DATA,
                                                              p_service_Line_Id => l_clev_tbl_kl_in(j).cle_id,
                                                              p_New_Start_Date  => l_clev_tbl_kl_in(j).start_date,
                                                              P_NEW_END_DATE    => l_clev_tbl_kl_in(j).END_DATE);
Line: 2343

                  fnd_file.put_line (fnd_file.log,l_api_name || ' After Calling : OKS_COVERAGES_PVT.Update_COVERAGE_Effectivity');
Line: 2408

            fnd_file.put_line (fnd_file.log,l_api_name || ' Before Calling okc_contract_pub.update_contract_line');
Line: 2409

            okc_contract_pub.update_contract_line(p_api_version       => l_api_version,
                                                  p_init_msg_list     => l_init_msg_list,
                                                  x_return_status     => l_return_status,
                                                  x_msg_count         => l_msg_count,
                                                  x_msg_data          => l_msg_data,
                                                  p_restricted_update => 'F',
                                                  p_clev_rec          => l_clev_tbl_sl_in(k),
                                                  X_CLEV_rec          => l_clev_tbl_sl_out(k));
Line: 2417

            fnd_file.put_line (fnd_file.log,l_api_name || ' After Calling okc_contract_pub.update_contract_line');
Line: 2425

                               ' Exception from  okc_contract_pub.update_contract_line, Error is: ' ||
                               SQLERRM);
Line: 2579

  END mass_update_effectivity_prc;
Line: 2589

        SELECT a.customer_product_id
          FROM oks_ib_config_v a
         WHERE a.config_parent_id IS NULL
         START WITH a.customer_product_id = p_customer_prod_id
        CONNECT BY PRIOR a.config_parent_id = a.customer_product_id
               AND EXISTS
         (SELECT 1
                      FROM okc_k_items itm
                     where a.customer_product_id = itm.object1_id1
                       AND itm.dnz_chr_id = p_contract_id);
Line: 2621

        SELECT b.customer_product_id
          FROM oks_ib_config_v b
         WHERE LEVEL = 2
         START WITH b.customer_product_id =
                    (SELECT a.customer_product_id
                       FROM oks_ib_config_v a
                      WHERE a.config_parent_id IS NULL
                      START WITH a.customer_product_id = p_customer_prod_id
                     CONNECT BY PRIOR a.config_parent_id = a.customer_product_id)
        CONNECT BY b.config_parent_id = PRIOR b.customer_product_id
               AND EXISTS
         (SELECT 1
                      FROM okc_k_items itm
                     where b.customer_product_id = itm.object1_id1
                       AND itm.dnz_chr_id = p_contract_id);
Line: 2658

        SELECT b.customer_product_id
          FROM oks_ib_config_v b
         WHERE LEVEL = 2
         START WITH b.customer_product_id =
                    (SELECT a.customer_product_id
                       FROM oks_ib_config_v a
                      WHERE a.config_parent_id IS NULL
                      START WITH a.customer_product_id = p_customer_prod_id
                     CONNECT BY PRIOR a.config_parent_id = a.customer_product_id)
        CONNECT BY b.config_parent_id = PRIOR b.customer_product_id
               AND EXISTS
         (SELECT 1
                      FROM okc_k_items itm
                     where b.customer_product_id = itm.object1_id1
                       AND itm.dnz_chr_id = p_contract_id);
Line: 2699

        SELECT a.customer_product_id
          FROM oks_ib_config_v a
         WHERE a.config_parent_id IS NULL
         START WITH a.customer_product_id = p_customer_prod_id
        CONNECT BY PRIOR a.config_parent_id = a.customer_product_id
               AND EXISTS
         (SELECT 1
                      FROM okc_k_items itm
                     where a.customer_product_id = itm.object1_id1
                       AND itm.dnz_chr_id = p_contract_id);
Line: 2734

      SELECT saved_flag FROM oks_headers_temp WHERE chr_id = p_contract_id;
Line: 2752

      DELETE_CONTRACT_DATA(p_contract_id,l_return_status);
Line: 2754

      INSERT INTO oks_headers_temp
        (chr_id,chr_id_char,
         contract_number,
         contract_number_modifier,
         contract_start_date,
         contract_end_date,
         contract_status,
         contract_amount,
         cascade_selection,
         created_by,
         creation_date,
         last_updated_by,
         last_update_date,
         last_update_login)
        SELECT id, To_Char(id),
               contract_number,
               contract_number_modifier,
               start_date,
               end_date,
               sts_code,
               ESTIMATED_AMOUNT,
               'Y',
               FND_GLOBAL.USER_ID,
               SYSDATE,
               FND_GLOBAL.USER_ID,
               SYSDATE,
               FND_GLOBAL.LOGIN_ID
          FROM okc_k_headers_all_b
         WHERE id = p_contract_id;
Line: 2784

      INSERT INTO oks_lines_temp
        (id,id_char,
         dnz_chr_id, dnz_chr_id_char,
         line_number,
         lse_id,
         name,
         description,
         old_status,
         undo_status,
         old_ste_code,
         status,
         ste_code,
         new_status,
         new_ste_code,
         start_date,
         end_date,
         old_start_date,
         old_end_date,
         Price_negotiated,
         undo_start_date,
         undo_end_date,
         undo_Price_negotiated)
        SELECT lin.id, To_Char(lin.id),
               lin.dnz_chr_id, To_Char(lin.dnz_chr_id),
               line_number,
               lse_id,
               SI.description NAME,
               SI.name DESCRIPTION,
               lin.sts_code old_Status,
               lin.sts_code undo_Status,
               sts.ste_code old_ste_code,
               lin.sts_code Status,
               sts.ste_code ste_code,
               lin.sts_code new_status,
               sts.ste_code new_ste_code,
               lin.start_date,
               lin.end_date,
               lin.start_date,
               lin.end_date,
               Price_negotiated,
               lin.start_date,
               lin.end_date,
               Price_negotiated
          FROM okc_k_lines_b      lin,
               okc_k_items        itm,
               OKX_SYSTEM_ITEMS_V SI,
               okc_statuses_b     sts
         WHERE lin.id = itm.cle_id
           AND itm.object1_id1 = SI.id1
           AND SI.organization_id = itm.object1_id2
           AND lin.sts_code = sts.code
           AND lin.lse_id IN (1, 12, 14, 19)
           AND lin.dnz_chr_id = p_contract_id
         ORDER BY To_Number(lin.line_number);
Line: 2839

      INSERT INTO oks_sublines_temp
        (id,
         cle_id,
         dnz_chr_id,
         id_char,
         cle_id_char,
         dnz_chr_id_char,
         lse_id,
         line_number,
         customer_product_id,
         name,
         description,
         serial_number,
	       system_name,
	       old_status,
         undo_status,
	       old_ste_code,
         status,
         ste_code,
         new_status,
         new_ste_code,
         reason_code,
         start_date,
         end_date,
         old_start_date,
         old_end_date,
         old_price_negotiated,
         undo_start_date,
         undo_end_date,
         undo_price_negotiated,
         price_negotiated,
         top_lvl_parent)
         SELECT lin.id,
                lin.cle_id,
                lin.dnz_chr_id,
                To_Char(lin.id),
                To_Char(lin.cle_id),
                To_Char(lin.dnz_chr_id),
                lin.lse_id,
                (SELECT line_number
                   FROM okc_k_lines_b line
                  WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
                cs_item.customer_product_id,
                SI.name,
                SI.description,
                cs_item.serial_number,
                CSTL.NAME system_name,
                lin.sts_code old_Status,
                lin.sts_code undo_Status,
                sts.ste_code old_ste_code,
                lin.sts_code Status,
                sts.ste_code ste_code,
                lin.sts_code new_status,
                sts.ste_code new_ste_code,
                null,
                lin.start_date,
                lin.end_date,
                lin.start_date,
                lin.end_date,
                lin.price_negotiated,
                lin.start_date,
                lin.end_date,
                lin.price_negotiated,
                lin.price_negotiated,
                DECODE((SELECT a1.customer_product_id
                FROM oks_ib_config_v a1
               WHERE a1.config_parent_id IS NULL
               START WITH a1.customer_product_id =
                          CS_ITEM.CUSTOMER_PRODUCT_ID
              CONNECT BY PRIOR a1.config_parent_id = a1.customer_product_id
                     AND EXISTS
               (SELECT 1
                            FROM okc_k_items itm1
                           WHERE a1.customer_product_id = itm1.object1_id1
                             AND itm1.dnz_chr_id = ITM.DNZ_CHR_ID)),
              CS_ITEM.CUSTOMER_PRODUCT_ID,
              -99,
              NULL,
              DECODE((SELECT b1.customer_product_id
                       FROM oks_ib_config_v b1
                      WHERE LEVEL = 2
                      START WITH b1.customer_product_id =
                                 (SELECT a.customer_product_id
                                    FROM oks_ib_config_v a
                                   WHERE a.config_parent_id IS NULL
                                   START WITH a.customer_product_id =
                                              CS_ITEM.CUSTOMER_PRODUCT_ID
                                  CONNECT BY PRIOR a.config_parent_id =
                                              a.customer_product_id)
                     CONNECT BY b1.config_parent_id = PRIOR b1.customer_product_id
                       AND EXISTS
                      (SELECT 1
                                   FROM okc_k_items itm1
                                  where b1.customer_product_id =
                                        itm1.object1_id1
                                    AND itm1.dnz_chr_id = ITM.DNZ_CHR_ID)
                       AND ROWNUM = 1)
                       ,
                     CS_ITEM.CUSTOMER_PRODUCT_ID,
                     -99,
                     NULL,
                     (SELECT A.CUSTOMER_PRODUCT_ID
                        FROM OKS_IB_CONFIG_V A
                       WHERE A.CONFIG_PARENT_ID IS NULL
                       START WITH A.CUSTOMER_PRODUCT_ID =
                                  CS_ITEM.CUSTOMER_PRODUCT_ID
                      CONNECT BY A.CUSTOMER_PRODUCT_ID = PRIOR
                                 A.CONFIG_PARENT_ID),
                     (SELECT b1.customer_product_id
                        FROM oks_ib_config_v b1
                       WHERE LEVEL = 2
                       START WITH b1.customer_product_id =
                                  (SELECT a.customer_product_id
                                     FROM oks_ib_config_v a
                                    WHERE a.config_parent_id IS NULL
                                    START WITH a.customer_product_id =
                                               CS_ITEM.CUSTOMER_PRODUCT_ID
                                   CONNECT BY PRIOR a.config_parent_id =
                                               a.customer_product_id)
                      CONNECT BY b1.config_parent_id = PRIOR
                                 b1.customer_product_id
                             AND EXISTS
                       (SELECT 1
                                    FROM okc_k_items itm1
                                   where b1.customer_product_id =
                                         itm1.object1_id1
                                     AND itm1.dnz_chr_id = ITM.DNZ_CHR_ID)
                             AND ROWNUM = 1)),
              (SELECT a1.customer_product_id
                 FROM oks_ib_config_v a1
                WHERE a1.config_parent_id IS NULL
                START WITH a1.customer_product_id =
                           CS_ITEM.CUSTOMER_PRODUCT_ID
               CONNECT BY PRIOR a1.config_parent_id = a1.customer_product_id
                      AND EXISTS
                (SELECT 1
                             FROM okc_k_items itm1
                            WHERE a1.customer_product_id = itm1.object1_id1
                              AND itm1.dnz_chr_id = ITM.DNZ_CHR_ID)
                      AND ROWNUM = 1)) TOP_LVL_PARENT
/*commented and modified above for bug14470110
                CASE
                  WHEN oks_model_item_check(itm.dnz_chr_id,
                                            cs_item.customer_product_id) = 'Y' THEN
                   -99
                  WHEN (oks_model_check(itm.dnz_chr_id,
                                        cs_item.customer_product_id) = 'N' AND
                       oks_config_item_check(itm.dnz_chr_id,
                                              cs_item.customer_product_id) = 'Y') THEN
                   -99
                  ELSE
                   (CASE
                  WHEN oks_model_check(itm.dnz_chr_id,
                                       cs_item.customer_product_id) = 'Y' THEN
                   (SELECT a.customer_product_id
                      FROM oks_ib_config_v a
                     WHERE a.config_parent_id IS null
                     START WITH a.customer_product_id =
                                cs_item.customer_product_id
                    CONNECT BY a.customer_product_id = PRIOR a.config_parent_id)
                  WHEN oks_config_check(itm.dnz_chr_id,
                                        cs_item.customer_product_id) = 'Y' THEN
                   (SELECT b.customer_product_id
                      FROM oks_ib_config_v b
                     WHERE LEVEL = 2
                     START WITH b.customer_product_id =
                                (SELECT a.customer_product_id
                                   FROM oks_ib_config_v a
                                  WHERE a.config_parent_id IS NULL
                                  START WITH a.customer_product_id =
                                             cs_item.customer_product_id
                                 CONNECT BY PRIOR a.config_parent_id =
                                             a.customer_product_id)
                    CONNECT BY b.config_parent_id = PRIOR b.customer_product_id
                    AND EXISTS (SELECT 1 FROM okc_k_items
                         WHERE object1_id1 = cs_item.customer_product_id
                           AND cle_id = itm.cle_id)
                    AND ROWNUM = 1)
                  ELSE
                   (SELECT a.customer_product_id
                      FROM oks_ib_config_v a
                     WHERE a.config_parent_id IS null
                     START WITH a.customer_product_id =
                                cs_item.customer_product_id
                    CONNECT BY a.customer_product_id = PRIOR a.config_parent_id)
                END) END top_lvl_parent*/
                /*CASE
                                 WHEN cs_item.config_parent_id IS NULL THEN
                                  -99
                                 ELSE
                                  (SELECT a.customer_product_id
                                     FROM oks_ib_config_v a
                                    WHERE a.config_parent_id IS null
                                    START WITH a.customer_product_id =
                                               cs_item.customer_product_id
                                   CONNECT BY a.customer_product_id = PRIOR
                                              a.config_parent_id)
                               END top_lvl_parent,*/

           FROM okc_k_items        itm,
                okc_k_lines_b      lin,
                OKX_SYSTEM_ITEMS_V SI,
                oks_ib_config_v    cs_item,
                okc_statuses_b     sts,
                CSI_SYSTEMS_TL     CSTL
          WHERE itm.object1_id1 = cs_item.customer_product_id
            AND cs_item.system_id = cstl.system_id(+)
            AND CSTL.LANGUAGE(+) = UserEnv('LANG')
            AND lin.id = itm.cle_id
            AND lin.dnz_chr_id = p_contract_id
            AND SI.id1 = cs_item.INVENTORY_ITEM_ID
            AND SI.ORGANIZATION_ID = cs_item.inv_master_organization_id
            AND lin.sts_code = sts.code
            AND lin.lse_id NOT IN (1, 7, 8, 11, 35, 10, 12, 14, 19)
        UNION
        SELECT lin.id,
               lin.cle_id,
               lin.dnz_chr_id,
               To_Char(lin.id),
               To_Char(lin.cle_id),
               To_Char(lin.dnz_chr_id),
               lin.lse_id,
               (SELECT line_number
                  FROM okc_k_lines_b line
                 WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
               To_Number(NULL) customer_product_id,
               SI.name,
               SI.description,
               To_char(NULL) serial_number,
	       To_Char(NULL) system_name,
      	       lin.sts_code old_Status,
	             lin.sts_code undo_Status,
               sts.ste_code old_ste_code,
               lin.sts_code Status,
               sts.ste_code ste_code,
               lin.sts_code new_status,
               sts.ste_code new_ste_code,
               null,
               lin.start_date,
               lin.end_date,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.price_negotiated,
               -99 "top_lvl_parent"
          FROM okc_k_items    itm,
               okc_k_lines_b      lin,
               OKX_SYSTEM_ITEMS_V SI,
               okc_statuses_b     sts
         WHERE lin.id = itm.cle_id
           AND lin.dnz_chr_id = p_contract_id
           AND itm.object1_id1 = SI.id1
           AND SI.id2 = itm.object1_id2
           AND lin.sts_code = sts.code
           AND lin.lse_id = 7
        UNION
        SELECT lin.id,
               lin.cle_id,
               lin.dnz_chr_id,
               To_Char(lin.id),
               To_Char(lin.cle_id),
               To_Char(lin.dnz_chr_id),
               lin.lse_id,
               (SELECT line_number
                  FROM okc_k_lines_b line
                 WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
               To_Number(NULL) customer_product_id,
               SI.name,
               SI.description,
               To_char(NULL) serial_number,
	       To_Char(NULL) system_name,
	             lin.sts_code old_Status,
               lin.sts_code undo_Status,
               sts.ste_code old_ste_code,
               lin.sts_code Status,
               sts.ste_code ste_code,
               lin.sts_code new_status,
               sts.ste_code new_ste_code,
               null,
               lin.start_date,
               lin.end_date,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.price_negotiated,
               -99 "top_lvl_parent"
          FROM okc_k_items itm,
               okc_k_lines_b   lin,
               okx_parties_v   SI,
               okc_statuses_b  sts
         WHERE lin.id = itm.cle_id
           AND lin.dnz_chr_id = p_contract_id
           AND itm.object1_id1 = SI.id1
           AND SI.id2 = '#'
           AND lin.sts_code = sts.code
           AND lin.lse_id = 8
        UNION
        SELECT lin.id,
               lin.cle_id,
               lin.dnz_chr_id,
               To_Char(lin.id),
               To_Char(lin.cle_id),
               To_Char(lin.dnz_chr_id),
               lin.lse_id,
               (SELECT line_number
                  FROM okc_k_lines_b line
                 WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
               To_Number(NULL) customer_product_id,
               SI.party_site_number || '-' || NVL(SI.name, ' '),
               SI.description,
               To_char(NULL) serial_number,
	       To_Char(NULL) system_name,
	             lin.sts_code old_Status,
               lin.sts_code undo_Status,
               sts.ste_code old_ste_code,
               lin.sts_code Status,
               sts.ste_code ste_code,
               lin.sts_code new_status,
               sts.ste_code new_ste_code,
               null,
               lin.start_date,
               lin.end_date,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.price_negotiated,
               -99 "top_lvl_parent"
          FROM okc_k_items   itm,
               okc_k_lines_b     lin,
               okx_party_sites_v SI,
               okc_statuses_b    sts
         WHERE lin.id = itm.cle_id
           AND lin.dnz_chr_id = p_contract_id
           AND itm.object1_id1 = SI.id1
           AND SI.id2 = '#'
           AND lin.sts_code = sts.code
           AND lin.lse_id = 10
        UNION
        SELECT lin.id,
               lin.cle_id,
               lin.dnz_chr_id,
               To_Char(lin.id),
               To_Char(lin.cle_id),
               To_Char(lin.dnz_chr_id),
               lin.lse_id,
               (SELECT line_number
                  FROM okc_k_lines_b line
                 WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
               To_Number(NULL) customer_product_id,
               SI.name,
               SI.description,
               To_char(NULL) serial_number,
	       cstl.name system_name,
      	       lin.sts_code old_Status,
               lin.sts_code undo_Status,
               sts.ste_code old_ste_code,
               lin.sts_code Status,
               sts.ste_code ste_code,
               lin.sts_code new_status,
               sts.ste_code new_ste_code,
               null,
               lin.start_date,
               lin.end_date,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.price_negotiated,
               -99 "top_lvl_parent"
          FROM okc_k_items itm,
               okc_k_lines_b   lin,
               okx_systems_v   SI,
               okc_statuses_b  sts,
               CSI_SYSTEMS_TL CSTL
         WHERE lin.id = itm.cle_id
           AND lin.dnz_chr_id = p_contract_id
           AND itm.object1_id1 = SI.id1
           AND SI.id2 = '#'
           AND lin.sts_code = sts.code
           AND lin.lse_id = 11
	   AND si.id1 = cstl.system_id
           AND CSTL.LANGUAGE = UserEnv('LANG')
        UNION
        SELECT lin.id,
               lin.cle_id,
               lin.dnz_chr_id,
               To_Char(lin.id),
               To_Char(lin.cle_id),
               To_Char(lin.dnz_chr_id),
               lin.lse_id,
               (SELECT line_number
                  FROM okc_k_lines_b line
                 WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
               To_Number(NULL) customer_product_id,
               DECODE(c.account_name, NULL, p.party_name, c.account_name) name,
               c.account_number description,
               To_char(NULL) serial_number,
	       To_Char(NULL) system_name,
	             lin.sts_code old_Status,
               lin.sts_code undo_Status,
               sts.ste_code old_ste_code,
               lin.sts_code Status,
               sts.ste_code ste_code,
               lin.sts_code new_status,
               sts.ste_code new_ste_code,
               null,
               lin.start_date,
               lin.end_date,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.start_date,
               lin.end_date,
               lin.price_negotiated,
               lin.price_negotiated,
               -99 "top_lvl_parent"
          FROM okc_k_items  itm,
               okc_k_lines_b    lin,
               hz_cust_accounts c,
               hz_parties       p,
               okc_statuses_b   sts
         WHERE p.party_id = c.party_id
           AND c.cust_account_id = itm.object1_id1
           AND lin.id = itm.cle_id
           AND lin.dnz_chr_id = p_contract_id
           AND lin.sts_code = sts.code
           AND lin.lse_id = 35
         ORDER BY line_number;
Line: 3279

      /*SELECT ROWNUM, CASE
              WHEN cs_item.config_parent_id IS NULL THEN
               'Star Item'
              ELSE
               (SELECT To_Char(a.customer_product_id)
                  FROM oks_ib_config_v a
                 WHERE a.config_parent_id IS null
                 START WITH a.customer_product_id =
                            cs_item.customer_product_id
                CONNECT BY a.customer_product_id = PRIOR a.config_parent_id)
            END config_parent_id,
            lin.id,
            lin.cle_id,
            lin.dnz_chr_id,
            (SELECT line_number
               FROM okc_k_lines_b line
              WHERE line.id = lin.cle_id) || '.' || lin.line_number line_number,
            cs_item.customer_product_id,
            SI.name,
            SI.description,
            cs_item.serial_number,
            lin.sts_code Status,
            sts.ste_code ste_code,
            lin.sts_code new_status,
            sts.ste_code new_ste_code,
            null,
            lin.start_date,
            lin.end_date,
            lin.price_negotiated,
            CASE
              WHEN cs_item.config_parent_id IS NULL THEN
               -99
              ELSE
               (SELECT a.customer_product_id
                  FROM oks_ib_config_v a
                 WHERE a.config_parent_id IS null
                 START WITH a.customer_product_id =
                            cs_item.customer_product_id
                CONNECT BY a.customer_product_id = PRIOR a.config_parent_id)
            END top_lvl_parent,
            'N',
            'N'
       FROM okc_k_items      itm,
            okc_k_lines_b        lin,
            OKX_SYSTEM_ITEMS_V   SI,
            oks_ib_config_v cs_item,
            okc_statuses_b       sts
      WHERE itm.object1_id1 = cs_item.customer_product_id
        AND lin.id = itm.cle_id
        AND lin.dnz_chr_id = p_contract_id
        AND SI.id1 = cs_item.INVENTORY_ITEM_ID
        AND SI.ORGANIZATION_ID = cs_item.inv_master_organization_id
        AND lin.sts_code = sts.code
        ORDER BY To_Number((SELECT line_number
               FROM okc_k_lines_b line
              WHERE line.id = lin.cle_id)),To_Number(lin.line_number); */
Line: 3336

      UPDATE oks_sublines_temp
         SET top_lvl_parent = -99
       WHERE top_lvl_parent <> -99
         AND dnz_chr_id = p_contract_id
         AND top_lvl_parent NOT IN
             (SELECT customer_product_id
                FROM oks_sublines_temp
               WHERE dnz_chr_id = p_contract_id
                 AND Nvl(top_lvl_parent, -99) = -99
                 AND customer_product_id IS NOT NULL);
Line: 3355

  PROCEDURE MASS_UPDATE_CASCADE_SEL(p_contract_id NUMBER, x_error_records OUT NOCOPY VARCHAR2 ) IS

    CURSOR c_get_hdr_attrs IS
      SELECT cascade_selection,
             global_start_date,
             global_end_date,
             global_price_negotiated,
             global_status,
             (SELECT ste_code FROM okc_statuses_v WHERE code = global_status AND ROWNUM=1) global_status_code,
             global_reason_code,
             global_comments
        FROM oks_headers_temp
       WHERE chr_id = p_contract_id;
Line: 3379

      SELECT id, start_date, end_date, new_status, reason_code, comments, old_start_date, old_end_date, old_status
        FROM oks_lines_temp
       WHERE dnz_chr_id = p_contract_id
         AND (Nvl(select_flag,'N') = 'Y' OR Nvl(cascade_flag,'N') = 'Y');
Line: 3386

      SELECT id,
             customer_product_id,
             start_date,
             end_date,
             price_negotiated,
             new_status,
             reason_code,
             comments,
             old_start_date,
             old_end_date,
             old_status,
             old_price_negotiated
        FROM oks_sublines_temp sublines
        WHERE dnz_chr_id = p_contract_id
		    AND   top_lvl_parent = -99
        AND  (
              Nvl(select_flag,'N') = 'Y'
              OR Nvl(cascade_flag,'N') = 'Y'
              OR EXISTS (SELECT 1 FROM oks_lines_temp lines
                         WHERE lines.id = sublines.cle_id
                         AND   lines.dnz_chr_id = sublines.dnz_chr_id
                         AND   Nvl(lines.cascade_flag,'N') = 'Y' )
              );
Line: 3412

      SELECT id,
             customer_product_id,
             start_date,
             end_date,
             price_negotiated,
             new_status,
             reason_code,
             comments,
             old_start_date,
             old_end_date,
             old_status,
             old_price_negotiated
        FROM oks_sublines_temp sublineschild
        WHERE dnz_chr_id = p_contract_id
		    AND   top_lvl_parent <> -99
        AND  (
              Nvl(select_flag,'N') = 'Y'
              OR EXISTS (SELECT 1 FROM oks_lines_temp lines
                         WHERE lines.id = sublineschild.cle_id
                         AND   lines.dnz_chr_id = sublineschild.dnz_chr_id
                         AND   Nvl(lines.cascade_flag,'N') = 'Y' )
              OR EXISTS (SELECT 1 FROM oks_sublines_temp sublines
                         WHERE sublines.customer_product_id = sublineschild.top_lvl_parent
                         AND   sublines.dnz_chr_id = sublineschild.dnz_chr_id
                         AND   sublines.cle_id = sublineschild.cle_id
                         AND   Nvl(sublines.cascade_flag,'N') = 'Y' )
              );
Line: 3442

    WITH a AS (select Nvl(PRECISION,2) prc
    from FND_CURRENCIES c
    where  currency_code = (SELECT currency_code
                            FROM okc_k_headers_all_b WHERE ID = p_contract_id AND rownum=1))
    SELECT tmp.id,
           Decode(tmp.start_date, lin.start_date, 'N', 'Y') start_date_change,
           Decode(tmp.end_date, lin.end_date, 'N', 'Y') end_date_change,
           Decode(Round(tmp.price_negotiated,(SELECT prc FROM a)), Round(lin.price_negotiated,(SELECT prc FROM a)), 'N', 'Y') Price_change,
           Decode(tmp.new_status,
                  (SELECT sts.code
                   FROM okc_statuses_b sts
                   WHERE sts.code = lin.sts_code),
                  'N',
                  'Y') status_change
    FROM oks_sublines_temp tmp, okc_k_lines_b lin
    WHERE tmp.id = lin.id
     AND tmp.dnz_chr_id = p_contract_id;
Line: 3462

      SELECT tmp.id,
             Decode(tmp.start_date, lin.start_date, 'N', 'Y') start_date_change,
             Decode(tmp.end_date, lin.end_date, 'N', 'Y') end_date_change,
             Decode(tmp.new_status,
                    (SELECT sts.code
                       FROM okc_statuses_b sts
                      WHERE sts.code = lin.sts_code),
                    'N',
                    'Y') status_change
        FROM oks_lines_temp tmp, okc_k_lines_b lin
       WHERE tmp.id = lin.id
         AND tmp.dnz_chr_id = p_contract_id;
Line: 3476

    SELECT 'SOME_WITH_ERROR'
    FROM dual
    WHERE EXISTS (SELECT 1
                  FROM oks_lines_temp
                  WHERE dnz_chr_id = p_contract_id
                  AND   (start_dt_error_flag = 'Y' OR end_dt_error_flag = 'Y' OR status_error_flag = 'Y')
                  UNION
                  SELECT 1
                  FROM oks_sublines_temp
                  WHERE dnz_chr_id = p_contract_id
                  AND   (start_dt_error_flag = 'Y' OR end_dt_error_flag = 'Y' OR status_error_flag = 'Y'));
Line: 3501

      UPDATE oks_lines_temp
      SET start_date = nvl(l_global_start_date,start_date),
          end_date   = Nvl(l_global_end_date,end_date),
          new_status = Nvl(l_global_new_status,new_status),
          new_ste_code = Nvl(l_global_status_code,new_ste_code),
          reason_code = Nvl(l_global_reason_code, reason_code),
          comments = Nvl(l_global_comments, comments)
      WHERE dnz_chr_id = p_contract_id
      AND   id = line.id;
Line: 3515

      UPDATE oks_sublines_temp
      SET start_date = nvl(l_global_start_date,start_date),
          end_date   = Nvl(l_global_end_date,end_date),
          price_negotiated = Nvl(l_global_price, price_negotiated),
          new_status = Nvl(l_global_new_status,new_status),
          new_ste_code = Nvl(l_global_status_code,new_ste_code),
          reason_code = Nvl(l_global_reason_code, reason_code),
          comments = Nvl(l_global_comments, comments)
      WHERE dnz_chr_id = p_contract_id
      AND   id = subline.id;
Line: 3530

      UPDATE oks_sublines_temp
      SET start_date = nvl(l_global_start_date,start_date),
          end_date   = Nvl(l_global_end_date,end_date),
          price_negotiated = Nvl(l_global_price, price_negotiated),
          new_status = Nvl(l_global_new_status,new_status),
          new_ste_code = Nvl(l_global_status_code,new_ste_code),
          reason_code = Nvl(l_global_reason_code, reason_code),
          comments = Nvl(l_global_comments, comments)
      WHERE dnz_chr_id = p_contract_id
      AND   id = sublinechild.id;
Line: 3547

      UPDATE oks_sublines_temp tmp
         SET start_dt_eff_change_flag = modified.start_date_change,
             end_dt_eff_change_flag   = modified.end_date_change,
             price_change_flag        = modified.price_change,
             status_change_flag       = modified.status_change
       WHERE tmp.dnz_chr_id = p_contract_id
         AND tmp.id = modified.id;
Line: 3559

      UPDATE oks_lines_temp tmp
         SET start_dt_eff_change_flag = modified.start_date_change,
             end_dt_eff_change_flag   = modified.end_date_change,
             status_change_flag       = modified.status_change
       WHERE tmp.dnz_chr_id = p_contract_id
         AND tmp.id = modified.id;
Line: 3568

    UPDATE oks_lines_temp
       SET start_dt_error_flag = 'N',
           end_dt_error_flag   = 'N',
           status_error_flag   = 'N',
           st_dt_err_message = NULL,
           end_dt_err_message = NULL,
           status_err_message = NULL
     WHERE dnz_chr_id = p_contract_id;
Line: 3577

    UPDATE oks_sublines_temp
       SET start_dt_error_flag = 'N',
           end_dt_error_flag   = 'N',
           status_error_flag   = 'N',
           st_dt_err_message = NULL,
           end_dt_err_message = NULL,
           status_err_message = NULL
     WHERE dnz_chr_id = p_contract_id;
Line: 3588

    UPDATE oks_lines_temp
       SET undo_start_date = old_start_date,
           old_start_date = start_date
     WHERE dnz_chr_id = p_contract_id
       AND start_dt_eff_change_flag = 'Y'
       AND start_dt_error_flag = 'N';
Line: 3595

    UPDATE oks_lines_temp
       SET undo_start_date = old_start_date
     WHERE dnz_chr_id = p_contract_id
       AND start_dt_eff_change_flag = 'Y'
       AND start_dt_error_flag = 'Y';
Line: 3601

    UPDATE oks_lines_temp
       SET undo_end_date = old_end_date,
           old_end_date = end_date
     WHERE dnz_chr_id = p_contract_id
       AND end_dt_eff_change_flag = 'Y'
       AND end_dt_error_flag = 'N';
Line: 3608

    UPDATE oks_lines_temp
       SET undo_end_date = old_end_date
     WHERE dnz_chr_id = p_contract_id
       AND end_dt_eff_change_flag = 'Y'
       AND end_dt_error_flag = 'Y';
Line: 3614

    UPDATE oks_lines_temp
       SET undo_status = old_status,
           old_status = status
     WHERE dnz_chr_id = p_contract_id
       AND status_change_flag = 'Y'
       AND status_error_flag = 'N';
Line: 3621

    UPDATE oks_lines_temp
       SET undo_status = old_status
     WHERE dnz_chr_id = p_contract_id
       AND status_change_flag = 'Y'
       AND status_error_flag = 'Y';
Line: 3627

    UPDATE oks_sublines_temp
       SET undo_start_date = old_start_date,
           old_start_date = start_date
     WHERE dnz_chr_id = p_contract_id
       AND start_dt_eff_change_flag = 'Y'
       AND start_dt_error_flag = 'N';
Line: 3634

    UPDATE oks_sublines_temp
       SET undo_start_date = old_start_date
     WHERE dnz_chr_id = p_contract_id
       AND start_dt_eff_change_flag = 'Y'
       AND start_dt_error_flag = 'Y';
Line: 3640

    UPDATE oks_sublines_temp
       SET undo_end_date = old_end_date,
           old_end_date = end_date
     WHERE dnz_chr_id = p_contract_id
       AND end_dt_eff_change_flag = 'Y'
       AND end_dt_error_flag = 'N';
Line: 3647

    UPDATE oks_sublines_temp
       SET undo_end_date = old_end_date
     WHERE dnz_chr_id = p_contract_id
       AND end_dt_eff_change_flag = 'Y'
       AND end_dt_error_flag = 'Y';
Line: 3653

    UPDATE oks_sublines_temp
       SET undo_status = old_status,
           old_status = status
     WHERE dnz_chr_id = p_contract_id
       AND status_change_flag = 'Y'
       AND status_error_flag = 'N';
Line: 3660

    UPDATE oks_sublines_temp
       SET undo_status = old_status
     WHERE dnz_chr_id = p_contract_id
       AND status_change_flag = 'Y'
       AND status_error_flag = 'Y';
Line: 3666

    UPDATE oks_sublines_temp
    SET undo_price_negotiated = old_price_negotiated,
        old_price_negotiated = price_negotiated
    WHERE dnz_chr_id = p_contract_id
    AND price_change_flag = 'Y'
    AND top_lvl_parent <> -99;
Line: 3673

    UPDATE oks_headers_temp
       SET global_start_date       = NULL,
           global_end_date         = NULL,
           global_price_negotiated = NULL,
           global_status           = NULL,
           global_reason_code      = NULL,
           global_comments         = NULL,
           saved_flag              = 'Y'
     WHERE chr_id = p_contract_id;
Line: 3683

    UPDATE oks_sublines_temp
       SET select_flag = NULL,
		       cascade_flag = NULL
     WHERE dnz_chr_id = p_contract_id;
Line: 3688

    UPDATE oks_lines_temp lin
       SET select_flag      = NULL,
		       cascade_flag = NULL,
           price_negotiated = (SELECT Sum(price_negotiated)
                                 FROM oks_sublines_temp sub
                                WHERE sub.cle_id = lin.id)
     WHERE dnz_chr_id = p_contract_id;
Line: 3704

  END MASS_UPDATE_CASCADE_SEL;
Line: 3706

  PROCEDURE MASS_UPDATE_SUBMIT(p_contract_id IN NUMBER, x_req_id OUT NOCOPY VARCHAR2) IS

  l_request_id NUMBER;
Line: 3714

					                                         description       => 'Service Contracts Mass Update',
					                                         start_time        => NULL,
					                                         sub_request       => FALSE,
					                                         argument1         => p_contract_id
					                                         );
Line: 3720

        UPDATE oks_headers_temp
        SET saved_flag = 'N', request_id = l_request_id
        WHERE chr_id = p_contract_id;
Line: 3728

  END MASS_UPDATE_SUBMIT;
Line: 3730

  PROCEDURE delete_changes(p_contract_id NUMBER) IS
  BEGIN

  DELETE FROM oks_lines_temp WHERE dnz_chr_id = p_contract_id;
Line: 3734

  DELETE FROM oks_sublines_temp WHERE dnz_chr_id = p_contract_id;
Line: 3735

  DELETE FROM oks_headers_temp WHERE Chr_id = p_contract_id;
Line: 3738

  END delete_changes;