4

Here is a snippet of my OR schema:

CREATE TYPE artist_table_type AS TABLE OF REF artist_type;
/

CREATE TYPE track_type AS OBJECT (
    title VARCHAR(1000),
    duration INT,
    release_date DATE,

    producers artist_table_type,

    MEMBER FUNCTION getProducers RETURN artist_table_type,
    MEMBER FUNCTION getRemixers RETURN artist_table_type
);
/
CREATE TABLE track_obj_table OF track_type;

When I attempt to run this, I get the error:

CREATE TABLE track_obj_table OF track_type
*
ERROR at line 1:
ORA-22913: must specify table name for nested table column or attribute

I suspect that this is because of the table type in the track_type object?

APC
  • 144,005
  • 19
  • 170
  • 281
alexgolec
  • 26,898
  • 33
  • 107
  • 159

1 Answers1

6

It just means you have to provide the storage clause for the nested table:

SQL> CREATE TABLE track_obj_table OF track_type;
CREATE TABLE track_obj_table OF track_type
*
ERROR at line 1:
ORA-22913: must specify table name for nested table column or attribute


SQL> CREATE TABLE track_obj_table OF track_type
  2  NESTED TABLE producers STORE AS producers_nt
  3  /

Table created.

SQL> desc track_obj_table
 Name                                      Null?    Type
 ----------------------------------------- -------- -------------------------
 TITLE                                              VARCHAR2(1000)
 DURATION                                           NUMBER(38)
 RELEASE_DATE                                       DATE
 PRODUCERS                                          ARTIST_TABLE_TYPE

SQL>
APC
  • 144,005
  • 19
  • 170
  • 281
  • Great, thanks. I tried this, and now I'm getting: "CREATE TABLE track_obj_table2 of track_type * ERROR at line 1: ORA-00955: name is already used by an existing object" no matter what I name it. – alexgolec Apr 25 '11 at 16:10
  • False alarm, I was doing NESTED TABLE producers STORE AS producers. – alexgolec Apr 25 '11 at 17:37