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 ...
随机推荐
- poj1753 高斯消元
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37055 Accepted: 16125 Descr ...
- [bzoj3668][Noi2014]起床困难综合症/[洛谷3613]睡觉困难综合症
来自FallDream的博客,未经允许,请勿转载,谢谢. 21 世纪,许多人得了一种奇怪的病:起床困难综合症,其临床表现为:起床难,起床后精神不佳.作为一名青春阳光好少年,atm 一直坚持与起床困难综 ...
- RTX 无法刷新组织架构的处理方法总结
文章一: 刷新组织架构问题1."客户端不能获取正确的组织架构"或"新增加的人员刷新不了组织架构"首先要判断是RTX服务器引起的异常还是一些客户端出现的异常,判断 ...
- 如何为分布式系统优雅的更换RPC
为啥需要更换RPC? 很多小伙伴都遇到过需要为分布式系统调用更换RPC的问题,为什么会遇到这种事呢?其实,在系统搭建初期,需求简单,架构简单,最重要的是请求量也少,所以很多系统都采用快速原型开发模式, ...
- mybatis choose标签的使用
MyBatis 提供了 choose 元素.if标签是与(and)的关系,而 choose 是或(or)的关系. choose标签是按顺序判断其内部when标签中的test条件出否成立,如果有一个成立 ...
- request.url 端口 错误
今天遇到一个很奇怪的事情,用request.url.port来获取一个请求的端口,返回是80 ,很纳闷啊我的请求上面是http://www.XX.com:8088 啊,怎么会是80啊,太不可思议了! ...
- 643. Maximum Average Subarray
Given an array consisting of \(n\) integers, find the contiguous subarray of given length \(k\) that ...
- RHEL(红帽七)的DNS配置
RHEL7的DNS配置 本文中用到的所有参数均位于文末附录中 查询bind-chroot这个安装包 Yum 安装 bind-chroot 进入named.conf文件 复制以下参数进去 进入这个文 ...
- jQuery 捕获
jQuery 拥有可操作 HTML 元素和属性的强大方法. jQuery DOM 操作 jQuery 中非常重要的部分,就是操作 DOM 的能力. jQuery 提供一系列与 DOM 相关的方法,这使 ...
- AbstractQueuedSynchronizer源码解读--续篇之Condition
1. 背景 在之前的AbstractQueuedSynchronizer源码解读中,介绍了AQS的基本概念.互斥锁.共享锁.AQS对同步队列状态流转管理.线程阻塞与唤醒等内容.其中并不涉及Condit ...