请大家帮忙看下哪里写错了,执行报错:无效字符
declare
v_tablename varchar2(500):='HRM_ChangeInspect,HRM_ChangeInspReg,';
v_str varchar2(500);
v_updateinfo varchar2(500);
begin
  while instr(v_tablename,',')>0 loop
  v_str:=substr(v_tablename,1,instr(v_tablename,',')-1);
  v_updateinfo:=v_updateinfo||'update '||v_str||' set WFTopic=replace(WFTopic,substr(WFTopic,2,1),''*'');';
  --dbms_output.put_line(v_updateinfo);
  execute immediate v_updateinfo;
  v_tablename:=substr(v_tablename,instr(v_tablename,',')+1,length(v_tablename));
  end loop;
end;dbms_output.put_line(v_updateinfo);
出来的语句可以正常执行

解决方案 »

  1.   

    用plsql的调试工具一步一步调试,看是哪里出错了
      

  2.   

    execute immediate v_updateinfo;
    提示我这行错了。declare
    v_tablename varchar2(500):='HRM_ChangeInspect,HRM_ChangeInspReg,';
    v_str varchar2(500);
    v_updateinfo varchar2(500);
    begin
      while instr(v_tablename,',')>0 loop
      v_str:=substr(v_tablename,1,instr(v_tablename,',')-1);
      v_updateinfo:='update '||v_str||' set WFTopic=replace(WFTopic,substr(WFTopic,2,1),''*'');';
      --dbms_output.put_line(v_updateinfo);
      execute immediate v_updateinfo;
      v_tablename:=substr(v_tablename,instr(v_tablename,',')+1,length(v_tablename));
      end loop;
    end;
      

  3.   

     v_updateinfo:=v_updateinfo||'update '||v_str||' set WFTopic=replace(WFTopic,substr(WFTopic,2,1),''*'');'分号不要!
      

  4.   

    嗯,分号去掉就可以执行了,O(∩_∩)O谢谢啦!
    oracle语句不是都以分号结束的吗?