【发布时间】:2014-01-19 11:46:33
【问题描述】:
我们有一个 CLOB 列,我们在其中存储相当简单的 XML,我需要从中提取其中一个标签的属性。我相信 select 语句是正确的,因为我得到了一部分值,但它在 80 个字符处截断了它。
这是 XML 的 sn-p...
<?xml version="1.0" encoding="UTF-8"?>
<service_orders count="1">
<service_order order_number="fakefakefake" id="fakefakefake">
<customer>
<customer_id>ABCDE12346</customer_id>
<first_name>FAKE</first_name>
<last_name>CUSTOMER</last_name>
</customer>
...
<images count="2">
<image src="https://s3.amazonaws.com/some_subfolder/deeper/deeper_still/ever_deeper/really_big_long_url_goes_here" thumbnail="https://s3.amazonaws.com/some_subfolder/deeper/deeper_still/ever_deeper/really_big_long_url_goes_here_thumb"/>
</images>
...
...这是 SQL 的 sn-p...
select
xmltype(contact_data).extract('/service_order/@order_number').getStringVal ordnum
,extract(xmltype(contact_data) ,'//images/image/@src') imgsrc
from
my_table
where
trunc(contact_date) = trunc(sysdate)
and extractvalue(xmltype(contact_data) ,'/service_order/@order_number') = '&ordnum'
返回 URL 的开头,但如前所述,URL 被截断为 80 个字符。
我做错了什么?
【问题讨论】:
标签: xml oracle xpath plsql xmltype