create table item_avail
 (
   pro_id int primary key,
   mod_id int,
   color varchar(10)
 );

 create table Laptop
 (
   pro_id int primary key,
   mod_id varchar(5) not null check (mod_id like "L%"),
   color varchar2(10),
   comp_name varchar2(20),
   RAM number(5),
   spaceHD number(4),
   foreign key (pro_id, mod_id, color) references item_avail (pro_id, mod_id, color)
 );
 create table Handycam
 (
   pro_id int primary key,
   mod_id varchar(5) not null check (mod_id like "H%"),
   color varchar2(10),
   comp_name varchar2(20),
   zoomX number,
   foreign key (pro_id, mod_id, color) references item_avail (pro_id, mod_id, color)
 );
 create table Mobile
 (
   pro_id int primary key,
   mod_id varchar(5) not null check (mod_id like "M%"),
   color varchar2(10),
   comp_name varchar2(20),
   camerapixel integer,
   foreign key (pro_id, mod_id, color) references item_avail (pro_id, mod_id, color)
 );

I have tried inheritance.......
Superclass : item_avail
Subclasses : Laptop, Mobile, Handycam

While running I face errors due to 'check' constraint...
Is there any better way of doing it..????
Please help...ASAP
:-/
:?:

Recommended Answers

All 2 Replies

I am using Oracle 10g. I don't know how to implementing inheritance. I even searched it on the net, but I did not get any thing.
I have a base table as 'items_available (product_id, model_id, color)'

The sub-tables are as follows...

laptop (product_id, model_id, memory, hardrive, company_name, price, color);
handycam (product_id, model_id, zoom, pixel, company_name, price, color);

Please help ASAP.......
thnx..

You need to understand first what inheritance is ?

What exactly you are trying to do ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.