我使用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.   

    在使用oracle或其他应用程序时,指定路径中一定不要带中文,这样任意出错,并且你不好发现。
      

  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.   

    你修改成这样看看。
    tmpSql:='create directory cjsTempFilePath as '||chr(39)||filePath||chr(39); 
      

  5.   

    在Oracle中,使用 
    tmpSql:='create directory cjsTempFilePath as '  ||''''||filePath||''''; 
        execute immediate tmpSql; 
    语句来创建directory 。 
    当VS调用ORACLE中的存储过程时,报错是:ORA-06502: PL/SQL: 数字或值错误 :  字符串缓冲区太小
    看上面的报错是:ORA-06502: PL/SQL: 数字或值错误 :  字符串缓冲区太小你的变量tmpSql定义的长度是多少?是不是赋给该变量的值超过了,该变量定义的长度了。建议把该变量tmpSql的大小设置大一点。tmpSql VARCHAR2(2000);