DECLARE
attachments shr_pkg_send_mail.array_attachments:=shr_pkg_send_mail.array_attachments();
b_input_file BFILE:= BFILENAME('mount_dir', 'test02.txt');
c_output_file CLOB;
BEGIN
--DBMS_OUTPUT.PUT_LINE(c_output_file);
dbms_lob.open(b_input_file, DBMS_LOB.LOB_READONLY);
-- DBMS_OUTPUT.PUT_LINE('1');
dbms_lob.createtemporary(lob_loc => c_output_file, cache => false);
--DBMS_OUTPUT.PUT_LINE('2');
dbms_lob.open(c_output_file, DBMS_LOB.LOB_READWRITE);
--DBMS_OUTPUT.PUT_LINE('3');
dbms_lob.loadfromfile(c_output_file, b_input_file, DBMS_LOB.LOBMAXSIZE);
--DBMS_OUTPUT.PUT_LINE('4');
dbms_lob.close(b_input_file);
--DBMS_OUTPUT.PUT_LINE('5');
attachments.extend(1);
attachments(1).attach_name := 'test02.txt';
attachments(1).data_type := 'text/plain';
attachments(1).attach_content := c_output_file; SHR_PKG_SEND_MAIL.SEND_MAIL('EthicsandComplianceITSupport_ORG@dl.mgd.novartis.com','mansi.kekre@novartis.com','test','test',attachments => attachments);
dbms_lob.close(c_output_file);
END ;
ERROR
ORA-22285:FILEOPEN操作不存在的目录或文件
ORA-06512:at" SYS.DBMS_LOB",1014行
ORA-06512:第8行
答案 0 :(得分:0)
获取目录路径
select directory_path from all_directories where directory_name='MOUNT_DIR'
检查数据库服务器上是否存在此路径,并且oracle具有读取权限。
检查文件'test02.txt'是否在此路径中退出且可以访问。
授予此目录
GRANT READ, WRITE ON DIRECTORY MOUNT_DIR TO <some_user>;
here是有趣的,如何使用select查看目录中的文件,但您应该有权访问SYS用户。