通过 Oracle XML DB 功能执行此类操作的正确方法:
select
value_test
from
XMLTable('$p'
passing XMLParse(content '<![CDATA[<DIV STYLE="text-align:LEFT;"><SPAN STYLE="letter-spacing:0px;color:#000000;font-size:10px;font-family:''Verdana'';">Value to be extract</SPAN></DIV>]]>')
as "p"
columns value_test varchar2(4000) path '/text()'
);
这样做的另一个变体:
select
dbms_xmlgen.convert(
XMLQuery('data($p)'
passing by value XMLParse(content '<![CDATA[<DIV STYLE="text-align:LEFT;"><SPAN STYLE="letter-spacing:0px;color:#000000;font-size:10px;font-family:''Verdana'';">Value to be extract</SPAN></DIV>]]>')
as "p"
returning content
).getCLOBVal(),
1
)
from dual;