oracle declare


declare
  l_cust_id     number(10) := 0;
  l_person_id   number(10) := 0;
begin
  DBMS_OUTPUT.ENABLE(buffer_size => null); --表示輸出buffer不受限制
  for lr in (SELECT temp.customer_name, temp.assign_persion_name
               from CUSTOMER_ASSIGN_TEMP temp) loop
      --dbms_output.put_line(lr.customer_name||'|'||lr.assign_persion_name);
      begin
        select hz.party_id
          into l_cust_id
          from hz_parties hz
         where trim(hz.party_name) = trim(lr.customer_name)
           and rownum = 1;
        update CUSTOMER_ASSIGN_TEMP cust
           set cust.cust_party_id = l_cust_id where trim(cust.customer_name)=trim(lr.customer_name);
      exception
        when No_data_found then
          dbms_output.put_line(trim(lr.customer_name) || '-客戶名稱不正確');
      end;
       begin
        select emp.PERSON_ID
          into l_person_id
          from web_employees_v emp
         where emp.CHINESE_NAME = lr.assign_persion_name
           and rownum = 1;
        update CUSTOMER_ASSIGN_TEMP custp
           set custp.assign_persion_id = l_person_id where trim(custp.customer_name)=trim(lr.customer_name);
      exception
        when No_data_found then
          dbms_output.put_line(lr.assign_persion_name || '-人員名稱不正確');
      end;
     commit;
    end loop;
  end;

----調用

declare
l_code varchar2(1000);
begin
    pro_syn_customer_ecp('Y',l_code);
dbms_output.put_line(l_code);
end;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM