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

Home -> Community -> Usenet -> c.d.o.server -> column_constraint_clause

column_constraint_clause

From: kev <kevin.porter_at_fast.no>
Date: Mon, 02 Aug 1999 18:36:27 +0100
Message-ID: <37A5D71B.93D620D6@fast.no>


Hi,

I was wondering why I get an error with this create table statement:

create table country
(

        code varchar2(5) primary key,
        cont varchar2(5) foreign key references continent (code),
        name varchar2(30) not null

);

The error I get is:

 cont varchar2(5) foreign key references continent (code),

                  *

ORA-00907: missing right parenthesis

I'm trying to make cont a foreign key which references the code column of the continent table.
Is 'foreign key references continent (code),' not a valid column_constraint_clause' (as described on p.379 of the Oracle DB Administration book by O'Reilly). Is it in the wrong place? I noticed that in the $ORACLE_HOME/rdbms/demo/summit2.sql script, foreign keys are added using the ALTER TABLE command after the tables have been created. Why is this? What is the usual way of specifying foreign keys?

Thanks,

Received on Mon Aug 02 1999 - 12:36:27 CDT

Original text of this message

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