Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to send email using pl/sql containing the result set as the msg body

941425Jun 12 2012 — edited Jun 13 2012
Hi.. im using Pl/SQL code to send emails to the users from a dataset that is obtained in a databse table. i have used utl_smtp commands to establish the connection with the smtp mail server. im stuck at the logic when i have to include the message body which is actually the result set of a table.. For instance

IF (p_message = 0) THEN
UTL_SMTP.write_data(l_mail_conn, 'There is no mismatch between the codes' || UTL_TCP.crlf);
ELSE
UTL_SMTP.write_data(l_mail_conn, 'The missing codes are ' || UTL_TCP.crlf);
for s in (select * from temp)
loop
UTL_SMTP.write_data(l_mail_conn, ' ' ||s || UTL_TCP.crlf);
end loop;
END IF;

UTL_SMTP.close_data(l_mail_conn);
UTL_SMTP.quit(l_mail_conn);
END;

***p_message is a prameter passed to this procedure..

Can i obtain the result in the form i have it in my table. which has three columns. I want to display the three columns as it is with teh records. ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2012
Added on Jun 12 2012
4 comments
1,875 views