本帖最后由 hwhtj 于 2013-05-15 09:04:59 编辑

解决方案 »

  1.   

    刚刚给你回的解密:declare
      v1 varchar2(10);
      v2 varchar2(10);
    begin
      for a in (select t.id, regexp_replace(t.xm, '\^1V6|V6', ',') xm from tb1 t) loop
      
        for b in (select regexp_substr(a.xm, '[^,]+', 1, level) xm
                    from dual
                  connect by level <= regexp_count(a.xm, ',')) loop
          --dbms_output.put_line(b.xm);
          select t.key into v1 from tb2 t where t.pas = b.xm;
          v2 := v2 || v1;
          --dbms_output.put_line(v2);
        end loop;
        update tb1 set tb1.xm = v2 where tb1.id = a.id;
        v2 := '';
      end loop;
      commit;
    end;
      

  2.   

    declare
      v1 varchar2(10);
      v2 varchar2(10);
    begin
      for a in (select t.id, regexp_replace(t.xm, '\^1V6|V6', ',') xm from ustb t) loop
       
        for b in (select regexp_substr(a.xm, '[^,]+', 1, level) xm
                    from dual
                  connect by level <= regexp_count(a.xm, ',')) loop
          --dbms_output.put_line(b.xm);
          select t.key into v1 from tb2 t where t.pas = b.xm;
          v2 := v2 || v1;
          --dbms_output.put_line(v2);
        end loop;
        update tb1 set tb1.xm = v2 where tb1.id = a.id;
        v2 := '';
      end loop;
      commit;
    end;
      

  3.   

    我知道了,我用的是oracle 10G,没有regexp_count