Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help on Data Integrity Constraints

Re: Help on Data Integrity Constraints

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: Tue, 3 May 2005 22:34:11 +0000 (UTC)
Message-ID: <d58u93$75a$1@klatschtante.init7.net>


On 2005-05-03, vsatya_at_gmail.com <vsatya_at_gmail.com> wrote:
> Adding more columns, won't it affect the performance.
>
> Can foreign key constraint be created something like below instead of
> adding new columns?
>
> Constraint constraint1 FOREIGN KEY ('AISTATUS',Status) REFERENCES
> Master(Type,Code),
> Constraint constraint1 FOREIGN KEY ('ROLE',Designation) REFERENCES
> Master(Type,Code),
> Constraint constraint1 FOREIGN KEY ('SEX',Gender) REFERENCES
> Master(Type,Code)
>
> I am getting ORA-00904- invalid identifier error.
>
> Can a foreign key constraint be created with a fixed value and a table
> column referencing another table primary key that has two fields?

You should have a table status, gender and designation, filled with the appropriate values.

Then you can create the foreign keys.

Then you create (if you need it) a view: create view master as

      select * from status 
union select * from gender 
union select * from designation;

btw, type and desc are reserved words
select keyword from v$reserved_words where keyword in ('TYPE','DESC');

hth
Rene

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch/
Received on Tue May 03 2005 - 17:34:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US