1

I'd like to make a simple project for school using Oracle Application Express (Apex) and but when I try to run a simple code line for creating a new table I get this:

ORA-00907: missing right parenthesis

Here you have the SQL command:

CREATE TABLE masini (  
   ID INT AUTO_INCREMENT PRIMARY KEY NOT NULL, 
   nr_inmatriculare VARCHAR(10) NOT NULL UNIQUE, 
   model VARCHAR(32), 
   marca VARCHAR(32), 
   pret INT NOT NULL,  
   cantitate INT NOT NULL );

Also do I have to specify the NOT NULL property for ID or does PRIMARY KEY already do it by default?

Hleb
  • 7,037
  • 12
  • 58
  • 117
Pop Vlad
  • 181
  • 2
  • 9
  • 4
    You don't need to add NOT NULL to a column that is PRIMARY KEY - that's guaranteed already. There is no "AUTO_INCREMENT" in Oracle, that's what is causing the error. Read about the Oracle equivalent, for example here: http://stackoverflow.com/questions/11296361/how-to-create-id-with-auto-increment-on-oracle Also in Oracle it is best to use VARCHAR2 data type rather than VARCHAR (see Oracle documentation for why). –  Jan 13 '17 at 22:31
  • 1
    Where in the [Oracle **manual**](https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_7002.htm#SQLRF01402) did you find `auto_increment`? –  Jan 13 '17 at 22:46
  • there's no need to be rude – Pop Vlad Jan 13 '17 at 22:55

0 Answers0