Kyle Reese
Kyle Reese

Reputation: 9

What does it mean by constraint specification not allowed here?

CREATE TABLE MyTable
   (FName Varchar2(20) CONSTRAINT MyTable_FName_def DEFAULT 'MyName',
   LName varchar2(20) );

I got the following error when I run the above query,

constraint specification not allowed here

Upvotes: 0

Views: 999

Answers (1)

Jodrell
Jodrell

Reputation: 35716

If you examine The Oracle manual, you'll see that a DEFAULT value does not need a CONSTRAINT keyword

You should use:

CREATE TABLE MyTable
    (
        FName Varchar2(20) DEFAULT 'MyName',
        LName Varchar2(20)
    );

Upvotes: 1

Related Questions