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 -> Adding foreign keys after table creation?

Adding foreign keys after table creation?

From: Doug O'Leary <dkoleary_at_mediaone.net>
Date: Wed, 15 Dec 1999 21:29:47 -0600
Message-ID: <MPG.12c218a637159e829896ed@nntp.ce.mediaone.net>


Hi;

I'm a complete newbie on Oracle and SQL. I got my copy of Oracle Personal Edition installed and working - at least the initial database is there and I'm able to play around with it.

In order to learn, I've bought a book from Osborne called SQL, The Complete Reference. I tried the create table script that they have in the book and it's not working correctly due to the differences between what the book calls standard and Oracle's sql. If I can get the tables created, I can keep going with the book; however, I'm having difficulties working through Oracle's syntax for adding foreign keys after the table's been created.

I've tried variations on the following:

alter table customers
modify cust_rep constraint foreign key cr_fk references salesreps;

and

alter table customers
add constraint foreign key (cust_rep)
references salesreps.

Any tips on this particular problem would be greatly appreciated - also, any tips on sql books that lean towards Oracle would also be helpful.

Thanks for your time.

Doug O'Leary
--



Douglas K. O'Leary
Senior System Admin
dkoleary_at_mediaone.net
Received on Wed Dec 15 1999 - 21:29:47 CST

Original text of this message

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