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