Reputation: 1
I'm manipulating a type and use inheritance. My child have a collection in it and when I try to create a table from the mother and add the 'nested table name_collection_of' the child type in the creating table, I get an error that the identicator no valid. How can I resolve this?
-- Definir le type tcage
create type tcage as object (
noCage number(3),
fonction varchar2(20),
noAllee number(3)
);
/
-- Definir une collection libre ens_cages de references sur tcage
create type ens_cages as table of ref tcage;
/
-- Definir une collection statique (Varray) tspecialites de chaines de caracteres (fonction de la cage)
Create type tspecialites as Varray(10) OF varchar(30) ;
/
-- Definir un type temploye
create type temploye as object(
nomE varchar2(20),
adresse varchar2(20),
fonction_cage tspecialites
)
not final
;
/
-- Definir les sous-types de temploye: tgardien et trespsonsable
create type tgardien under temploye (
liste_cages ens_cages);
/
create type tresponsable under temploye (
noAllee number(3) );
/
-- Creation de la table lesemployes (avec nomE comme cl� primaire )
-- sans oublier la nested table
create table lesemployes of temploye ( PRIMARY KEY (nomE) );
nested table liste_cages store as cages;
I get this error when executes this code :
nested table tgardien.liste_cages store as cages
*
ERREUR a la ligne 4 :
ORA-00904: : identificateur non valide
So I've tried with this :
nested table tgardien.liste_cages store as cages
But it didn't work, still the same error. How can I deal with this,please?
Upvotes: 0
Views: 33
Reputation: 168311
You use:
create table lesemployes of temploye ( PRIMARY KEY (nomE) );
Which works.
However:
create table lesemployes of temploye ( PRIMARY KEY (nomE) )
nested table liste_cages store as cages;
Note: no ;
at the end of the first line.
Will not work as temploye
does not have an attribute liste_cages
as that is an attribute of a sub-type and not of the super-type that you are using to define the table.
I do not think that it is possible to do what you want. To define a nested table, the attribute that is being nested would have to be on the super-type rather than a sub-type of that type.
Upvotes: 0