ORA-00907缺失右括号错误:创建SSV_PASSENGERS表求助
Hey there! Let's figure out why you're hitting that ORA-00907 "missing right parenthesis" error when creating the SSV_PASSENGERS table. I found two clear issues in your script that are causing this problem:
1. Invalid DATE type declaration
Oracle's DATE data type doesn't require a format specified in parentheses. The line:
PASS_DOB DATE(yyyy-mm-dd),
is incorrect because DATE stores date/time data natively—display formatting is handled by your database's NLS settings or via TO_CHAR() when querying. You should rewrite this line to:
PASS_DOB DATE,
2. Column name with unescaped space
The line PASS SATRATE VARCHAR(2), has a space in the column name, which Oracle doesn't allow unless you wrap the name in double quotes (e.g., "PASS SATRATE"). Using spaces in column names is generally discouraged though, as it forces you to quote the name every time you reference it and makes queries harder to read. A better approach is to use an underscore:
PASS_SATRATE VARCHAR(2),
Corrected Full Script
Here's the fixed version of your table creation script:
CREATE TABLE SSV_PASSENGERS ( PASS_ID# CHAR(6), PASS_FNAME VARCHAR(15), PASS_LNAME VARCHAR(15), PASS_ADDRESS VARCHAR(30), PASS_NATION VARCHAR(20), PASS_DOB DATE, PASS_SATRATE VARCHAR(2), PASS_CAB# CHAR(4), PASS_CABFARE NUMBER(6,2), PASS_TOTALEX NUMBER(7,2), PASS_MEDINFO VARCHAR(30), PASS_DIET VARCHAR(30), PASS_EMNAME VARCHAR(20), PASS_EMPHONE# CHAR(10), PASS_ALTID CHAR(5), CONSTRAINT SSV_PASSENGERS_PK PRIMARY KEY (PASS_ID#) );
内容的提问来源于stack exchange,提问作者J. Lee

