嗨,我有以下 html 片段,我想在我的程序中通过电子邮件发送。如何将它放在我的 UTL_MAIL 的消息属性中。我应该把它放在一些变量中,如果是这样的话怎么办?
如果有更好的方法,我也很想探索。下面有两个选项。我无法使 MESSAGE 属性起作用。
OPTION 1
DECLARE
BEGIN
UTL_MAIL.SEND (
sender => 'xxx@yyy',
recipients => 'abc@xyz',
subject => 'Hi',
MESSAGE =>
OWA_UTIL.cellsprint (p_theQuery =>'SELECT a1,b1,c1,d1
FROM test1
WHERE a1 > 1
ORDER BY a1',
p_max_rows=>'10',p_format_numbers => NULL),
mime_type => 'text/html; charset=us-ascii');
END;
----------------------------------------------------------------
OPTION2
Declare
Begin
....
......
UTL_MAIL.SEND (
sender => 'xxx@yyy',
recipients => 'abc@xyz',
subject => 'Hi',
MESSAGE => ***
mime_type => 'text/html; charset=us-ascii');
***
HTP.P ('<HTML>');
HTP.P ('<HEAD>');
HTP.P ('<TITLE>Duplicate Records</TITLE>');
HTP.P ('</HEAD>');
HTP.P ('<BODY>');
HTP.P ('<H1>Duplicate Records</H1>');
HTP.P ('<TABLE BORDER="1 ">');
HTP.P ('<TR><TH>HIERARCHY</TH><TH>Org Long NAME</TH></TR>');
FOR idx IN (SELECT a1,b1,c1,d1
FROM test1
WHERE a1 > 1
ORDER BY a1 LOOP
HTP.P ('<TR>');
HTP.P ('<TD>' || idx.a1 || '</TD>');
HTP.P ('<TD>' || idx.b1 || '</TD>');
HTP.P ('<TD>' || idx.c1 || '</TD>');
HTP.P ('<TD>' || idx.d1 || '</TD>');
HTP.P ('</TR>');
END LOOP;
HTP.P ('</TABLE>');
HTP.P ('</BODY>');
HTP.P ('</HTML>');
END;