Home:ALL Converter>Oracle: Errors Creating A Table With A Foreign Key

Oracle: Errors Creating A Table With A Foreign Key

Ask Time:2012-06-04T23:48:01         Author:Steve

Json Formatter

I'm new to Oracle. I'm trying to create a table with a foreign key, but I keep getting the cryptic error message:

ORA-00907: missing right parenthesis

for:

CREATE TABLE purchase_history
(
    PURCHASE_NUMBER       VARCHAR(16) NOT NULL,
    CREDIT_ENABLED CHAR(1)     NOT NULL CHECK (CREDIT_ENABLED IN ('T','F')),
    CONSTRAINT fk_customers FORIEGN KEY (customer_id) REFERENCES customers(customer_id)

);

I'm not seeing the missing parenthesis. I'm guessing something else is going on. I've Googled around on examples for creating tables with foreign keys. I found a couple of different styles for syntax and tried a few with no joy.

How do I need to change my statement above?

Thanks much

Steve

Author:Steve,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/10884169/oracle-errors-creating-a-table-with-a-foreign-key
yy