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. Notepad++ Shortcuts 快捷键

    Ctrl-C   Copy Ctrl-X   Cut Ctrl-V   Paste Ctrl-Z   Undo Ctrl-Y   Redo Ctrl-A   Select All Ctrl-F   L ...

  2. Shrink磁盘

      30857(分区的总容量) =  10160(可修改的这个10610表示Shrink之后的空闲分区) + 20697(Shrink之后分区中占用掉的容量)

  3. Scrum会议8(Beta版本)

    组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 代码地址:HTTPS:https://git.coding.net/jx8zjs/llk.git SSH:git@git.coding.n ...

  4. CSS系列:表达式(Expression)`淘汰`

    概述 CSS表达式是动态设置CSS属性的强大(但危险)方法.Internet Explorer从第5个版本开始支持CSS表达式. 兼容性 expression方法在其它浏览器中不起作用,因此在跨浏览器 ...

  5. UVALive 7472

    题意 有n个循环 给出x a b c xi+1=(a*x+b)%c 要求是从这些循环中各取一个数 使加和最大并且给出一个m 满足sum%m!=0 n的范围是4次方 c的范围是3次方 训练赛的时候看了一 ...

  6. Redis 笔记与总结2 String 类型和 Hash 类型

    Linux 版本信息: cat /etc/issue 或cat /etc/redhat-release(Linux查看版本当前操作系统发行版信息) CentOS release 6.6 (Final) ...

  7. Ecplise + Xdebug 一波三折终于能单步调试了

    http://my.oschina.net/012345678/blog/152889 Ecplise + Xdebug 一波三折终于能单步调试了 发表于2年前(2013-08-15 15:50)   ...

  8. Android progressbar 详解

    [原文Android学习笔记(十六)进度条] ProgressBar XML属性 属性名 描述 android:animationResolution 超时的动画帧之间的毫秒 :必须是一个整数值,如“ ...

  9. linux 查看系统状态方法

    Linux下如何查看系统启动时间和运行时间 1.uptime命令输出:16:11:40 up 59 days, 4:21, 2 users, load average: 0.00, 0.01, 0.0 ...

  10. MVC程序实现Autocomplete功能

    为了加强MVC的功力,加强练习是少不了的事情.Insus.NET这次想实现文本框的autocomplete功能. 在数据创建一张表[PinYin]: 插入一些数据: INSERT INTO [dbo] ...