ORACLE : How to add a nested table to an existing type

18 Views Asked by At

I need to add a nested table to the following type that I've already created :

CREATE OR REPLACE TYPE ELEVE_TYPE UNDER PERSONNE_TYPE (
    DATE_NAISSANCE DATE,
    POIDS NUMBER,
    ANNEE NUMBER(1),
    ADR ADRESSE_TYPE
);
/

Here is the table I want to add to my type :

CREATE OR REPLACE TYPE RESULTAT_TYPE AS OBJECT (
    NOM_COURS VARCHAR2(32),
    POINTS NUMBER
);
/

CREATE OR REPLACE TYPE RESULTATS_TABLE
IS TABLE OF RESULTAT_TYPE;
/

But the ALTER TABLE command I've tried to do is not working, giving the error ORA-06545: PL/SQL: compilation error - compilation aborted. Here's my command :

ALTER TYPE ELEVE_TYPE 
ADD RESULTATS RESULTATS_TABLE NESTED TABLE RESULTATS STORE AS RESULTATS_TAB;
/

How do I make it work ? Thanks in advance

EDIT : I did mean to alter a type and not a table, and my problem was solved thanks to MT0's comment :

ALTER TYPE ELEVE_TYPE 
ADD ATTRIBUTE RESULTATS RESULTATS_TABLE CASCADE;
/
0

There are 0 best solutions below