Home:ALL Converter>Using sql oracle to add a foreign key

Using sql oracle to add a foreign key

Ask Time:2013-01-16T00:32:30         Author:user1156596

Json Formatter

I'm trying to add a key from my customer table to my reservation table in oracle. However I keep getting an error message when I try to run my SQL commands which states 'Customer_ID is an invalid identifier'.

What I am trying to do is first use an alter statement to alter the reservation table. Then I am adding a foreign key, which is called 'Customer_ID' Then I enter a references statement, which tells it that I am getting the CUSTOMER_ID attribute from the customer table. However to sql this doesn't make sense at all.

To me, logically it makes sense, I don't see anything wrong with the syntax or structure of the statements. Any sharp eyes/minds to help me on this matter would be greatly appreciated.

the statements used are:

ALTER TABLE reservation
ADD FOREIGN KEY (Customer_ID)
REFERENCES Customer(Customer_ID);

Author:user1156596,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14342307/using-sql-oracle-to-add-a-foreign-key
yy