Results 1 to 3 of 3

Thread: OO in oracle

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

    Unanswered: OO in oracle

    Hi

    I am getting a bit confused with the OO concept.

    How do I create one to many relationship?
    for example I have a licence type and a categories types
    a licence may have many categories.

    A licence must have at leas a category. but a licence may have many categories
    that is my problem. shoul a create a type that would have the category type inside? or just create a table and ref to the categories?


    Thanks Profetas

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Yes, the OO stuff adds a lot of confusion and is best avoided quite frankly as far as database tables are concerned.

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

    Red face

    I have these types.

    CREATE TYPE name_t AS OBJECT(
    firstname varchar(15),
    middlename varchar(15),
    surname varchar(15)
    );

    CREATE TYPE address_t AS OBJECT(
    street varchar(35),
    city varchar(35),
    post_code varchar(10)
    tel number (15)
    );

    CREATE TYPE citizen_t AS OBJECT(
    name name_t,
    address address_t
    );

    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 bike_car_t AS OBJECT(
    max_weight number (5),
    category category_t
    );

    CREATE TYPE licence AS OBJECT(
    citizen citizen_t (4),
    category category_t
    );

    CREATE TYPE conviction_t AS OBJECT(
    licence_id number(3),
    location address_t,
    financial number(6),
    conv_date date
    );

    CREATE TYPE conv_parking_t AS OBJECT(
    p_humilation varchar(30),
    conviction conviction_t
    );

    CREATE TYPE conv_speed_t AS OBJECT(
    penalty_p number(3),
    conviction conviction_t
    );

    Now I need a licence table and a conviction table and a category table where
    a Licence may have many cotegories and and a licence may have many convictions.

    How do I do that?

    Thanks

Posting Permissions

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