Home » SQL & PL/SQL » SQL & PL/SQL » SQL output to HTML table in email notification - possible?
SQL output to HTML table in email notification - possible? [message #633149] Wed, 11 February 2015 11:13 Go to next message
RGall320
Messages: 1
Registered: February 2015
Location: Pennsylvaia
Junior Member
Hello. I am working on a notification sent via /usr/ucb/mail. The notification is an anonymous script. Some of the records within the notification are not aligning up nicely. We have the columns for Invoice Number and Invoice Amount.
I am being asked if it's possible to output the records to a HTML table because of the alignment issue.
I am trying the following code:


vfile_buffer := ('<p>And this is my header</p>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('<table border="1">');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('<tr>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('<td>Inv Numtd>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('<td>Invoice Amt</td>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('</tr>');
utl_file.put_line(vfile_handler, vfile_buffer);
for x in my_data
loop
vfile_buffer := ('<tr>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('<td>' || x.invoice_num || '</td>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('<td>' || x.invoice_date || '</td>');
utl_file.put_line(vfile_handler, vfile_buffer);
vfile_buffer := ('</tr>');
utl_file.put_line(vfile_handler, vfile_buffer);
end loop;
vfile_buffer := ('</table>');
utl_file.put_line(vfile_handler, vfile_buffer);


But in the notification, it's showing the actual wordings - - it's not converting to a HTML table.
Any thoughts on if this is possibe?
Thanks!
Re: SQL output to HTML table in email notification - possible? [message #633156 is a reply to message #633149] Wed, 11 February 2015 12:21 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Nothing to do with Oracle.
Depending on your OS/implementation of mail(tool) specify the content-type

mahesh@kanada ~$ mailx -a "Content-Type: text/html" -s "test" some@mail.com <<EOF
this
<p><i>this is html</i></p>
EOF
Previous Topic: Spliting of String
Next Topic: blog image display in utl_mail
Goto Forum:
  


Current Time: Thu Apr 18 08:40:30 CDT 2024