Maher Jacob Maher Jacob - 1 year ago 128
SQL Question

"ORA-00984: column not allowed here" when attempting to create table using SQL

I am attempting to run this script to create a table, however I get a column not allowed error. After doing some research it seems that it could be that it could be a syntax error concerning values, however I am not inserting any values.

sales_id VARCHAR2(10) PRIMARY KEY,
sales_fname VARCHAR2(35) NOT NULL,
sales_lname VARCHAR2(35) NOT NULL,
sales_email VARCHAR2(35) NOT NULL,
sales_region VARCHAR2(35) NOT NULL CHECK(sales_region IN ('NORTH','SOUTH','EAST','WEST')),
sales_phone CHAR(10) NOT NULL,
hire_date DATE DEFAULT 01-JAN-2001 NOT NULL);

What am I overlooking?

Answer Source

I am getting a different error message, but probably due to the same mistake. You can't set the default to 01-JAN-2001. Perhaps just putting it in single quotes will fix it; better, to_date('01-JAN-2001', 'DD-MON-YYYY').

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download