"ORA-00922: missing or invalid parameter" when creating tables

I injected the following SQL commands into Oracle, but it complained about "ORA-00922: missing or invalid option"

CREATE TABLE Student ( StuID NUMBER(15), StuName VARCHAR2(50), Phone VARCHAR2(20), PRIMARY KEY (StuID)) CREATE TABLE Program ( ProCode VARCHAR2(12), ProTitle VARCHAR2(50), PRIMARY KEY (ProCode)) 

WHY???

+4
source share
3 answers

If you use the terrible HTML-graphical interface (inside the browser) of OracleXE, this does not support the launch of more than one statement.

Instead, use SQL Developer, SQL * Plus, or any other GUI tool.

+7
source
 CREATE TABLE Student ( StuID NUMBER(15), StuName VARCHAR2(50), Phone VARCHAR2(20), CONSTRAINT PK_STUID PRIMARY KEY (StuID)) 

Found the answer here .

Edit:

Also, try using / as a separator for operators instead ;

+4
source

Do not try to determine the size of the StuID. also add restriction key operation and just to use DROP before CREATE for example:

 DROP TABLE Student; CREATE TABLE Student ( StuID NUMBER, StuName VARCHAR2(50), Phone VARCHAR2(20), constraint pk_Student PRIMARY KEY (StuID)); DROP TABLE Program; CREATE TABLE Program ( ProCode VARCHAR2(12), ProTitle VARCHAR2(50), constraint pk_Program PRIMARY KEY (ProCode)); 
+1
source

Source: https://habr.com/ru/post/1403299/


All Articles