plsql - send mail with existing file as attachments using oracle procedure -


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: non-existent directory or file fileopen operation

ora-06512: @ "sys.dbms_lob", line 1014

ora-06512: @ line 8

get directory path

select directory_path all_directories directory_name='mount_dir'  

check if path exists on database server , oracle has read access it.

check if file 'test02.txt' exits in path , accessible.

give grants directory

grant read, write on directory mount_dir <some_user>; 

and here interesting, how see files in directory select, should have access sys user.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -