views:

38

answers:

1

HI ALL:
I am trying to make an object oriented data base
and I have the types :
client is the base object(class)
player is under it
and captain is under player
and i need a a table to store data
how can i make a table of client so i can store all these types in it
and who can i insert into it and select please give example if you can thanks in advance

A: 

An example may help:

CREATE TYPE client_type AS OBJECT (
    name        VARCHAR2(30)
  , phone       VARCHAR2(20) 
) NOT FINAL;

CREATE TYPE player_type UNDER client_type ( 
    player_age NUMBER
  , game_played VARCHAR2(30)
) NOT FINAL;

CREATE TABLE client_table OF client_type;
INSERT INTO client_table VALUES (
   client_type(
       "Philip Schlump"
     , "1-800-555-1212" 
   )
);
INSERT INTO client_table VALUES (
   player_type(
       "Jessica Smith"
     , "1-800-555-1212" 
     , 18
     , "Swimming"
   )
);

Take a look at the oracle documentation too, Oracle Type Inheritance

Philip Schlump