Reputation: 7
I am using oracle 10g ex to learn so here is my code
CREATE TABLE MINE
(
NAME VARCHAR(10),
ID INT(3) PRIMARY KEY
);
and my error is
ORA-00907: missing right parenthesis.
but I don't where I missed the right parenthesis. There is any other chance or something I have to know to solve this issue.
Upvotes: 1
Views: 1023
Reputation: 310993
The int
datatype doesn't take a size argument:
CREATE TABLE MINE
(
NAME VARCHAR(10),
ID INT PRIMARY KEY -- Here!
);
Upvotes: 2
Reputation: 167774
INT
does not need a size - it is an alias for NUMBER(38)
.
CREATE TABLE MINE
(
NAME VARCHAR(10),
ID INT PRIMARY KEY
);
However, what you probably want is to use VARCHAR2
and NUMBER
types:
CREATE TABLE MINE
(
NAME VARCHAR2(10),
ID NUMBER(3,0) PRIMARY KEY
);
And now is the time to get into good habits - you probably also want to name your constraints:
CREATE TABLE MINE
(
NAME VARCHAR2(10),
ID NUMBER(3,0) CONSTRAINT mine__id__pk PRIMARY KEY
);
Upvotes: 5