我有发送邮件的发送邮件程序。我将编写过程从sql获取值并将值传递给send_mail过程以接收邮件,但是当我尝试发送1000条记录时,它给出了数字或值错误。有些人可以帮我重写我的send_mail程序来发送CLOB,这样大小就不会成为一个约束。 下面是我的程序。
PROCEDURE send_mail (SUBJECT IN CLOB,MAIL_HEADER IN CLOB)
IS
l_connection utl_smtp.connection;
p_smtp_hostname varchar2(200) := 'localhost';
p_smtp_portnum varchar2(200) := '25';
p_from varchar2(200) := 'from@mail.com';
p_to VARCHAR2(400) := 'to@mail.com';
l_temp CLOB;
p_env VARCHAR2(3000) := '';
BEGIN
l_connection := utl_smtp.open_connection( p_smtp_hostname, p_smtp_portnum );
utl_smtp.helo( l_connection, p_smtp_hostname );
utl_smtp.mail( l_connection, p_from );
utl_smtp.rcpt(l_connection, p_to );
utl_smtp.open_data(l_connection);
l_temp := 'MIME-Version: 2.0' || chr(13) || chr(10);
l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
l_temp := l_temp || 'Subject: '|| SUBJECT || p_env || chr(13) || chr(10);
l_temp := l_temp || 'Reply-To: ' || p_to || chr(13) || chr(10);
l_temp := l_temp || 'Content-type: text/html;' ||
chr(13) || chr(10) || chr(13) || chr(10);
utl_smtp.write_data(l_connection, l_temp);
utl_smtp.write_data(l_connection, MAIL_HEADER);
utl_smtp.close_data(l_connection);
utl_smtp.quit( l_connection );
EXCEPTION
WHEN OTHERS THEN
RAISE;
END send_mail;
答案 0 :(得分:0)
即使您将l_temp
声明为CLOB
,这仍然会使您的限制为32767个字符。
这是sys.utl_smtp
包中的实际声明。所以你有你的角色限制,远远小于CLOB
。
PROCEDURE WRITE_DATA(
C IN OUT NOCOPY CONNECTION,
DATA IN VARCHAR2 CHARACTER SET ANY_CS
);
您可以尝试的是,将您的CLOB分成VARCHAR
个变量块并多次调用write_data
此功能可用于拆分CLOB - DBMS_LOB.SUBSTR