PLSQL:以写模式打开文件

问题描述:

这可能很简单,但是我还是要问:

It is probably something simple but I ask it anyway :

我想以写模式(不附加)弹出文件,它从头开始.如果该文件不存在,则应创建它.

I want to popen a file in write mode (not appending), it starts from the beginning. If the file does not exist, it should be created it.

我尝试过:

ficErrors := UTL_FILE.FOPEN(myDirectory, errorsFilename, 'W');

我遇到此错误:

ORA-29283在"SYS.UTL_FILE"处的文件操作ORA-06512无效

ORA-29283 invalid file operation ORA-06512 at "SYS.UTL_FILE"

ty

基于您的错误,我认为您应该检查当前用户的目录权限.
GRANT READ/WRITE ON DIRECTORY myDirectory TO yourUser;

Based on your error, I think you should check directory permission for your current user.
GRANT READ/WRITE ON DIRECTORY myDirectory TO yourUser;

更新:如果您已经设置了数据库权限,则需要检查操作系统权限.请检查操作系统权限以及所有父目录.

Update: If you have already set database permission, need to check OS permission. Please check OS permission and all parent directories as well.