1

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.

3 Answers3

5

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 
);
Community
  • 1
  • 1
MT0
  • 143,790
  • 11
  • 59
  • 117
2

The int datatype doesn't take a size argument:

CREATE TABLE MINE 
(
    NAME VARCHAR(10),
    ID INT PRIMARY KEY -- Here!
);
Mureinik
  • 297,002
  • 52
  • 306
  • 350
-2

create table Mine(name varchar(10),Id number(20) PRIMARY KEY);

S.Harini
  • 1
  • 1
  • 1
    Could you please [edit] in an explanation of why this code answers the question? Code-only answers are [discouraged](http://meta.stackexchange.com/q/148272/274165), because they don't teach the solution. – Nathan Tuggy Apr 07 '17 at 04:16