我可以从我的 plsql 代码创建 1 个 CSV 文件,基本上我使用 2 个游标来获取数据,然后将其填充到 csv 中。但我的问题是,由于制作或完成了 1 个 csv,第二个光标数据也进入了我想将其放入另一个 csv 的同一个 csv 文件。
我的部分代码:-
-- mail header
dbms_output.put_line('here3');
utl_smtp.open_data(l_mail_conn);
utl_smtp.write_data(l_mail_conn, 'MIME-version: 1.0' || CRLF || 'From: ' || 'no_reply@ ' || CRLF ||
'Subject: ' || l_subject || CRLF || 'To: ' || l_recipient || CRLF || 'Content-Type: multipart/mixed; boundary=' || fnd_global.local_chr(34) || l_boundary || fnd_global.local_chr(34)
|| CRLF || 'This is a multi-part message in MIME format.' || CRLF || CRLF || '--' || l_boundary || CRLF || 'Content-Type: text/html; charset=UTF-8' || CRLF || 'Content-Transfer-Encoding: 7bit' || CRLF);
-- body of mail
utl_smtp.write_data(l_mail_conn, l_stylesheet);
utl_smtp.write_data(l_mail_conn, 'Please find attached Report. ' || '<br /><br />Regards,' || CRLF || '<br /> Team');
utl_smtp.write_data(l_mail_conn, '</body></html>');
utl_smtp.write_data(l_mail_conn, CRLF || CRLF || CRLF || '--' || l_boundary || CRLF);
---populate data in csv
utl_smtp.write_data(l_mail_conn, 'Content-Type:application/vnd.ms-excel;
name="' || ' Report.csv"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="' || l_instance || ' - ' || ' - eport.csv"' || CRLF || CRLF);
utl_smtp.write_data(l_mail_conn, '"Column1"'||CRLF44||'"Column2"'||CRLF44||'"Column3"'||CRLF44||'"Column4"'||CRLF);
log_message(' Writing data to report ');