I'm able to create 1 CSV file from my plsql code basically i'm using 2 cursors to get data and then populating it to csv. But my Problem is since 1 csv is made or completed the 2nd cursor data also goes to the same csv file I want to put that into another csv.
Part of my code:-
-- 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 ');