SQL:从嵌套表oid中选择

时间:2016-03-29 17:15:19

标签: sql database oracle object-relational-model

我尝试从嵌套表中进行选择但显示错误消息" ORA-00933:SQL命令未正确结束" 这是选择的要求

select b.NomPlayer from  table (select t.players from Team t where t.IdTeam=1) as p;

这是我创建player_typeteam_type

的代码
CREATE OR REPLACE TYPE Player_Type AS OBJECT ( Num_Licence NUMBER, NomPlayer VARCHAR2(30)) ;
CREATE TYPE PlayersNT AS TABLE OF ref Player_Type ;
CREATE TYPE Team_Type AS OBJECT ( IdTeam NUMBER, TeamName VARCHAR2(30), Players PlayersNT ) ;
CREATE TABLE Player OF Player_Type ;
CREATE TABLE Team OF Team_Type
NESTED TABLE Players STORE AS PlayersTab ;

1 个答案:

答案 0 :(得分:0)

删除AS子句中的FROM。与其他数据库不同,Oracle仅允许AS子句中的SELECT

select * from table(select t.players from Team t where t.IdTeam=1) p;