Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Oracle SQL nested tables.

  • 21-03-2009 08:57PM
    #1
    Registered Users, Registered Users 2 Posts: 229 ✭✭


    Hey, I have been trying to create a table with nested tables. I have fallowed a tutorial on how to do it, and check other places to ensure that my method is correct. Yet it still wont work :/ Any help would be great.
    CREATE OR REPLACE TYPE sector_type AS  OBJECT(
        SID integer,
        AIPS integer
    );
    CREATE OR REPLACE TYPE state_table_type AS TABLE OF sector_table;
    
    CREATE TABLE run (
    
        UNO integer,
        RNO VARCHAR(2),
        time intger,
        runLenght integer,
        states state_table_type
    )
    NESTED TABLE states STORE AS state_table;
    

    Error : ORA-00902: invalid datatype. I assume the error is to do with states state_table_type.


Comments

  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    you have the type declared as sector_type but you use sector_table when you create the table of types. shouldnt these be the same?


  • Registered Users, Registered Users 2 Posts: 1,919 ✭✭✭ronivek


    LG01? :P

    I've added a few lines to your code snippet below; not sure if it's any help.
    Angelkat7 wrote: »
    Hey, I have been trying to create a table with nested tables. I have fallowed a tutorial on how to do it, and check other places to ensure that my method is correct. Yet it still wont work :/ Any help would be great.
    CREATE OR REPLACE TYPE sector_type AS  OBJECT(
        SID integer,
        AIPS integer
    );
    CREATE OR REPLACE TYPE state_table_type AS TABLE OF sector_table;[U][B]Shouldn't this be a table of sector_type?[/B][/U]
    
    CREATE TABLE run (
    
        UNO integer,
        RNO VARCHAR(2),
        time intger, [B][U]Should be integer[/U][/B]
        runLenght integer,
        states state_table_type
    )
    NESTED TABLE states STORE AS state_table;
    

    Error : ORA-00902: invalid datatype. I assume the error is to do with states state_table_type.


  • Registered Users, Registered Users 2 Posts: 229 ✭✭Katniss everMean


    ronivek wrote: »
    LG01? :P

    I've added a few lines to your code snippet below; not sure if it's any help.

    I noticed the sector_type error after I posted. I just feel stupid about the intger :( sorry guys.


Advertisement