for-l oop не работает для приведенной ниже переменной типа записи в операторе выбора - PullRequest
0 голосов
/ 24 марта 2020

Пожалуйста, обратитесь к приведенному ниже коду, и я ожидаю, что l oop оператор выбора ниже, который должен быть передан в API как тип записи, который уже объявлен.

  BEGIN -- ap_vendors_pkg.update_row
fnd_file.put_line(fnd_file.log,'8 Update API-' || to_char(Sysdate,'MM/DD/YYYY HH:MI:SS'));

         fnd_file.put_line(fnd_file.log,'Start- Venor Update for :'||Vendor_Cursor(i).vendor_name);


      for (SELECT decode(l_vendor_rec.allow_awt_flag, ap_null_char, NULL, nvl(l_vendor_rec.allow_awt_flag, allow_awt_flag))
                ,decode(l_vendor_rec.allow_substitute_receipts_flag, ap_null_char, NULL, nvl(l_vendor_rec.allow_substitute_receipts_flag, allow_substitute_receipts_flag))
                ,decode(l_vendor_rec.allow_unordered_receipts_flag,
                    ap_null_char, NULL,
                    nvl(l_vendor_rec.allow_unordered_receipts_flag,
                        allow_unordered_receipts_flag))
                ,decode(l_vendor_rec.always_take_disc_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.always_take_disc_flag,
                        always_take_disc_flag))
                ,decode(l_vendor_rec.attribute_category,
                    ap_null_char, NULL,
                    nvl(l_vendor_rec.attribute_category,
                        attribute_category))
                ,decode(l_vendor_rec.attribute1,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute1, attribute1))
                ,decode(l_vendor_rec.attribute10,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute10, attribute10))
                ,decode(l_vendor_rec.attribute11,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute11, attribute11))
                ,decode(l_vendor_rec.attribute12,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute12, attribute12))
                ,decode(l_vendor_rec.attribute13,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute13, attribute13))
                ,decode(l_vendor_rec.attribute14,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute14, attribute14))
                ,decode(l_vendor_rec.attribute15,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute15, attribute15))
                ,decode(l_vendor_rec.attribute2,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute2, attribute2))
                ,decode(l_vendor_rec.attribute3,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute3, attribute3))
                ,decode(l_vendor_rec.attribute4,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute4, attribute4))
                ,decode(l_vendor_rec.attribute5,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute5, attribute5))
                ,decode(l_vendor_rec.attribute6,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute6, attribute6))
                ,decode(l_vendor_rec.attribute7,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute7, attribute7))
                ,decode(l_vendor_rec.attribute8,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute8, attribute8))
                ,decode(l_vendor_rec.attribute9,
                    ap_null_char, NULL,
                   nvl(l_vendor_rec.attribute9, attribute9))
                ,decode(l_vendor_rec.auto_calculate_interest_flag,
                    ap_null_char, NULL,
                    nvl(l_vendor_rec.auto_calculate_interest_flag,
                        auto_calculate_interest_flag))
                ,decode(l_vendor_rec.awt_group_id,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.awt_group_id,
                        awt_group_id))
                ,decode(l_vendor_rec.bank_charge_bearer,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.bank_charge_bearer,
                        bank_charge_bearer))
                ,decode(l_vendor_rec.check_digits,
                    ap_null_char, NULL,
                    nvl(l_vendor_rec.check_digits,
                        check_digits))
                ,decode(l_vendor_rec.create_debit_memo_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.create_debit_memo_flag,
                        create_debit_memo_flag))
                ,decode(l_vendor_rec.customer_num,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.customer_num,
                        customer_num))
                ,decode(l_vendor_rec.days_early_receipt_allowed,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.days_early_receipt_allowed,
                        days_early_receipt_allowed))
                ,decode(l_vendor_rec.days_late_receipt_allowed,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.days_late_receipt_allowed,
                        days_late_receipt_allowed))
                ,decode(l_vendor_rec.employee_id,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.employee_id,
                        employee_id))
                ,decode(l_vendor_rec.enabled_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.enabled_flag,
                        enabled_flag))
                ,decode(l_vendor_rec.end_date_active,
                    ap_null_date,NULL,
                    nvl(l_vendor_rec.end_date_active,
                        end_date_active))
                ,decode(l_vendor_rec.enforce_ship_to_location_code,
                    ap_null_char, NULL,
                    nvl(l_vendor_rec.enforce_ship_to_location_code,
                        enforce_ship_to_location_code ))
                ,decode(l_vendor_rec.exclude_freight_from_discount,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.exclude_freight_from_discount,
                        exclude_freight_from_discount))
                ,decode(l_vendor_rec.federal_reportable_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.federal_reportable_flag,
                        federal_reportable_flag))
                ,decode(l_vendor_rec.global_attribute_category,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute_category,
                        global_attribute_category))
                ,decode(l_vendor_rec.global_attribute1,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute1,
                        global_attribute1))
                ,decode(l_vendor_rec.global_attribute2,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute2,
                        global_attribute2))
                ,decode(l_vendor_rec.global_attribute3,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute3,
                        global_attribute3))
                ,decode(l_vendor_rec.global_attribute4,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute4,
                        global_attribute4))
                ,decode(l_vendor_rec.global_attribute5,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute5,
                        global_attribute5))
                ,decode(l_vendor_rec.global_attribute6,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute6,
                        global_attribute6))
                ,decode(l_vendor_rec.global_attribute7,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute7,
                        global_attribute7))
                ,decode(l_vendor_rec.global_attribute8,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute8,
                        global_attribute8))
                ,decode(l_vendor_rec.global_attribute9,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute9,
                        global_attribute9))
                ,decode(l_vendor_rec.global_attribute10,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute10,
                        global_attribute10))
                ,decode(l_vendor_rec.global_attribute11,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute11,
                        global_attribute11))
                ,decode(l_vendor_rec.global_attribute12,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute12,
                        global_attribute12))
                ,decode(l_vendor_rec.global_attribute13,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute13,
                        global_attribute13))
                ,decode(l_vendor_rec.global_attribute14,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute14,
                        global_attribute14))
                ,decode(l_vendor_rec.global_attribute15,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute15,
                        global_attribute15))
                ,decode(l_vendor_rec.global_attribute16,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute16,
                        global_attribute16))
                ,decode(l_vendor_rec.global_attribute17,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute17,
                        global_attribute17))
                ,decode(l_vendor_rec.global_attribute18,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute18,
                        global_attribute18))
                ,decode(l_vendor_rec.global_attribute19,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute19,
                        global_attribute19))
                ,decode(l_vendor_rec.global_attribute20,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.global_attribute20,
                        global_attribute20))
                ,decode(l_vendor_rec.hold_all_payments_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.hold_all_payments_flag,
                        hold_all_payments_flag))
                ,decode(l_vendor_rec.hold_by,
                    ap_null_num, NULL,
                    nvl(l_vendor_rec.hold_by, hold_by))
                ,decode(l_vendor_rec.hold_date,
                    ap_null_date,NULL,
                    nvl(l_vendor_rec.hold_date, hold_date))
                ,decode(l_vendor_rec.hold_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.hold_flag, hold_flag))
                ,decode(l_vendor_rec.hold_future_payments_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.hold_future_payments_flag,
                        hold_future_payments_flag))
                ,decode(l_vendor_rec.hold_reason,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.hold_reason, hold_reason))
                ,decode(l_vendor_rec.hold_unmatched_invoices_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.hold_unmatched_invoices_flag,
                        hold_unmatched_invoices_flag))
                ,decode(l_vendor_rec.inspection_required_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.inspection_required_flag,
                        inspection_required_flag ))
                ,decode(l_vendor_rec.invoice_amount_limit,
                    ap_null_num, NULL,
                    nvl(l_vendor_rec.invoice_amount_limit,
                        invoice_amount_limit))
                ,decode(l_vendor_rec.invoice_currency_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.invoice_currency_code,
                        invoice_currency_code))
                ,decode(l_vendor_rec.match_option,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.match_option, match_option))
                ,decode(l_vendor_rec.min_order_amount,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.min_order_amount,
                        min_order_amount))
                ,decode(l_vendor_rec.minority_group_lookup_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.minority_group_lookup_code,
                        minority_group_lookup_code))
                ,decode(l_vendor_rec.name_control,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.name_control, name_control))
                ,decode(l_vendor_rec.one_time_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.one_time_flag, one_time_flag ))
                ,decode(l_vendor_rec.organization_type_lookup_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.organization_type_lookup_code,
                        organization_type_lookup_code))
                ,decode(l_vendor_rec.parent_vendor_id,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.parent_vendor_id,
                        parent_vendor_id))
                ,decode(l_vendor_rec.parent_party_id,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.parent_party_id,
                        parent_party_id))
                ,decode(l_vendor_rec.party_id,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.party_id, party_id))
                ,decode(l_vendor_rec.pay_date_basis_lookup_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.pay_date_basis_lookup_code,
                        pay_date_basis_lookup_code))
                ,decode(l_vendor_rec.pay_group_lookup_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.pay_group_lookup_code,
                        pay_group_lookup_code))
                ,decode(l_vendor_rec.payment_currency_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.payment_currency_code,
                        payment_currency_code))
                ,decode(l_vendor_rec.payment_priority,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.payment_priority,
                        payment_priority))
                ,decode(l_vendor_rec.purchasing_hold_reason,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.purchasing_hold_reason,
                        purchasing_hold_reason))
                ,decode(l_vendor_rec.qty_rcv_exception_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.qty_rcv_exception_code,
                        qty_rcv_exception_code))
                ,decode(l_vendor_rec.qty_rcv_tolerance,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.qty_rcv_tolerance,
                        qty_rcv_tolerance))
                ,decode(l_vendor_rec.receipt_days_exception_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.receipt_days_exception_code,
                        receipt_days_exception_code))
                ,decode(l_vendor_rec.receipt_required_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.receipt_required_flag,
                        receipt_required_flag))
                ,decode(l_vendor_rec.receiving_routing_id,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.receiving_routing_id,
                        receiving_routing_id))
                ,decode(l_vendor_rec.segment1,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.segment1, segment1 ))
                ,decode(l_vendor_rec.segment2,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.segment2, segment2 ))
                ,decode(l_vendor_rec.segment3,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.segment3, segment3 ))
                ,decode(l_vendor_rec.segment4,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.segment4, segment4 ))
                ,decode(l_vendor_rec.segment5,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.segment5, segment5 ))
                ,v_set_of_books_id
                ,decode(l_vendor_rec.small_business_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.small_business_flag,
                        small_business_flag ))
                ,decode(l_vendor_rec.start_date_active,
                    ap_null_date,NULL,
                    nvl(l_vendor_rec.start_date_active,
                        start_date_active))
                ,decode(l_vendor_rec.state_reportable_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.state_reportable_flag,
                        state_reportable_flag))
                ,decode(l_vendor_rec.summary_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.summary_flag, summary_flag))
                ,decode(l_vendor_rec.tax_reporting_name,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.tax_reporting_name,
                        tax_reporting_name))
                ,decode(l_vendor_rec.tax_verification_date,
                    ap_null_date,NULL,
                    nvl(l_vendor_rec.tax_verification_date,
                        tax_verification_date))
                ,decode(l_vendor_rec.terms_date_basis,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.terms_date_basis,
                        terms_date_basis))
                ,v_term_id
                ,decode(l_vendor_rec.jgzz_fiscal_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.jgzz_fiscal_code,nvl(individual_1099,num_1099)))
                ,decode(l_vendor_rec.type_1099,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.type_1099, type_1099))
        ,decode(l_vendor_rec.validation_number,
                    ap_null_num,NULL,
                    nvl(l_vendor_rec.validation_number,
                                        validation_number))
        ,decode(l_vendor_rec.vendor_type_lookup_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.vendor_type_lookup_code,
                                        vendor_type_lookup_code))
        ,decode(l_vendor_rec.withholding_start_date,
                    ap_null_date,NULL,
                    nvl(l_vendor_rec.withholding_start_date,
                                        withholding_start_date))
        ,decode(l_vendor_rec.withholding_status_lookup_code,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.withholding_status_lookup_code,
                                        withholding_status_lookup_code))
        ,decode(l_vendor_rec.women_owned_flag,
                    ap_null_char,NULL,
                    nvl(l_vendor_rec.women_owned_flag,women_owned_flag))
                ,NULL
                  ,decode(l_vendor_rec.ni_number,
                        ap_null_char,NULL,l_vendor_rec.ni_number)
                ,l_rowid
        FROM apps.ap_suppliers 
        WHERE vendor_id = v_vendor_id).a  .. a.count     
        loop

        ap_vendors_pkg.update_row(
                p_vendor_rec => l_vendor_rec,
                p_last_update_date => sysdate,
                p_last_updated_by => l_user_id,
                p_last_update_login => l_last_update_login,
                p_request_id => l_request_id ,
                p_program_application_id => l_program_application_id,
                p_program_id => l_program_id,
                p_program_update_date => sysdate,
                p_rowid => l_rowid,
                p_vendor_id => v_vendor_id);



        fnd_file.put_line(fnd_file.log,'Vendor details has been updated in AP_SUPPLIERS table for vendor ='||v_vendor_id);

        update APPS.HZ_PARTIES
        set party_name = trim(Vendor_Cursor(i).vendor_name),
            last_update_date = SYSDATE,
         ----   Last_Updated_By = trim(Vendor_Cursor(i).last_updated_by) ----removed by abhishek on 12/3/19
          Last_Updated_By = l_user_id  --- Added by Abhishek on 12/3/2019
        where party_id = (select party_id from apps.ap_suppliers where vendor_id  = v_vendor_id);

        fnd_file.put_line(fnd_file.log,'Party Name has been updated for Vendor ='||v_vendor_id);

        COMMIT;

        -----Need to check if exception handle

         fnd_file.put_line(fnd_file.log,'End of vendor update row API For Vendor id ='||v_vendor_id);
         fnd_file.put_line(fnd_file.log,'******************************************************');
      UPDATE phs_ap.phs_po_vendors_interface
          SET   interface_status = 'P'
          WHERE vendor_name_alt = trim(Vendor_Cursor(i).vendor_name_alt)
          AND source = UPPER(trim(p_source))
          AND global_attribute1 = TO_CHAR(p_err_id)
          AND global_attribute2 = UPPER(trim(p_job_nbr))
          AND interface_status IS NULL;--rk20Jun

fnd_file.put_line(fnd_file.log,'9 After API-' || to_char(Sysdate,'MM/DD/YYYY HH:MI:SS'));
end loop;
      v_count := v_count+1;
...