strTemp:=strTemp||','||'to_char('''||strdbcursor2||''')';

解决方案 »

  1.   

    strTemp:=strTemp||','||to_char(strdbcursor2);
      

  2.   

    我还是把代码贴全吧
    set serveroutput on size 1000000;
    declare 
      strdbcursor1 varchar2(50);strdbcursor2 varchar(50);strdbcursor3 varchar(5000);
      strTemp varchar2(500);
      cursor dbcursor1  is  select 表编码 from testmis.zbm_dict,testmis.zfl_dict  
      where 保密级别>1 and testmis.zbm_dict.分类编码=testmis.zfl_dict.分类编码 
      and testmis.zfl_dict.数据库编码='FXHY';
      cursor dbcursor2(strp varchar2) is select COLUMN_NAME from user_col_comments where upper(TABLE_NAME)=upper(strp);
    begin
      open dbcursor1;
      fetch dbcursor1 into strdbcursor1;
      while dbcursor1%found 
      loop   /* 读取表字段 */
       strTemp:='';
      open dbcursor2(strdbcursor1);
      fetch dbcursor2 into strdbcursor2;
    while dbcursor2%found
            loop
      if strTemp=''  then
        strTemp:='to_char('||strdbcursor2||')';
              else
           strTemp:=strTemp||','||'to_char('''||strdbcursor2||''')';
              end if;    fetch dbcursor2 into strdbcursor2;
            end loop;
    close dbcursor2;    
            DBMS_OUTPUT.PUT_LINE(strTemp);    fetch dbcursor1 into strdbcursor1;
      end loop;
      close dbcursor1;
    end; 
      

  3.   

    strTemp:=strTemp||','||to_char(strdbcursor2);
      

  4.   

    这为什么不对啊? PL/SQL: 数字或值错误
       strTemp:='convert('||strTemp||','||strdbcursor2||')';
    其中
    strdbcursor2 varchar(50);
       strTemp varchar2(500);