Search code examples
sqloracle-databaseforeign-keyscreate-table

Oracle: Errors Creating A Table With A Foreign Key


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


Solution

  • Start with:

    FORIEGN -> FOREIGN