M1X
M1X

Reputation: 5374

Oracle SQL error ORA-00907: missing right parenthesis on table create

I want to create the following tabe in Oracle 11g but I get the following error: Oracle SQL error ORA-00907: missing right parenthesis. Why is this happening?

CREATE TABLE DOCUMENTATION
( 
  NAME varchar2(200) not null,
  VALUE varchar2(500) not null,
  QUERY varchar2(200) not null,
  INSERTDATE date(7) not null
);

Upvotes: 0

Views: 172

Answers (3)

srishti
srishti

Reputation: 117

It's because you don't need to provide length to DATE datatype. Oracle Database uses its own internal format to store dates. Date data is stored in fixed-length fields of seven bytes each, corresponding to century, year, month, day, hour, minute, and second.The DATE datatype stores the year (including the century), the month, the day, the hours, the minutes, and the seconds (after midnight).

What should be written instead is-

CREATE TABLE DOCUMENTATION
( 
  NAME varchar2(200) not null,
  VALUE varchar2(500) not null,
  QUERY varchar2(200) not null,
  INSERTDATE date not null
);

Upvotes: 1

Frank Schmitt
Frank Schmitt

Reputation: 30845

The reason for this error is your declaration of INSERTDATE date(7). Get rid of the (7), and everything should work as expected.

Upvotes: 1

redsoxlost
redsoxlost

Reputation: 1235

DATE data type has no length. It should be written as

CREATE TABLE DOCUMENTATION
( 
  NAME varchar2(200) not null,
  VALUE varchar2(500) not null,
  QUERY varchar2(200) not null,
  INSERTDATE date not null
);

Upvotes: 3

Related Questions