XMLTABLE
XMLTABLE
Syntax

Description of the illustration xmltable.gif
XMLnamespaces_clause::=

Description of the illustration xml_namespaces_clause.gif
XMLTABLE_options::=

Description of the illustration xmltable_options.gif
XML_passing_clause::=

Description of the illustration xml_passing_clause.gif
XML_table_column::=

Description of the illustration xml_table_column.gif
Purpose
XMLTable maps the result of an XQuery evaluation into relational rows and columns. You can query the result returned by the function as a virtual relational table using SQL.
The
XMLNAMESPACESclause contains a set of XML namespace declarations. These declarations are referenced by the XQuery expression (the evaluated
XQuery_string), which computes the row, and by the XPath expression in the
PATHclause ofXML_table_column, which computes the columns for the entire
XMLTablefunction. If you want to use qualified names in thePATHexpressions of the
COLUMNSclause, then you need to specify theXMLNAMESPACESclause.XQuery_stringis a complete XQuery expression and can include prolog declarations.The
exprin theXML_passing_clauseis an expression returning an
XMLTypeor an instance of a SQL scalar data type that is used as the context for evaluating the XQuery expression. You can specify only one
exprin thePASSINGclause without an identifier. The result of evaluating each
expris bound to the corresponding identifier in the
XQuery_string. If anyexprthat is not followed by an
ASclause, then the result of evaluating that expression is used as the context item for evaluating the
XQuery_string.The optional
COLUMNSclause defines the columns of the virtual table to be created by
XMLTable.If you omit the
COLUMNSclause, thenXMLTablereturns a row with a single
XMLTypepseudocolumn namedCOLUMN_VALUE.The
datatypeis required unless
XMLTableis used with XML schema-based storage ofXMLType,
datatype. In this case, if you omit
datatype, Oracle XML DB infers the data type from the XML schema. If the database is unable to determine the proper type for a node, then a default type of
VARCHAR2(4000)is used.FORORDINALITYspecifies that column is to be a column of generated row numbers. There must be at most one
FORORDINALITYclause. It is created as aNUMBERcolumn.The optional
PATHclause specifies that the portion of the XQuery result that is addressed by XQuery expression string is to be used as the column content. If you omit
PATH, then the XQuery expressioncolumnis assumed. For example:XMLTable(... COLUMNS xyz
is equivalent to
XMLTable(... COLUMNS xyz PATH 'XYZ')
You can use different
PATHclauses to split the XQuery result into different virtual-table columns.The optional
DEFAULTclause specifies the value to use when theexpression results in an empty sequence. Its
PATHexpris an XQuery expression that is evaluated to produce the default value.See Also:
Oracle XML DB Developer's Guide for more information on the
XMLTablefunction, including additional examples, and on XQuery in generalExamples
The following example converts the result of applying the XQuery
'/Warehouse'to each value in the
warehouse_speccolumn of thewarehousestable into a virtual relational table with columns
WaterandRail:SELECT warehouse_name warehouse,
warehouse2."Water", warehouse2."Rail"
FROM warehouses,
XMLTABLE('/Warehouse'
PASSING warehouses.warehouse_spec
COLUMNS
"Water" varchar2(6) PATH '/Warehouse/WaterAccess',
"Rail" varchar2(6) PATH '/Warehouse/RailAccess')
warehouse2; WAREHOUSE Water Rail
----------------------------------- ------ ------
Southlake, Texas Y N
San Francisco Y N
New Jersey N N
Seattle, Washington N Y
XMLTABLE的更多相关文章
- Oracle XMLTable 使用教程与实例
从Oracle 10g开始,甲骨文公司新增了XQuery和XMLTable两个功能作为处理XML的武器. XMLQuery一样,您可以使用XQuery语言构造XML数据和查询XML和关系数据.你可以使 ...
- Oracle中使用虚拟表DUAL或XMLTABLE返回顺序数列
在Oracle中使用虚拟表DUAL或XMLTABLE返回顺序数列 使用DUAL表和CONNECT BY LEVEL的特殊用法,返回一个1-10的顺序数列,示例代码如下: SELECT LEVEL FR ...
- MS SQL巡检系列——检查重复索引
前言感想:一时兴起,突然想写一个关于MS SQL的巡检系列方面的文章,因为我觉得这方面的知识分享是有价值,也是非常有意义的.一方面,很多经验不足的人,对于巡检有点茫然,不知道要从哪些方面巡检,另外一方 ...
- Oracle数据行拆分多行
工作和学习中常常会遇到一行要分割成多行数据的情况,在此整理一下做下对比. 单行拆分 如果表数据只有一行,则可以直接在原表上直接使用connect by+正则的方法,比如: select regexp_ ...
- Oracle行转列、列转行的Sql语句总结
多行转字符串 这个比较简单,用||或concat函数可以实现 SQL Code 12 select concat(id,username) str from app_userselect i ...
- 45 个非常有用的 Oracle 查询语句
这里我们介绍的是 40+ 个非常有用的 Oracle 查询语句,主要涵盖了日期操作,获取服务器信息,获取执行状态,计算数据库大小等等方面的查询.这些是所有 Oracle 开发者都必备的技能,所以快 ...
- oracle---日期等plsql
日期/时间 相关查询 1.获取当前月份的第一天 运行这个命令能快速返回当前月份的第一天.你可以用任何的日期值替换 "SYSDATE"来指定查询的日期. SELECT TRUNC ( ...
- 如何查看oracle数据库的所有的关键字
管理员账户登录后,执行以下命令: select * from v$reserved_words 附上参考: NOMONITORINGRECORDS_PER_BLOCKCASCADEDYNAMIC_S ...
- .net之工作流工程展示及代码分享(三)数据存储引擎
数据存储引擎是本项目里比较有特色的模块. 特色一,使用接口来对应不同的数据库.数据库可以是Oracle.Sqlserver.MogoDB.甚至是XML文件.采用接口进行对应: public inter ...
随机推荐
- python 中range numpy.arange 和 numpy.linspace 的区别
1.返回值不同 range返回一个range对象,numpy.arange和numpy.linspace返回一个数组. 2.np.arange的步长可以为小数,但range的步长只能是整数. 与Pyt ...
- EtherChannel(PAgP、LACP)基本配置--端口聚合--(转)
转自 http://blog.sina.com.cn/s/blog_635e1a9e01017msv.html EtherChannel EtherChannel(以太通道)也叫端口聚合或链路聚合,特 ...
- 浅谈@RequestMapping @ResponseBody 和 @RequestBody 注解的用法与区别
浅谈@RequestMapping @ResponseBody 和 @RequestBody 注解的用法与区别 Spring 2.5 版本新增了注解功能, 通过注解,代码编写简化了很多:但熟悉注解的使 ...
- chrome 如何卸载干净
安装位置C:\Users\你电脑的用户名\AppData\Local\Google,删除整个文件夹,用CCleaner扫描注册表删除无用注册表项,重启安装即可.
- Mysql锁机制--写锁
Mysql 系列文章主页 =============== 1 准备数据 1.1 建表 1.1.1 建立 Employee表 DROP TABLE IF EXISTS employee; CREATE ...
- 借助Bodymovin播放svg动画
svg动画,截取工具有点不忍直视了~~~ 为了实现上面的svg动画,可以使用bodymovin插件,简单配置之后,就可以直接可以实现在 AE(可视化操作,不用码代码)上面导出 svg的json数据,在 ...
- Ubuntu14.04和Windows双系统时无法挂载磁盘解决方法
基本状况:我电脑Ubuntu14.04 和 Windows10 双系统,一个固态磁盘,一个机械磁盘.Ubuntu14.04装固态里面了,固态里没有Windows内容. 问题:Ubuntu14.04系统 ...
- Spring-cloud(六) Hystrix入门
前提 一个可用的Eureka注册中心(文中以之前博客中双节点注册中心,不重要) 一个连接到这个注册中心的服务提供者 快速入门 项目搭建 搭建一个新maven项目,artifactid为Ribbon-c ...
- Linux shell查询ip归属地
起因 有的时候写脚本需要能够在脚本中获取到ip的归属地,比如分析登录日志列出攻击者的相关信息等. 可以使用whois来查询ip的详细信息,但是whois并不是每台机器预装的,而且我想看中文的结果,所以 ...
- SQL Server 虚拟化(1)——虚拟化简介
本文属于SQL Server虚拟化系列 前言: 现代系统中,虚拟化越来越普遍,如果缺乏对虚拟化工作原理的理解,那么DBA在解决性能问题比如降低资源争用.提高备份还原速度等操作时就会出现盲点.所以基于本 ...