当前位置: 首页 > 工具软件 > Nested Table > 使用案例 >

oracle自定义嵌套表类型,ORA-22912指定的列或属性不是嵌套表类型/ oracle创建嵌套表(ORA-22912 specified column or attribute is not a...

云锦
2023-12-01

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

我正在与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);

代码打算按分支类型创建表分支,然后创建类型Publisher类型,然后尝试创建嵌套表。

create table Publishers of PublisherType NESTED TABLE

branches STORE as branchTable

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

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.

原文:https://stackoverflow.com/questions/16785647

更新时间:2019-12-18 02:12

最满意答案

您似乎在混合类型,对象,对象表和对象表之间。 这是使用补充的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

/

主要区别是:

create type BranchTableType as table of BranchType

作为表类型而不是表,而不是:

create table BranchTableType of BranchType;

和:

create type PublisherType as object(

...

branches BranchTableType)

使用嵌套表类型 ,而不是:

create type PublisherType as object(

...

branches BranchType);

和:

branches STORE as branchTableTypeStore

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

branches STORE as branchTable

但我不完全确定你会做什么,如果这正是你想要的。 希望无论如何这将指向正确的方向......

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

/

The main differences are:

create type BranchTableType as table of BranchType

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

create table BranchTableType of BranchType;

And:

create type PublisherType as object(

...

branches BranchTableType)

with the nested table type, instead of:

create type PublisherType as object(

...

branches BranchType);

And:

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...

2013-05-28

相关问答

它确实如此,但它并不漂亮。 select cast(collect(b.column_value) as vector)

from table(table_of_vector(

vector(23, 4, 2222, 22222222),

vector(2, 1, 766, 2),

vector(2, 1, 5))) a,

table(a.column_value) b;

所以表(......)的

...

您无法将整个集合传递给DBMS_OUTPUT ,而是必须遍历它并在每个索引处显示单个列。 DECLARE

dobs emp_dobs_nested;

BEGIN

dobs := get_emp_dobs;

FOR i IN 1..dobs.COUNT

LOOP

DBMS_OUTPUT.PUT_LINE(dobs(i).emp_fname||','||dobs(i).emp_lname||','||dobs(i).emp_dob);

END LOOP

...

您似乎在混合类型,对象,对象表和对象表之间。 这是使用补充的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

/

c

...

还需要为超类型的属性定义嵌套表存储。 当我将其添加到第155行时,udt_tables.sql脚本可以工作: CREATE TABLE Guia OF guia_t (

CONSTRAINT PK_GUIA PRIMARY KEY (username)

) NESTED TABLE idiomas STORE AS guia_idiomas

NESTED TABLE telefonos STORE AS guia_telefonos

NESTED TABLE tipoHitosPref

...

“当创建Animal类型的动物表格时,如何在”动物“中没有字段的情况下,只在”狗“中,如何为”生活地点“创建嵌套表格。” 这是继承的奥秘。 从ANIMAL类型构建的表实际上具有支持其子类型的属性的列。 但是,只有在明确使用DOG子类型时才能访问它们。 这是你的数据结构。 create or replace type animal_t as object

( name varchar2(10)

, age number (3,0))

not final;

/

create or re

...

基于函数的索引与嵌套表不同。 常规索引是针对实际列构建的... create index emp_job_idx on emp (job)

/

...而基于函数的索引建立在应用于列的函数上。 例如,当我们查询没有时间元素的日期列时,我们可能会使用什么索引... create index emp_hire_idx on emp(trunc(hiredate))

/

当我们查询USER_IND_COLUMNS时,索引列在第一种情况下出现,但在第二种情况下不出现,因为我们没有索引实际列。 我们看到的

...

poll_nest不是嵌套表。 它的表存储PL SQL对象。 来自http://www.orafaq.com/wiki/NESTED_TABLE : NESTED TABLE是一种Oracle数据类型,用于支持包含多值属性的列,在本例中是可以包含整个子表的列。 您可以通过首先实例化对象构造函数来在对象类型表中插入值 insert into poll_nest values (voter_arrive('122','112')); 要访问插入的值,您可以使用 select e.voter.arriv

...

这是Oracle文档不同步的一个有趣示例。 索引示例应包括类型的定义。 但是,我们可以在PL / SQL参考中找到这些示例。 所以PRINT_MEDIA.AD_TEXTDOCS_NTAB的类型为TEXTDOC_TAB,它具有以下签名: CREATE TYPE textdoc_typ AS OBJECT

( document_typ VARCHAR2(32)

, formatted_doc BLOB

) ;

CREATE TYPE textdoc_tab

...

检查CREATE TABLE for OID子句的语法: SQL> CREATE OR REPLACE TYPE person_type AS OBJECT (

2 personID NUMBER,

3 forename VARCHAR2(30),

4 surname VARCHAR2(20),

5 dateOfBirth DATE

6 ) NOT FINA

...

您要查找的关键字是column_value 。 随着你的设置: SQL> CREATE OR REPLACE TYPE NUMBER_ARRAY_T is TABLE of NUMBER;

2 /

Type created

SQL> CREATE OR REPLACE PROCEDURE validate_order_ids(i_orders IN number_array_t,

2 o_o

...

 类似资料: