ORA-22912 指定的列或属性不是嵌套表类型/oracle 创建嵌套表 [英] ORA-22912 specified column or attribute is not a nested table type /oracle creating nested table

查看:97
本文介绍了ORA-22912 指定的列或属性不是嵌套表类型/oracle 创建嵌套表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 OODB 并尝试使用两个表制作嵌套表.我在这里发布代码

I was working with OODB and tried to make a nested table using two tables. I am posting code here

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);

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

The code intends to create a table branch by branch type and then creates a type Publisher Type which then try to create a nested table.

create table Publishers of PublisherType NESTED TABLE
branches STORE as branchTable

但是上面的代码报错,说指定的类型不是嵌套表类型.请帮帮我.

But the above code gives error saying that the specified type is not a nested table type. Please help me out.

推荐答案

您似乎在对象、对象表和对象表之间混淆了类型.由于问题中未对此进行描述,因此使用虚构的 addrtype 构建:

You seem to be mixing up your types, between objects, tables of objects, and object tables. This builds, with a made-up addrtype since that wasn't described in the question:

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 小提琴.

主要区别是:

create type BranchTableType as table of BranchType

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

as a table type rather than a table, instead of:

create table BranchTableType of BranchType;

还有:

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

使用嵌套表输入,而不是:

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

还有:

branches STORE as branchTableTypeStore

作为存储名称不是类型,而是:

as a storage name not type, instead of:

branches STORE as branchTable

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

But I'm not entirely sure what you'll be doing and if this is exactly what you want. Hopefully this will point you in the right direction anyway...

这篇关于ORA-22912 指定的列或属性不是嵌套表类型/oracle 创建嵌套表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆