sql - 在 Oracle 中发送非常大的 HTML 消息正文
问题描述
我有以下代码-
declare
msg clob;
begin
select email into msg from ANI_CLOB;
Utl_Mail.Send(Sender =>'<abc.def@xyz.com>', Recipients =>abc.def@xyz.com,subject =>'CLOB MESSAGE', MIME_TYPE => 'text/html', Message =>msg);
end;
表 ANI_CLOB 有一列具有 CLOB 数据类型的“EMAIL”,并且只有一行存储大型 html 电子邮件正文。
当我运行这个块时,我遇到了错误 -
Error report -
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at line 5
06502. 00000 - "PL/SQL: numeric or value error%s"
*Cause: An arithmetic, numeric, string, conversion, or constraint error
occurred. For example, this error occurs if an attempt is made to
assign the value NULL to a variable declared NOT NULL, or if an
attempt is made to assign an integer larger than 99 to a variable
declared NUMBER(2).
*Action: Change the data, how it is manipulated, or how it is declared so
that values do not violate constraints.
我们可以在 utl_mail.send 中将 CLOB 作为消息体发送吗?另外,我只想将此消息作为邮件正文发送。
解决方案
不,UTL_MAIL
不支持CLOBs
。如果你必须这样做,你将不得不使用UTL_SMTP
,自己处理与邮件服务器通信的不同步骤,并将CLOB
使用多个调用发送到utl_smtp.write_data
。
推荐阅读
- javascript - JavaScript 中的列表追加不适用于 Firebase
- powershell - Powershell:读取主机中的意外回声
- c++ - 在 C++ 中的子类中重载加法运算符
- algorithm - 如何计算这段代码的时间复杂度?
- javascript - 在 Electron 中录制来自麦克风和输出的音频
- firebird - 返回 Integer 类型的 High() 的函数
- javascript - D3强制图动态添加链接
- android - 返回给 Xamarin android 活动的 Intent 具有非空数据,但 Intent.Data 的结果为空
- discord.js - TypeError:无法读取未定义的属性“推送”,我该如何解决?
- mysql - 按关系从表中获取所有内容