Results 1 to 6 of 6

Thread: Pointer?

  1. #1
    Join Date
    Jan 2004
    Location
    UK
    Posts
    21

    Talking Unanswered: Pointer?

    Can I declare a pointer to a object that has objects inside?
    i.g.


    CREATE TYPE category_t AS OBJECT(
    title varchar(20),
    gain_date date,
    expire_date date
    );

    CREATE TYPE cat_car_t AS OBJECT(
    n_passangers number (3),
    category category_t
    );
    CREATE TYPE bike_car_t AS OBJECT(
    engine_p number (4),
    category category_t
    );

    CREATE type cat_list AS OBJECT(
    car cat_car_t,
    bike bike_cat_);

    now suppost I point a table to the ob above

    CREATE TYPE licence AS OBJECT(
    licence_id number,
    citizen citizen_t (4),
    category REF cat_list
    );

    is that valid?

    suppose I had a table and I wanted to add a licence that would refer to one type inside the cat_list. how would I do that?

    Thanks a Lot

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Don't know. Are you doing this just as an exercise to learn about these features? If so, fair enough. But I would advise strongly against using this type of model as the basisi for any real database!

  3. #3
    Join Date
    Jan 2004
    Location
    UK
    Posts
    21
    that is for my University. I don't think that OO DB has any future,
    I don't know why they want to teach us this things.

    I think the only advantdge of OO is to save some space,
    and It isn't that much.

  4. #4
    Join Date
    Feb 2004
    Posts
    108
    Agreed with Tony.
    Oracle would support this only if you have your OTs as a part of your table. In this case, car_list type should be defined as a type in your main table.
    But - in having this design, you cannot have what you wanted - "I wanted to add a licence that would refer to one type inside the cat_list"
    An entry in "cat_list" cannot independently exist.
    Rather than this, having a cat_list table and using foreign key relationship would work.

  5. #5
    Join Date
    Jan 2004
    Location
    UK
    Posts
    21
    I must use OO concept. I can't use PK or FKs

  6. #6
    Join Date
    Jan 2004
    Location
    UK
    Posts
    21

    Angry

    I got it.

    I am gonna do the reverse.
    in each category (car, bike so on) I will add a ref to the Licence type.

    The Ref works the same way as the FK. so when I add a new record in a specific category it will ref to the licence that has that category.
    That was so simple and took me 2 days to figure out.
    Last edited by profetas; 05-10-04 at 15:59.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •