我使用BFILENAME命令上传一个文件到BLOB中,创建目录的SQL语句如下:    /*确定目录 否存在,如果不存在,则创建*/
    select count(*) into directoryNum from all_directories where directory_name = upper(path);
    
    if directoryNum<>0 then/*如果目录存在,则先将此目录删除*/
        tmpSql:='drop directory '||path;
        execute immediate tmpSql;
    end if;如果文件路径path全部为英文,则一切正常(包括上传文件),但如果文件路径path为中文,则不能创建,并显示错误,如何解决?

解决方案 »

  1.   

    SQL>create or replace directory 真的还是假的 as 'D:\中文路径';
    SQL> DECLARE
      2    v_sql VARCHAR2(2000);
      3  BEGIN
      4    v_sql := 'drop directory  真的还是假的';
      5    EXECUTE IMMEDIATE v_sql;
      6  END;
      7  /
     
    PL/SQL procedure successfully completed.
    以上是我在Oracle10中做的测试,不存在你说的问题,不知道哦怎么回事。
      

  2.   

    我的SQL全语句如下:tmpSql:='create directory cjsTempFilePath as '  ||''''||filePath||''''; --用引号括起路径 
        execute immediate tmpSql;filePath中如果有英文,则报错。
      

  3.   

    我使用C#编程,在VS2005中,filePath定义如下:    
    pFileParm[2] = new OracleParameter("filePath", OracleType.VarChar); //文件路径
                pFileParm[2].Direction = ParameterDirection.Input;
                pFileParm[2].Value = strPath;在Oracle中,使用
    tmpSql:='create directory cjsTempFilePath as '  ||''''||filePath||'''';
        execute immediate tmpSql; 
    语句来创建directory 。
    当VS调用ORACLE中的存储过程时,报错是:ORA-06502: PL/SQL: 数字或值错误 :  字符串缓冲区太小。
      

  4.   

    ORA-06502: PL/SQL: 数字或值错误 :  字符串缓冲区太小。你上面有报这个错
    有可能不光是字符集的问题
    你试试看把变量设的大一些试试