With below three situation, we can use the pseudocolumn column_value to refer the column value.

  • an XMLTABLE construct without the columns clause
  • TABLE function to refer to a scalar nested table type
  • virtual table with a single column returned by system

1. In the context of XMLTable, the value returned is of datatype XMLType.

SELECT * FROM XMLTABLE('<a>123</a>');

COLUMN_VALUE
---------------------------------------
<a>123</a> SELECT COLUMN_VALUE FROM (XMLTable('<a>123</a>')); COLUMN_VALUE
----------------------------------------
<a>123</a>

2. for the table function with collection type,you can use column_value , the returned column_value type is same as the element type.

CREATE TYPE phone AS TABLE OF NUMBER;
/
CREATE TYPE phone_list AS TABLE OF phone;
/
SELECT t.COLUMN_VALUE from table(phone(1,2,3)) t;

COLUMN_VALUE
------------
1
2
3

In a nested type, you can use the COLUMN_VALUE pseudocolumn in both the select list and the TABLE function:

SELECT t.COLUMN_VALUE FROM
TABLE(phone_list(phone(1,2,3))) p, TABLE(p.COLUMN_VALUE) t;
COLUMN_VALUE
------------
1
2
3

The keyword COLUMN_VALUE is also the name that Oracle Database generates for the scalar value of an inner nested table without a column or attribute name,

as shown in the example that follows. In this context,column_value  is not a pseudocolumn, but an actual column name.

CREATE TABLE my_customers (
cust_id NUMBER,
name VARCHAR2(25),
phone_numbers phone_list,
credit_limit NUMBER)
NESTED TABLE phone_numbers STORE AS outer_ntab
(NESTED TABLE COLUMN_VALUE STORE AS inner_ntab);

Below is an example for build-in list odinumberlist

select distinct column_value from table(sys.odcinumberlist(1,1,2,3,3,4,4,5))

refer:

http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns004.htm

http://stackoverflow.com/questions/10353969/how-can-i-select-from-list-of-values-in-oracle

COLUMN_VALUE Pseudocolumn的更多相关文章

  1. Oracle 中的伪列

    昨天做了一个Oracle PL/SQL 相关的测试,其中有一道这样的题目:   下列那些是Oracle的伪列(ACD)  A.ROWID   B.ROW_NUMBER()  C.LEVEL  D.RO ...

  2. Oracle Schema Objects——伪列ROWID Pseudocolumn(ROWNUM、ROWID)

    Oracle Schema Objects Oracle Schema Objects——Tables——Oracle Data Types Oracle伪列 在Oracle数据库之中为了实现完整的关 ...

  3. XMLTABLE

     XMLTABLE Syntax Description of the illustration xmltable.gif XMLnamespaces_clause::= Description ...

  4. 转://Oracle PL/SQL 优化与调整 -- Bulk 说明

    一. Bulk 概述 本来只想测试一下Bulk Collect 和update性能的,但发现Bulk 的东西还是很多的,在OTN上搜了一些,整理如下. 1.1 Bulk Binding 和 Bulk ...

  5. DBMS_NETWORK_ACL_ADMIN

    DBMS_NETWORK_ACL_ADMIN学习 转载 http://blog.sina.com.cn/s/blog_4f925fc30102e2se.html 标签: oracle it 分类: 数 ...

  6. Oracle导出excel

    oracle导出excel(非csv)的方法有两种,1.使用sqlplus  spool,2.使用包体 现将网上相关代码整理后贴出以备不时之需: 使用sqlplus: 使用sqlplus需要两个文件: ...

  7. Oracle数据行拆分多行

    工作和学习中常常会遇到一行要分割成多行数据的情况,在此整理一下做下对比. 单行拆分 如果表数据只有一行,则可以直接在原表上直接使用connect by+正则的方法,比如: select regexp_ ...

  8. Oracle的一些操作

    . 创建用户 Create user 用户名 identified by "密码"; 例如:create user ghc_ez identified by "ghc_2 ...

  9. SQL 归来

    1. PL/SQL 转义 select order#, ………  from **** select col1 from A where col2 like '%\_keywors%' escape ' ...

随机推荐

  1. sqlmap遇到url重写的示例

    url_rewrite 这个问题 国内外的坛子里都有人问. D:\cygwin\pentest\database\sqlmap\doc \faq.pdf 下面是官方给的解答. 1.15 How to ...

  2. Pointcut is not well-formed: expecting 'identifier' at character position 0

    异常如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDa ...

  3. Leetcode | Parentheses 相关

    Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of ...

  4. POJ 3468 A Simple Problem with Integers(线段树区间更新区间查询)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 92632   ...

  5. windows7下使用telnet

    需要打开windows功能,telnet客户端. 在命令行里输入Telnet open www.qq.com 80 连接成功后会进入一个空界面,之前命令行窗口里的字符还在,光标却移动到最起始. 这是很 ...

  6. FZU 1018 枚举dp

    题意 给出一个数字组成的立方体 在其中选取一个体 使这个体中的数字之和最小 不可以不选 fzu的题目分类动态规划里面不是按难度排得 是按照题号..记得以前做题碰到过算 矩阵里面求子矩阵的最大和的 不会 ...

  7. hdu1272 并查集

    如果要输出yes 需要满足 1  这个图连通 2  没有回路 3  0 0 也是yes 看它有没有回路 在un的时候做一次判断就可以了 然后是判断连通 在这里采用的方法是扫一遍 如果这个点出现过就判断 ...

  8. tomcat bug之部署应用的时候经常会发上startup failed due to previous errors

    在tomcat上部署应用的时候经常会发上startup failed due to previous errors错误.这个错误产生以后经常会让人摸不到头脑.以下是几点查找经验: 1.web.xml文 ...

  9. 【翻译】CEDEC2015 速成Albedo Chart 制作

        关于pbr材质和贴图的制作,最近llegorithmic提供了几篇不错的guide  https://www.allegorithmic.com/pbr-guide   不过像如何从通过现实场 ...

  10. P1092 虫食算 NOIP2002

    为了测试stl 30分的暴力写法... #include <bits/stdc++.h> using namespace std; const int maxn = 11; int n; ...