Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Why I keep gettng Oracle Right Parenthesis missing error?

CREATE TABLE Owner

( OID integer primary key,

OFirst varchar(30) not null,

LName varchar(30) not null,

DOB Date,

OAddress varchar(75)not null,

VID integer foreign key

);

I don't see any syntax errors yet ORACLE SQL Application Express program keeps saying there is an error! Please help!

Update:

Here's the official error: ORA-00907: missing right parenthesis

3 Answers

Relevance
  • Todd
    Lv 7
    9 years ago
    Favorite Answer

    Oracle is looking for a REFERENCES on the line VID integer FOREIGN KEY. You need to specify the reference that the foreign key constraint points to.

    According to their website, Oracle prefers syntax like...

    CREATE TABLE Owner

    ( OID integer PRIMARY KEY,

    OFirst VARCHAR(30) NOT NULL,

    LName VARCHAR(30) NOT NULL,

    DOB DATE,

    OAddress VARCHAR(75) NOT NULL,

    VID INTEGER NOT NULL,

    CONSTRAINT VID FOREIGN KEY REFERENCES parent_table (column)

    );

  • 8 years ago

    Like Todd said, you cannot have a FOREIGN KEY specification without saying what table (and column[s]) it references. That is not an Oracle-specific requirement. It is a generic requirement for all relational databases.

  • ?
    Lv 4
    5 years ago

    Roll no isn't an acceptabe title for a discipline. In an effort to destroy the code. You do not say what coding language this is, nor what database. Elaborate to inform if something is proper.

Still have questions? Get your answers by asking now.