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 -> [Q] Foreign keys and indexes

[Q] Foreign keys and indexes

From: replace this with _at_ <_at_)xs4all.nl>
Date: 1998/01/25
Message-ID: <34ca186a.1185514@news.xs4all.nl>#1/1

Hi,

I want to create a foreign key constraint and use an index. But if I want the foreign key field to be used together with another field in another index, I don't want to create another index for the foreign key. If I don't specify 'USING INDEX', does Oracle create an index by itself?

Assume the usage of EMPLOYEE (EMP) and DEPARTMENT (DEPT). Is the following order correct? Can I leave the 'USING INDEX' out?

ALTER TABLE EMP
ADD CONSTRAINT EMP_FK
FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO) USING INDEX
DISABLE; CREATE INDEX TEST ON EMP (DEPTNO, EXTRA_FIELD); ALTER TABLE EMP
MODIFY CONSTRAINT EMP_FK
ENABLE; Many thanks in advance.


Received on Sun Jan 25 1998 - 00:00:00 CST

Original text of this message

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