Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

sql

oracle

I entered the following SQL commands in Oracle but it complained "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???

like image 406
sc1013 Avatar asked Mar 25 '12 07:03

sc1013


People also ask

What is missing left parenthesis in Oracle?

ORA-00906: missing left parenthesis Cause: A required left parenthesis has been omitted. Certain commands, such as CREATE TABLE, CREATE CLUSTER, and INSERT, require a list of items enclosed in parentheses. Parentheses also are required around subqueries in WHERE clauses and in UPDATE table SET column = (SELECT...)

What does set define off do?

Is the command, which may be abbreviated SET DEF. OFF. Disables variable substitution. ON. Enables variable substitution, and resets the substitution prefix character back to the default ampersand (&) character.


1 Answers

If you are using the dreaded HTML GUI (inside the browser) of OracleXE then that does not support running more than one statement.

Use SQL Developer, SQL*Plus or any other GUI tool instead.

like image 153
a_horse_with_no_name Avatar answered Oct 03 '22 17:10

a_horse_with_no_name