Oracle, convert varchar to BLOB

在Orcle中, 有时我们需要直接给一个数据类型是BLOB的字段插入数据, 但我们只知道BLOB的String。 

这时, 我们需要将String转换成BLOB。

可以用方法TO_BLOB(UTL_RAW.CAST_TO_RAW('.............'))


例如:

UPDATE  T_SA_EMAIL_TEMPLATES_TX
  SET EMAIL_CONTENT= TO_BLOB(UTL_RAW.CAST_TO_RAW('<p>Dear HSP,</p>


<p>You have submitted a medical bill amounting to $100, 000 to MCPS. The bill details are:</p>


<p><strong>Invoice number: %hspBillNo%<br />
Bill Amount: %billAmount%<br />
Submitted by (HSP): %hspCode%<br />
Officer''s ministry: %ministry%<br />
Officer''s department: %department%</strong></p>


<p><strong>Bill Status: %billStatus%<br />
HSP Output Record: %record%<br />
1st Approval remark: %remarks1%<br />
2nd Approval remark: %remarks2%</strong></p>


<p>  </p>


<p>If you wish to contact the officer in-charge of approving/rejecting this bill, please kindly use the %contactInfo% link under the General Function to search for the officer''s contact details.</p>


<p>*** This is an automatically generated email, please do not reply ***</p>'))
WHERE EMAIL_TEMPLATES_ID='8';


即使String中有换行, 也可以直接convert。



  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值