在我的 Oracle 数据库中,我有这样的记录:
In my Oracle db I have records like this one:
<ROOT>
<Event>
<Type>sldkfvjhkljh</Type>
<ID>591252</ID>
</Event>
<Data>
<File>
<Name>1418688.pdf</Name>
<URL>/591252/1418688.pdf</URL>
</File>
<File>
<Name>1418688.xml</Name>
<URL>/591252/1418688.xml</URL>
</File>
</Data>
</ROOT>
我需要从第一个 标签中提取一个值.如果我尝试:
I need to extract a value from the first <Name> tag. If I try:
Select xmltype(xml_data).extract('//Name[1]/text()').getStringVal() from MY_TABLE
我明白了:
1418688.pdf1418688.xml
1418688.pdf1418688.xml
为什么会这样,我怎样才能得到 1418688.pdf?
Why is that and how can I get just 1418688.pdf?
甲骨文版本:
Oracle 数据库 10g 企业版版本 10.2.0.4.0 - 64bi
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
我认为这两个 Name 元素在本文档中都是 #1,因为在它们的节点中,它们都是第一个.试试 //File[1]/Name/text()
I think that both Name elements are #1 in this doc, because in their nodes they are each first. Try //File[1]/Name/text()
这篇关于如何在 Oracle 中通过 XPath 获取第一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
获取所有产品、类别和元数据的 SQL 查询 woocommSQL query to get all products, categories and meta data woocommerce/wordpress(获取所有产品、类别和元数据的 SQL 查询 woocommerce/wordpre
我可以在不编写 SQL 查询的情况下找出数据库列表Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不编写 SQL 查询的情况下
如何创建对 SQL Server 实例的登录?How to create a login to a SQL Server instance?(如何创建对 SQL Server 实例的登录?)
如何通过注册表搜索知道SQL Server的版本和版本How to know the version and edition of SQL Server through registry search(如何通过注册表搜索知道SQL Server的版本和版本)
为什么会出现“数据类型转换错误"?使用 ExWhy do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(为什么会出现“数据类型转换错误?使用 ExecuteNonQuery()?)
如何将 DataGridView 中的图像显示到 PictureBox?How to show an image from a DataGridView to a PictureBox?(如何将 DataGridView 中的图像显示到 PictureBox?)