Home > front end >  ORACLE PL/sql SEND_ATTACH_VARCHAR2 the first line of the attachment is empty
ORACLE PL/sql SEND_ATTACH_VARCHAR2 the first line of the attachment is empty

Time:07-21

I need to send email with csv attachment. Im trying to use UTL_MAIL.SEND_ATTACH_VARCHAR2 and its working, but first row is always empty. (contains CRLF).

How to remove this empty row? Why does Oracle put CRLF characters on the first line?

Thanks everyone for the advice.

PROCEDURE SEND_CSV_ATTACHMENT2  AS
   v_sender                VARCHAR2(130);
   v_attachment            CLOB := 'xas';

 BEGIN

     v_sender := '[email protected]';
     
     UTL_MAIL.send_attach_varchar2(sender => v_sender,
     recipients        => '[email protected]',

     subject           => 'some subject',
     message           =>  'some message',
     mime_type         => 'text/html', -- send html e-mail
     attachment        => v_attachment, 
     att_inline        => false,
     att_mime_type => 'text',
     att_filename      => 'someName.csv');      

END SEND_CSV_ATTACHMENT2; 

enter image description here enter image description here

CodePudding user response:

As per MOS document (Doc ID 1289825.1) this is a bug.

The workaround given is the below

Use the following work around while awaiting bug fix

Replace UTL_MAIL.SEND_ATTACH_VARCHAR2 with UTL_MAIL.SEND_ATTACH_RAW

Please check and let me know if your issue is fixed or if any help is required with SEND_ATTACH_RAW.

  • Related