从oracle的blob字段取数据的一个例子
这边有一个需求,blob存放一个xml文件的内容,然后需要读取xml某一个节点的值。
今天看了下,原来用Dbms_Lob.Substr和Utl_Raw.Cast_To_Varchar2以及Utl_Raw.Cast_To_Raw配合可以实现上边的需求。
笔记,sql如下:
Select Zxt1.Skgkdm,
Zxt1.Pzhm,
Case
When Zxt1.Cot = 1 Then
Zxt1.Tipsrcvfisccode
Else
Zxt1.Tipsrcvfisccode1
End,
Case
When Zxt1.Cot = 1 Then
Zxt1.Tipsrcvfiscname
Else
Zxt1.Tipsrcvfiscname1
End,
Zxt1.Zgrcvfisccode
From (Select Zxt.Skgkdm,
Zxt.Pzhm,
Zxt.Tipsrcvfisccode,
Zxt.Tipsrcvfiscname,
Zxt.Zgrcvfisccode,
Zxt.Cot,
Substr(Utl_Raw.Cast_To_Varchar2(Dbms_Lob.Substr(t.Dealcontent, 1