query1.sql.add('insert into DKH valus(select fname,fXH from users where usercode='free')');怎么不可以呀?好象问题就出在引号上了,谁帮我呀?这条语句必须要'FREE'的:
insert into DKH valus(select fname,fXH from users where usercode='free'

解决方案 »

  1.   

    query1.sql.add('insert into DKH values(select fname,fXH from users where usercode='free')');怎么不可以呀?好象问题就出在引号上了,谁帮我呀?这条语句必须要'FREE'的:
    insert into DKH values(select fname,fXH from users where usercode='free'//是values,而不是valus
      

  2.   

    query1.sql.add('insert into DKH values(select fname,fXH from users where  usercode='+quotedstr('free')+')');
      

  3.   

    另,可以将values去掉看看:query1.sql.add('insert into DKH select fname,fXH from users where  usercode='+quotedstr('free'));
      

  4.   

    pilicat:我立刻给你分.可以解释一下quotedstr的意思吗?
    还有我下一步是要在query1.sql.add中加一个块:
    declare
    v_Fname varchar2(15);
    v_FXH varchar2(10);
    cursor get_YYQ is select fname from DKH;
    begin
    open get_YYQ;
    loop
    fetch get_YYQ into v_fname;
    exit when get_YYQ%notfound;
    select fxh into v_fxh from xhe where v_fxh like fxh||'%' ;
    INSERT into DKH_total values(v_fname,v_fxh);
    commit;
    end loop;
    close get_YYQ;
    end;
    /我该怎么办?
    ===================
      

  5.   

    quotedstr是给字符串加上引号定界符
    如quotedstr('aaa')则返回字符串 'aaa'