【问题标题】:ORA-22912 specified column or attribute is not a nested table type /oracle creating nested tableORA-22912指定的列或属性不是嵌套表类型 /oracle 创建嵌套表
【发布时间】:2013-05-23 01:06:48
【问题描述】:

我正在使用 OODB,并尝试使用两个表创建一个嵌套表。我在这里发布代码

create type BranchType as object(
address AddrType,
phone1 integer,
phone2 integer );

create table BranchTableType of BranchType;

create type PublisherType as object(
name varchar2(50),    
addr AddrType,
branches BranchType);

代码打算按分支类型创建一个表分支,然后创建一个发布者类型,然后尝试创建一个嵌套表。

create table Publishers of PublisherType NESTED TABLE
branches STORE as branchTable

但是上面的代码给出了错误,指出指定的类型不是嵌套表类型。请帮帮我。

【问题讨论】:

    标签: oracle oracle11g nested-table


    【解决方案1】:

    您似乎在对象、对象表和对象表之间混淆了类型。这构建了一个虚构的addrtype,因为问题中没有描述:

    create type addrtype as object(
    city varchar2(20)
    )
    /
    
    create type BranchType as object(
    address AddrType,
    phone1 integer,
    phone2 integer )
    /
    
    create type BranchTableType as table of BranchType
    /
    
    create type PublisherType as object(
    name varchar2(50),    
    addr AddrType,
    branches BranchTableType)
    /
    
    create table Publishers of PublisherType NESTED TABLE
    branches STORE as branchTableTypeStore
    /
    

    SQL Fiddle.

    主要区别在于:

    create type BranchTableType as table of BranchType
    

    作为表格键入而不是表格,而不是:

    create table BranchTableType of BranchType;
    

    还有:

    create type PublisherType as object(
    ...
    branches BranchTableType)
    

    使用嵌套表type,而不是:

    create type PublisherType as object(
    ...
    branches BranchType);
    

    还有:

    branches STORE as branchTableTypeStore
    

    作为存储名称不键入,而不是:

    branches STORE as branchTable
    

    但我不完全确定您将要做什么以及这是否正是您想要的。希望这无论如何都会为您指明正确的方向...

    【讨论】:

    • 非常感谢,我想做同样的工作,但没能做到。我搞砸了分支类型,搞砸了我的工作。不过真的非常感谢。
    猜你喜欢
    • 1970-01-01
    • 2014-01-06
    • 2017-05-25
    • 2020-03-23
    • 1970-01-01
    • 2021-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多