Oracle SQL:从带有嵌套表的表中选择

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13972198/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 12:44:14  来源:igfitidea点击:

Oracle SQL: select from table with nested table

sqloracleoracle10gnested-table

提问by Igor Konoplyanko

I wonder how can i make select statement from table which have a typed column ? Type of this column is defined as:

我想知道如何从具有类型列的表中选择语句?此列的类型定义为:

create or replace TYPE "MYCOL" as table of MYTYPE; 
create or replace TYPE "MYTYPE" as OBJECT
( myid Number, myname Varchar2);

UPD1Table is defined as

UPD1表定义为

CREATE TABLE "T_TABLE" 
   (    "ID" NUMBER NOT NULL ENABLE, "NAME" "MYCOL" )

If i select this column with select * from T_TABLEi will get this not informative result:

如果我选择此列,select * from T_TABLE我将得到此不提供信息的结果:

1, MYSCHEMA.MYCOL([MYSCHEMA.MYTYPE],[MYSCHEMA.MYTYPE])

I want just to unwrap this types.

我只想解开这些类型。

回答by A.B.Cade

Try it like this:

像这样尝试:

select t."ID", tt.myid, tt.myname 
from "T_TABLE" t, table(t."NAME") tt;

Here is a sqlfiddle demo

这是一个 sqlfiddle 演示